Re: reference to volatile becomes itself volatile

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Kalle Olavi Niemitalo <kon@xxxxxx> writes:

> Compiling the following with Debian g++ 4.4.5-8 on x86_64, using
> -m64 -fno-exceptions -O2 -S:
>
> static volatile char &ref_to_volatile =
>   *reinterpret_cast<char *>(10000000000);
> char
> increment_at_ref_to_volatile()
> {
>   return ++ref_to_volatile;
> }
>
> generates code that first reads the reference from memory and
> then accesses the volatile char thrice.

I see that too with 4.4.  However, it appears to be fixed in 4.5.

Ian


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux