http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60034
Bug ID: 60034 Summary: "invalid expression as operand" in aarch64 inline asm Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: kuganv at linaro dot org Created attachment 32017 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32017&action=edit pre processed source This issue is originally reported in https://bugs.launchpad.net/gcc-linaro/+bug/1270789 The attached pre-processed source fails with: # aarch64-linux-gnu-gcc -std=gnu99 -fgnu89-inline -O -Wall -Winline -Wwrite-strings -fmerge-all-constants -frounding-math -g -Wstrict-prototypes malloc.i malloc.c: In function ‘__libc_mallopt’: malloc.c:4761:16: error: invalid 'asm': invalid expression as operand Splitting this inline asm out into a smaller testcase does not seem to reproduce the issue. It's possible this is a bug in the source file, but it's not clear from gcc's output what the problem is. Seems to be an issue with alignment calculation in aarch64_classify_address. for rtl of the form (lo_sum:DI (reg/f:DI 132) (symbol_ref:DI ("*.LANCHOR4") [flags 0x182])) we are currently calculating align of 8bits and due to this the following statement returns false. This causes output_addr_const (in gcc/final.c) to fail. return ((INTVAL (offs) & (ref_size - 1)) == 0 && ((align / BITS_PER_UNIT) & (ref_size - 1)) == 0); AFIK, align of 8bits is not correct here. GCC version and config: arm-none-linux-gnueabi-gcc -v Using built-in specs. COLLECT_GCC=/home/kugan/work/builds/gcc-fsf-trunk/tools/bin/arm-none-linux-gnueabi-gcc COLLECT_LTO_WRAPPER=/home/kugan/work/builds/gcc-fsf-trunk/tools/libexec/gcc/arm-none-linux-gnueabi/4.9.0/lto-wrapper Target: arm-none-linux-gnueabi Configured with: /home/kugan/work/sources/gcc-fsf/trunk/configure --target=arm-none-linux-gnueabi --prefix=/home/kugan/work/builds/gcc-fsf-trunk/tools --with-sysroot=/home/kugan/work/builds/gcc-fsf-trunk/sysroot-arm-none-linux-gnueabi --disable-libssp --disable-libgomp --disable-libmudflap --enable-languages=c,c++ --with-arch=armv7-a --with-fpu=vfpv3-d16 --with-float=softfp --with-thumb Thread model: posix gcc version 4.9.0 20130922 (experimental) (GCC)