public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: namsh@kldp.org
To: gcc-gnats@gcc.gnu.org
Subject: optimization/6673: gcc-3.1 produces wrong assembly code
Date: Thu, 16 May 2002 03:46:00 -0000	[thread overview]
Message-ID: <200205161038.g4GActa05739@namsh.wimo.co.kr> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1892 bytes --]


>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:


             reply	other threads:[~2002-05-16 10:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-16  3:46 namsh [this message]
2002-05-16  6:40 jakub
2002-05-16 19:12 rth
2002-05-16 21:56 Nam SungHyun
2002-05-16 22:06 Richard Henderson
2002-05-16 22:26 Nam SungHyun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200205161038.g4GActa05739@namsh.wimo.co.kr \
    --to=namsh@kldp.org \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).