This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug rtl-optimization/68974] New: inline assembly blocks getting re-ordered on x86_64 and aarch64


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68974

            Bug ID: 68974
           Summary: inline assembly blocks getting re-ordered on x86_64
                    and aarch64
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mdaniels at qnx dot com
  Target Milestone: ---

Created attachment 37076
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37076&action=edit
Minimal example to reproduce

When compiling for x86_64, or aarch64, I am seeing some inline assembly blocks
that contain labels getting reordered. I do not see this when compiling for x86
or armv7.

This is only happening when -O2 is used, any other level seems fine. I expanded
-O2 based on what the docs said it turns on, hoping to isolate it a bit more,
but was unable to reproduce. Was able to work around it using
-fno-reorder-blocks.

I have reduced the code as much as possible and attached the preprocessed
output.

I have tried with 4.8 and 5.3 and 6.0. All show the same behaviour, with the
exception that if the calls to atomic_boundry() are removed, 6.0 seems to start
working.

Here is how I was running the test case:

$ gcc-5 -Wall -Wextra -O2 -fno-strict-aliasing -fwrapv
-fno-aggressive-loop-optimizations -c -o /tmp/test.o test.i
test.i: Assembler messages:
test.i:38: Error: backward ref to unknown label "1:"
$ # change .quad to .long in the test
$ gcc-5 -m32 -Wall -Wextra -O2 -fno-strict-aliasing -fwrapv
-fno-aggressive-loop-optimizations -c -o /tmp/test.o test.i
$ gcc-5 --version
gcc-5 (Ubuntu 5.3.0-3ubuntu1~14.04) 5.3.0 20151204
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ aarch64-linux-gcc -Wall -Wextra -O2 -fno-strict-aliasing -c -o /tmp/test.o
aarch64_hat.i
/tmp/ccUBZBIv.s: Assembler messages:
/tmp/ccUBZBIv.s:21: Error: backward ref to unknown label "1:"
$ aarch64-linux-gcc --version
aarch64-linux-gcc (GCC) 6.0.0 20151216 (experimental)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ gcc-4.8 -Wall -Wextra -O2 -fno-strict-aliasing -fwrapv
-fno-aggressive-loop-optimizations -c -o /tmp/test.o test.i
test.i: Assembler messages:
test.i:38: Error: backward ref to unknown label "1:"
$ gcc-4.8 --version
gcc-4.8 (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]