[forwarded from http://bugs.debian.org/198269] Compiling the following program (b.c) on i386 int f(int a) { int i = 0; if (a > 3) goto end; return 3; end: return g(0); } with "gcc -O2 -falign-jumps=0 -S" produces .file "b.c" .text .p2align 2,,3 .globl f .type f, @function f: pushl %ebp movl %esp, %ebp cmpl $3, 8(%ebp) jle .L4 .L3: movl $0, 8(%ebp) leave jmp g .p2align 2,,3 .L4: movl $3, %eax leave ret .size f, .-f .ident "GCC: (GNU) 3.3 (Debian)" As you can see, -falign-jumps=0 was ignored. -malign-jumps=0 does work on the other hand. This applies to all -falign-* options.
To not align loops with -falign-* use 1 as the alignment (like the documentation says to do at least for align-functions but it applies for all of them), since it use n not 2^n, unlike - malign-*. See the documentation, there is one thing the documenation should say but does not: If n is not specified (or is zero), use a machine-dependent default. The or is zero part is not there I will sumbit a patch for and resync all the -falign-* options sos they look the same. This is case where the documentation is not clear but I will change that.
Updated patch submitted: <http://gcc.gnu.org/ml/gcc-patches/2003-07/msg00534.html>
Fixed on the mainline.
Subject: Bug 11368 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_3-branch Changes by: aj@gcc.gnu.org 2003-07-07 08:02:43 Modified files: gcc/doc : invoke.texi gcc : ChangeLog Log message: 2003-07-07 Andrew Pinski <pinskia@physics.uc.edu> PR optimization/11368 * doc/invoke.texi (-falign-functions): Document that when n is zero then a machine-dependent default is used. (-falign-labels): Document that when n is zero then a machine-dependent default is used and that -falign-labels =1 is equivalent to -fno-align-labels. (-falign-loops): Likewise. (-falign-jumps): Likewise. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/doc/invoke.texi.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.209.2.38&r2=1.209.2.39 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.16114.2.637&r2=1.16114.2.638
And fixed for 3.3.1.