GDC2 compilation warnings

Leandro Lucarella luca at llucax.com.ar
Wed Nov 24 06:23:06 PST 2010


Leandro Lucarella, el 24 de noviembre a las 10:46 me escribiste:
> Iain Buclaw, el 24 de noviembre a las 01:29 me escribiste:
> > == Quote from bearophile (bearophileHUGS at lycos.com)'s article
> > > While compiling GDC2 today I have seen hundreds of warnings, usually one of 5 types:
> > 
> > I'm rather thankful that you didn't try compiling a month or two ago then. :~)
> > I've cut down the amount of warnings emitted by a *lot*, and I can't even begin to
> > stress that fact.
> > 
> > > ../../gcc/d/d-gcc-real.h: In member function ?const real_value& real_t::rv() const?:
> > > ../../gcc/d/d-gcc-real.h:54: warning: dereferencing type-punned pointer will
> > break strict-aliasing rules
> > 
> > If you have a great idea to fix this warning, please send a patch.
> [...]
> > > In file included from ../../gcc/d/dmd2/root.h:29,
> > >                  from ../../gcc/d/dmd2/total.h:24,
> > >                  from ../../gcc/d/d-cppmngl.cc:25:
> > > ../../gcc/d/dmd2/dchar.h:155: warning: unused parameter ?pstart?
> > > Comments:
> > > - Unused variable warning: this is useful to avoid bugs;
> > > - Type-punned pointer warning: so far I have never received an answer to my
> > questions about this possible problem in D.
> 
> 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
> (except through an union). If is too hard to fix, use
> -fno-strict-aliasing when compiling with -O2, -O3 or -Os to inhibit that
> optimization.

I forgot the useful link:
http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#index-fstrict_002daliasing-818

:)

-- 
Leandro Lucarella (AKA luca)                     http://llucax.com.ar/
----------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------
En la calle me crucé con un señor muy correcto, que habitualmente anda en
Falcon; iba corriendo con dos valijas en la mano y dijo: "Voy para Miami,
tiene algún mensaje o ..." y le dije: "No, no, no..."
	-- Extra Tato (1983, Triunfo de Alfonsín)


More information about the Digitalmars-d mailing list