GDC2 compilation warnings

Leandro Lucarella luca at llucax.com.ar
Wed Nov 24 11:07:29 PST 2010


bearophile, el 24 de noviembre a las 12:37 me escribiste:
> Leandro Lucarella:
> 
> > These are important issues. This can heavily break the code when
> > compiling with optimizations (-O2, -O3, -Os). Basically, you can't
> > access an object with a type using a pointer to an incompatible type
> 
> I agree.
> 
> 
> > (except through an union).
> 
> I am not sure the C standard says something about this. I think this
> is more like a convention for C compilers.

According to Wikipedia, C99 does[1], I don't think C++98 say anything
about it though, and DMD FE is written in C++, so strictly speaking,
I don't think is a *bug* in the FE per se, but I think is not a bad idea
to avoid dereferencing type-punned pointers to help GCC produce better
programs if possible :)

[1] http://en.wikipedia.org/wiki/Aliasing_%28computing%29#Conflicts_with_optimization

-- 
Leandro Lucarella (AKA luca)                     http://llucax.com.ar/
----------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------
O.K.
Just a little pinprick.
There'll be no more aaaaaaaaah!
But you may feel a little sick.


More information about the Digitalmars-d mailing list