This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: [g++] -O produces incorrect code
- From: Christoph Bartoschek <bartoschek at gmx dot de>
- To: gcc-help at gcc dot gnu dot org
- Cc: "Martin Schröder" <martin at oneiros dot de>
- Date: Sun, 7 Oct 2007 21:54:37 +0200
- Subject: Re: [g++] -O produces incorrect code
- References: <68c491a60710070936s959354dlda887cc4e1dec87e@mail.gmail.com>
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