https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94381
Bug ID: 94381 Summary: -falign-function/-falign-labels/-falign-loops documentation is inaccurate Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: driver Assignee: unassigned at gcc dot gnu.org Reporter: hjl.tools at gmail dot com CC: crazylht at gmail dot com, skpgkp2 at gmail dot com Target Milestone: --- '-falign-functions' '-falign-functions=N' '-falign-functions=N:M' '-falign-functions=N:M:N2' '-falign-functions=N:M:N2:M2' Align the start of functions to the next power-of-two greater than N, skipping up to M-1 bytes. But [hjl@gnu-cfl-2 align]$ cat y.i void foo (void) { } [hjl@gnu-cfl-2 align]$ gcc -O2 -S -falign-functions=4 y.i [hjl@gnu-cfl-2 align]$ cat y.s .file "y.i" .text .p2align 2 <<<<<<<< 4 is not the next power-of-two greater than 4. .globl foo .type foo, @function foo: .LFB0: .cfi_startproc ret .cfi_endproc .LFE0: .size foo, .-foo .ident "GCC: (GNU) 9.3.1 20200317 (Red Hat 9.3.1-1)" .section .note.GNU-stack,"",@progbits [hjl@gnu-cfl-2 align]$ It should be "the next power-of-two no less than N". '-falign-labels' '-falign-labels=N' '-falign-labels=N:M' '-falign-labels=N:M:N2' '-falign-labels=N:M:N2:M2' Align all branch targets to a power-of-two boundary. and '-falign-loops' '-falign-loops=N' '-falign-loops=N:M' '-falign-loops=N:M:N2' '-falign-loops=N:M:N2:M2' Align loops to a power-of-two boundary. may leave an impression of alignment is N to the power-of-two.