This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: optimization/6673: gcc-3.1 produces wrong assembly code
- From: Nam SungHyun <namsh at wimo dot co dot kr>
- To: Richard Henderson <rth at redhat dot com>, rth at gcc dot gnu dot org, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, namsh at kldp dot org, nobody at gcc dot gnu dot org, gcc-gnats at gcc dot gnu dot org
- Date: Fri, 17 May 2002 14:24:42 +0900
- Subject: Re: optimization/6673: gcc-3.1 produces wrong assembly code
- References: <20020517021257.21373.qmail@sources.redhat.com> <20020517135324.A13580@wimo.co.kr> <20020516220200.A26434@redhat.com>
- Reply-to: Nam SungHyun <namsh at wimo dot co dot kr>
Richard Henderson wrote:
> On Fri, May 17, 2002 at 01:53:24PM +0900, Nam SungHyun wrote:
> > I saw the feed back message from the gnats web, but did not get a
> > mail. Did not know how I can reply for that feedback.
>
> The gnats bug form has an originator email address that
> it cc's all status changes on. Did you mistype it?
I typed namsh@kldp.org and it's valid. ???
> > the 'a' in my example source is a 'global variable'.
> > So, should the gcc treat it as a volatile by default?
>
> No.
>
> > There are so many multi-threaded program. I didn't see
> > any program which use volatile for the global variable.
>
> Nor does any C compiler produce "thread aware" code by default.
>
> You have to use cpu-specific thread synchronization primitives
> in order for that to work reliably. Such a primitive would as
> a side effect tell the compiler that data must be committed to
> memory, which would cause 'a' to be written.
>
> You did none of these.
You mean I should use '-fvolatile-global -fvolatile-static'?
Now I compiled the example source with:
ppc-eabi-gcc -O1 -fvolatile-global -fvolatile-static -S ex.c
The result is same. What's wrong?
Regards,
namsh
.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"