[Bug c/33374] GCC 4.1.2 produce wrong assembler code with -O2 option enabled.

2007-09-10 Thread _kirpichev_ at mail dot ru


--- Comment #1 from _kirpichev_ at mail dot ru  2007-09-10 07:45 ---
Created an attachment (id=14182)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14182action=view)
test programm

This example is compiled incorrectly by gcc 4.1.2 with -O2 flag.
But all works fine if we change line 93 in this example on next:
XML_Remove(currNode_sp);


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33374



[Bug c/33374] GCC 4.1.2 produce wrong assembler code with -O2 option enabled.

2007-09-10 Thread _kirpichev_ at mail dot ru


--- Comment #2 from _kirpichev_ at mail dot ru  2007-09-10 07:53 ---
Created an attachment (id=14183)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14183action=view)
Correct and incorrect assembler dumps.

From incorrect dump we can see where segmentation fault heppens:

0x0804839e testFunction+30:   movDWORD PTR [ecx+4],0x0
0x080483a5 testFunction+37:   movDWORD PTR [eax+4],edx
0x080483a8 testFunction+40:   movedx,DWORD PTR [ecx+4]
0x080483ab testFunction+43:   movecx,ebx
0x080483ad testFunction+45:   movDWORD PTR [edx],eax

Instruction 0x080483ad tries to dereferencing pointer in edx, but
in edx zero was put by 0x080483a8.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33374