This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [g++] -O produces incorrect code


Am Sonntag 07 Oktober 2007 schrieb Martin Schröder:

> We have tracked it down to one source file; if it is compiled with -O,
> we get the above error and valgrind screams:

We already had several occurences of such a problem and each time it was a 
fault in our code and not in gcc.

Generally one cannot help without the code. Where to get it? But one hint:

Use #include <valgrind/memcheck.h> and check each value in the line with

VALGRIND_CHECK_VALUE_IS_DEFINED(variable)

Do this with each subexpression and follow the stack up to the declaration of 
the offending variable. 

One particularly nasty problem was once a bitfield with only 31 defined bits 
but all bits were used in a comparison. Only in compiled code 32. bit was 
left uninitialized.

Greetings
Christoph


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]