Michael Murphy wrote:
> 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.
I tried this test case with a couple ia64 GCC's (2.96-ish and 3.1-ish)
and
-fvolatile had no effect. I was using -O2 in all my tests.
Then I tried it on MIPS. GCC 2.95 (from freeware.sgi.com) worked right
(-fvolatile made both stores appear). But GCC 2.97 which I built myself
had the bug. So this appears to have bitrotted; see http://gcc.gnu.org/
for reporting bugs.
> Once gcc supports this, passing -fvolatile to the
> sgicc front end may still not do anything, depending on how gcc
> implements this. It might require back-end work.
Hmm, not sure. I suspect the front-end might require work too
(haven't looked too closely).
|