https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96247
Bug ID: 96247 Summary: -falign-functions=0 works wrongly Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: hujiangping at cn dot fujitsu.com Target Milestone: --- When reading the description of -falign-functions=n in doc/invoke.texi or gcc man page, I did the following test and found a problem. --- > # sed -n '11333,11334p' invoke.texi > If @var{n} is not specified or is zero, use a machine-dependent default. > The maximum allowed @var{n} option value is 65536. > > $ cat hello.c > int foo() { > int s = 0; > > for (int i=0; i < 10; i++) { > s += i; > } > > return s; > } > > $ /home/extra_mnt/cross_build_gcc/bin/aarch64-linux-gcc -falign-functions -S > hello.c; mv hello.s hello.s.align > $ /home/extra_mnt/cross_build_gcc/bin/aarch64-linux-gcc -falign-functions=0 > -S hello.c; mv hello.s hello.s.0 > $ diff -u hello.s.align hello.s.0 > --- hello.s.align 2020-07-20 10:57:30.660038984 +0800 > +++ hello.s.0 2020-07-20 10:57:33.689038984 +0800 > @@ -2,7 +2,6 @@ > .file "hello.c" > .text > .align 2 > - .p2align 4,,11 > .global foo > .type foo, %function > foo: > > > $ /home/extra_mnt/cross_build_gcc/bin/aarch64-linux-gcc --version > aarch64-linux-gcc (GCC) 11.0.0 20200519 (experimental) > Copyright (C) 2020 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. --- I think the compiler's behavior is inconsistent with the doc, the assembly code should be no defference when -falign-functions option or -falign-functions=0 option is specified. I found that the parameter which the target sources like gcc/config/aarch64/aarch64.c used was the command line argument '0', not the machine-dependent parameters which should overide the '0'. So I have submit a patch to gcc-patches list, but still have no comments.