Dear GCC folks,

I think I found a code generation bug in GCC 4.0.1.

I'm sending this mail to make sure this bug is known and
is or will be removed in newer versions.
On a quick glance I couldn't find it in the bug database,
so it may not be known.


***


I am developing a simulation program that appears to show a
bug when compiled with gcc 4.0.1 (cross-compiler on Linux
for MINGW target) but compiles fine with GCC 3 or GCC 4.1.2
(native on Linux) as well as with gcc 3 mingw on Cygwin/Windows.

For the 4.0.1 cross-compiled program, the bug disappears
when the function is duplicated under another name, and
the duplicate is called instead in the critical place.
The original (buggy) function is not inlined, but the
duplicate is inlined because it's only called in one
place.

The function is an AVL tree deletion which operates
with pointers only.

I attach the C source code and the assembler code (output of
objdump -d) to this mail. I have marked the two places in C
where I think the bug appears with a comment containing "BUG".
I'm not good enough in assembler to verify the bug there.

What seems to happen is that the value of ta, which should be
set to the address of the parent node's left-child pointer in
this case, remains unchanged, i.e. remains pointing to 'dummy'.
Then, in the subsequent assignment *ta = r the pointer does
not get changed appropriately.

Before filing this as a bug, I'd like some person who can
read assembler to examine the situation.
I'll gladly assist with further information.

***


The code is compiled with this command:

i386-pc-mingw32-gcc -DHAVE_CONFIG_H -I. -I../../bugsklsim/src -I..    
-std=gnu9x -W -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes 
-Wbad-function-cast -Wcast-qual -Wcast-align -Wmissing-declarations 
-Wnested-externs -Winline -Waggregate-return -Wshadow -g -O2 -MT sklsim.o -MD 
-MP -MF ".deps/sklsim.Tpo" -c -o sklsim.o ../../bugsklsim/src/sklsim.c



Best regards,

Claus Fischer

-- 
Claus Fischer <[EMAIL PROTECTED]>
http://www.clausfischer.com/

Reply via email to