[Bug c/84100] [7 Regression] Function __attribute__((optimize(align-loops=32))) gives spurious warning
gcc at gmch dot uk
gcc-bugzilla@gcc.gnu.org
Fri Feb 2 14:50:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84100
--- Comment #6 from Chris Hall <gcc at gmch dot uk> ---
Created attachment 43325
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43325&action=edit
Summary of results using Compiler Explorer: for v5.4.0, 6.3.0 and 7.2.0.
Setting -O2 or -O3 on the command line appears to imply -falign-functions=16
and -falign-loops=n, where n is at least 10 but less than 14.
Setting -falign-functions=32 on the command line does the requested alignment,
plus the implied -falign-loops=n for -O2 and -O3 -- except for -Os, which does
no alignment
Setting both -falign-functions=32 and -falign-loops=32 on the command line does
both requested alignments -- except for -Os which does neither and -O0 which
does only the function alignment.
So far, so good.
One might hope that using _Pragma() would have the same effect as the command
line -falign-functions=32 and -falign-loops=32. Sadly, this is not the case.
As reported, v7 rejects the pragmas. But I find that v5.4.0 and v6.3.0, (a)
don't always do the same thing and (b) don't always align loops as requested.
In particular: for -O2 and -O3, setting both align-functions=32 and
align-loops=32 by _Pragma() will: align functions as requested, BUT loops are
aligned to 8 (which is less than useful) !!
The last set of results looks at compiling with command line -O0 through to -O3
(including -Og and -Os), with _Pragma() for -O3, align-functions=32 and
align-loops=32. The _Pragma() for -O3 seems to override the command line as
far as this small test is concerned, except for -fomit-frame-pointer. Sadly,
align-loops=32 is still broken.
More information about the Gcc-bugs
mailing list