← Back to team overview

touch-packages team mailing list archive

[Bug 1270789] Re: gcc 4.8: "invalid expression as operand" in aarch64 inline asm

 

Launchpad has imported 8 comments from the remote bug at
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60034.

If you reply to an imported comment from within Launchpad, your comment
will be sent to the remote bug automatically. Read more about
Launchpad's inter-bugtracker facilities at
https://help.launchpad.net/InterBugTracking.

------------------------------------------------------------------------
On 2014-02-02T22:10:19+00:00 Kuganv wrote:

Created attachment 32017
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)

Reply at: https://bugs.launchpad.net/gcc-linaro/+bug/1270789/comments/3

------------------------------------------------------------------------
On 2014-02-02T22:11:33+00:00 Kuganv wrote:

Created attachment 32018
Proposed patch

Reply at: https://bugs.launchpad.net/gcc-linaro/+bug/1270789/comments/4

------------------------------------------------------------------------
On 2014-02-02T22:24:01+00:00 Kuganv wrote:


I am sorry that I entered wrong gcc -v (cut and paste error). It is an aarch64 issue and the correct gcc -v is below:


aarch64-none-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/home/kugan/work/builds/gcc-fsf-trunk/tools/bin/aarch64-none-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/home/kugan/work/builds/gcc-fsf-trunk/tools/libexec/gcc/aarch64-none-linux-gnu/4.9.0/lto-wrapper
Target: aarch64-none-linux-gnu
Configured with: /home/kugan/work/sources/gcc-fsf/trunk/configure --target=aarch64-none-linux-gnu --prefix=/home/kugan/work/builds/gcc-fsf-trunk/tools --without-headers --with-newlib --disable-shared --disable-threads --disable-libssp --disable-libgomp --disable-libmudflap --disable-libatomic --without-libquadmath --disable-libquadmath --enable-languages=c
Thread model: single
gcc version 4.9.0 20130922 (experimental) (GCC)

Reply at: https://bugs.launchpad.net/gcc-linaro/+bug/1270789/comments/5

------------------------------------------------------------------------
On 2014-02-02T23:38:04+00:00 Pinskia wrote:

Here is a reduced testcase:
static unsigned long global_max_fast;
int __libc_mallopt (int param_number, int value)
{
 __asm__ __volatile__ ("# %[_SDT_A2]" :: [_SDT_A2] "nor" ((global_max_fast)));
 global_max_fast = 1;
}

Reply at: https://bugs.launchpad.net/gcc-linaro/+bug/1270789/comments/6

------------------------------------------------------------------------
On 2014-02-07T10:46:16+00:00 Ramana-gcc wrote:

(In reply to Kugan from comment #1)
> Created attachment 32018 [details]
> Proposed patch

Please submit patches on gcc-patches@xxxxxxxxxxx

Reply at: https://bugs.launchpad.net/gcc-linaro/+bug/1270789/comments/7

------------------------------------------------------------------------
On 2014-02-16T22:27:34+00:00 Kuganv wrote:

There is a rgression with this patch in qemu aarch64-none-linux-gnu for
pr38151.c.

pr38151.c:(.text+0x10c): relocation truncated to fit:
R_AARCH64_LDST64_ABS_LO12_NC against `.rodata'
collect2: error: ld returned 1 exit status


asm diff is as shown below.

< 	add	x0, x0, :lo12:.LANCHOR0
< 	ldr	x0, [x0]
---
> 	ldr	x0, [x0,#:lo12:.LANCHOR0]

If I however increase the alignment of .rodata where .LANCHOR0 is
defined, this passes.  Is alignment of BITS_PER_UNIT valid for
SYMBOL_REF? If I change it as I am doing this attached patch, is there
anything else I need to do. Any tips?

Reply at: https://bugs.launchpad.net/gcc-linaro/+bug/1270789/comments/8

------------------------------------------------------------------------
On 2014-03-30T22:42:31+00:00 Kugan wrote:

Author: kugan
Date: Sun Mar 30 22:41:59 2014
New Revision: 208949

URL: http://gcc.gnu.org/viewcvs?rev=208949&root=gcc&view=rev
Log:
PR target/60034
* aarch64/aarch64.c (aarch64_classify_address): Fix alignment for
section anchor.

PR target/60034
* gcc.target/aarch64/pr60034.c: New file.


Added:
    trunk/gcc/testsuite/gcc.target/aarch64/pr60034.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/aarch64/aarch64.c
    trunk/gcc/testsuite/ChangeLog

Reply at: https://bugs.launchpad.net/gcc-linaro/+bug/1270789/comments/9

------------------------------------------------------------------------
On 2014-04-14T13:52:13+00:00 Ramana-gcc wrote:

Fixed on trunk for 4.9.0.

Reply at: https://bugs.launchpad.net/gcc-linaro/+bug/1270789/comments/11


** Changed in: gcc
       Status: Unknown => Fix Released

** Changed in: gcc
   Importance: Unknown => Medium

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to gcc-4.8 in Ubuntu.
https://bugs.launchpad.net/bugs/1270789

Title:
  gcc 4.8: "invalid expression as operand" in aarch64 inline asm

Status in The GNU Compiler Collection:
  Fix Released
Status in Linaro GCC:
  Fix Released
Status in “gcc-4.8” package in Ubuntu:
  Fix Released

Bug description:
  
  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.

To manage notifications about this bug go to:
https://bugs.launchpad.net/gcc/+bug/1270789/+subscriptions