bearophile Wrote:

> > > ../../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 GCC there is a switch that disables strict aliasing optimization. I think 
> if you use it the compiler gets a bit slower, but you will also avoid bugs 
> caused by this optimization, and maybe the warnings too. Otherwise there are 
> other ways to solve it, maybe using an union to perform the pointer cast.

I'm sure that after so many years (30+) of professional experience with 
C/C++/D/Java compilers, Walter knows much much better than you or GCC when this 
optimization can be done in unsafe manner. It's an error in the compiler 
heuristics.

> > We don't use that function for anything at the moment. Though I think the 
> > idea may
> > have been to make GCC builtins known to the Frontend parser.
> 
> That's just an example. There are tens of other cases of unused variables 
> spread here and there.

They're not really unused. The GDC team probably made the mistakes.

> I have done some tests on the 32 bit gdc D2, compiled today on Ubuntu. Some 
> comments:
> 
> The compilation and the compiler works! This is great considering that it's a 
> card castle about 2 lighyears high that uses no glue.

Yes, it's amazing they managed to make it work. Worth a few beers.

> Using the latest LDC 1, the stripped binary of a little raytracer-like 
> program that mostly uses the C standard library is about 174_960 bytes, 
> similar code compiled with GDC2 is 458_052 bytes stripped, and over 2 MB 
> unstripped, this is not good.

This must be an error in your test. You see, D is very suitable for kernel 
development. The executable for the N queens problem or a raytracer is actually 
smaller than 2 kB. How otherwise you program a kernel for an embedded platform 
with 16 kB of ROM? "458_052 bytes stripped, and over 2 MB unstripped" is this 
loser talk Walter is talking about.

Reply via email to