Bug 11368 - -falign-* has no effect on i386
Summary: -falign-* has no effect on i386
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 3.3
: P2 normal
Target Milestone: 3.3.1
Assignee: Andrew Pinski
URL:
Keywords: documentation
Depends on:
Blocks:
 
Reported: 2003-06-29 10:34 UTC by Debian GCC Maintainers
Modified: 2005-10-31 00:49 UTC (History)
1 user (show)

See Also:
Host: i386-linux
Target: i386-linux
Build: i386-linux
Known to work:
Known to fail:
Last reconfirmed: 2003-06-29 12:41:26


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Debian GCC Maintainers 2003-06-29 10:34:16 UTC
[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.
Comment 1 Andrew Pinski 2003-06-29 12:41:12 UTC
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.
Comment 2 Andrew Pinski 2003-07-05 17:15:33 UTC
Updated patch submitted: <http://gcc.gnu.org/ml/gcc-patches/2003-07/msg00534.html>
Comment 3 Andrew Pinski 2003-07-07 04:56:22 UTC
Fixed on the mainline.
Comment 4 GCC Commits 2003-07-07 08:02:48 UTC
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

Comment 5 Andrew Pinski 2003-07-07 10:14:31 UTC
And fixed for 3.3.1.