pro64-support
[Top] [All Lists]

RE: sgicc and -fvolatile

To: Sterling Augustine <Sterling@xxxxxxxxxxxxx>, Michael Murphy <mpm@xxxxxxxxxxxxxxxxx>
Subject: RE: sgicc and -fvolatile
From: "Chan, Sun C" <sun.c.chan@xxxxxxxxx>
Date: Tue, 17 Apr 2001 15:42:52 -0700
Cc: pro64-support@xxxxxxxxxxx
Sender: owner-pro64-support@xxxxxxxxxxx
This feature seemed like a hack to me. Looks like to do it
correctly, gcc needs to make all foo_p and all that its
possible aliased pointers volatile (I bet there's a bug 
lurking in the version you claim this feature works.)
In the presence of separate compilation, and someone must 
have the same flag for all .o's compiled, and no way to check
against the lack of it in some .o's. 
For a highly optimized compiler, this approach is just too
conservative. Why not use the volatile key word? 
Compilers, written by non-optimizing people usually ends up
implementing something that is just plain crude, this is 
indeed sad.

Sun


> -----Original Message-----
> From: Sterling Augustine [mailto:Sterling@xxxxxxxxxxxxx]
> Sent: Tuesday, April 17, 2001 8:18 AM
> To: Michael Murphy
> Cc: pro64-support@xxxxxxxxxxx
> Subject: Re: sgicc and -fvolatile
> 
> 
> It is supposed to force all memory accesses through pointers to be
> treated as volatile.
> 
> Here is a simple testcase:
> 
> int foo;
> 
> int main()
> {
>   int * foo_p = &foo;
> 
>   * foo_p = 1;
>   * foo_p = 2;
> }
> 
> if you compile the above with egcs 2.95.2 at -O3, the first 
> indirection
> off foo_p is optimized away. But if you compile the above at -03 and
> -fvolatile, then it remains.
> 
> sgicc -O3 -v -Wf,-fvolatile -S
> 
> will force -fvolatile to be passed to the front end, but (as 
> unfamiliar
> as I am with IA64 assembly), it still looks to me like the 
> first line is
> optimized away. So -fvolatile doesn't appear to work, and should
> probably result in an unsupported warning.
> 
> Sterling
> 
> 
> 
> 
> 
> 
> Michael Murphy wrote:
> > 
> >         From: Sterling Augustine <Sterling@xxxxxxxxxxxxx>
> > 
> >         Although sgicc accepts -fvolatile, it does not pass 
> it to the front or
> >         back ends (diffing the verbose output with and 
> without the option
> >         reveals no differences.) Is there a reason for 
> that? Do the front ends
> >         actually support -fvolatile, but there is a bug in 
> the driver, or should
> >         the driver be warning about an option that has no 
> effect? (Or does
> >         anyone actually know what should be happening?)
> > 
> > The driver does not pass it to the phases.
> > It could pass it to the front end, but that doesn't seem
> > to have any effect.  Actually, even gcc seems to ignore -fvolatile
> > and -fvolatile-global when I try them, but maybe I'm using it wrong?
> > -- Mike Murphy
> > -- mpm@xxxxxxx
> > -- quote of the day:
> > --  "A man's pride will bring him low, but the humble in spirit
> > --   will retain honor."  (Proverbs 29:23)
> 


<Prev in Thread] Current Thread [Next in Thread>