-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi Wouter, On 04/25/2011 12:03 PM, Wouter Vermaelen wrote: > I believe I found a wrong-code bug. The problem triggers when using > gcc-4.5.1, 4.5.2 or 4.5.3, but not when using 4.4.5 or 4.7.0 (snapshot > 20110419). It also only triggers with certain optimization levels/flags. > I wonder if this is a known problem and already fixed in 4.7.0, or that > the problem still exists but for some reason doesn't trigger in 4.7.0 > (I couldn't easily find something in bugzilla). > > Below is a reduced test-case that shows the problem. I tried, but I > couldn't get it smaller than these 4 files (combined about 60 lines). > > While reducing this problem I realized that it *might* not be a compiler > bug, but undefined behaviour with the usage of __restrict in > Buffer::read(). What I wanted to express there is that the memory write > done by memcpy() can never overwrite the member variable 'p'. At the > moment I still believe it's a compiler bug, but I'm not 100% sure > anymore. > > So is this a compiler bug or undefined behaviour in my program? In case > of the latter I would appreciate if someone could explain what the Maybe this this is the same one? http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47365 I take 4.5.x to be broken because of this, and try to avoid it. As per bugzilla, the bug should not be in 4.6 and later versions. I wonder how many applications are affected: many new Linux distros come with 4.5.x as the default compiler and I guess many of their executables (kernel, X, etc.) have been compiled with it. The headache this can cause is quite large, but bug-free complex software is nearly non-existent :( Bests, Mate - -- Mate Soos Security Research Labs http://www.srlabs.de -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk21UScACgkQsTOOstKb0jmwiACggJWVaBcH0MWEdZoQCyktJVPi PFwAnR7ORgzWePU1dnRgF2HRQLpjz3Nr =J3Ny -----END PGP SIGNATURE-----