This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

optimization/6673: gcc-3.1 produces wrong assembly code



>Number:         6673
>Category:       optimization
>Synopsis:       gcc-3.1 produces wrong assembly code
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Thu May 16 03:46:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Nam SungHyun
>Release:        3.1
>Organization:
>Environment:
System: Linux namsh 2.4.19-pre8 #3  5 3 11:33:25 KST 2002 i686 unknown
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: powerpc-unknown-eabi
configured with: ./configure --disable-nls --target=ppc-eabi --prefix=/usr/GNUPPC --with-gnu-ld --with-gnu-as --program-prefix=ppc-eabi-
>Description:
	I build powerpc-unknown-eabi cross compiler using gcc
	CVS tree (cvs co -r gcc_3_1_release).

	input source (ex.c) is:
	============================================================ 
	    unsigned long a;
	    int
	    main(void)
	    {
		for (;;)
		    ++a;
	    }
	============================================================ 

	'ppc-eabi-gcc -O1 -S ex.c' generates:
	============================================================ 
		    .file	"ex.c"
		    .globl __eabi
		    .section	".text"
		    .align 2
		    .globl main
		    .type	main,@function
	    main:
		    stwu 1,-8(1)
		    mflr 0
		    stw 0,12(1)
		    bl __eabi
	    .L2:
		    b .L2
	    .Lfe1:
		    .size	main,.Lfe1-main
		    .comm	a,4,4
		    .ident	"GCC: (GNU) 3.1"
	============================================================ 

	There's no asm code for '++a'.
	ppc-eabi-gcc 2.95.4 20010319 (prerelease) works as I expected.

>How-To-Repeat:
	Always...
	preprocessor output is same as input source. so simple source

>Fix:
	1. use 'volatile' for 'a':     volatile unsigned long a;
	2. use '-O0' compile option

>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]