From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13567 invoked by alias); 8 Jan 2008 20:38:03 -0000 Received: (qmail 13434 invoked by uid 48); 8 Jan 2008 20:37:20 -0000 Date: Tue, 08 Jan 2008 21:23:00 -0000 Message-ID: <20080108203720.13433.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug rtl-optimization/34716] application segfaults when compiled with -O2, but works well with -O1 In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "aleksey dot shipilev at gmail dot com" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2008-01/txt/msg00790.txt.bz2 ------- Comment #6 from aleksey dot shipilev at gmail dot com 2008-01-08 20:37 ------- Here you go, Andrew. # gdb ./a.out GNU gdb 6.7.1 (gdb) set disassembly-flavor intel (gdb) run Starting program: ~/src/gcc-b/a.out before: output=bffa911c, buf=bffa8f1c after: output=bffa911c, buf=bffa8f1c sizeof(buf)=512 result=0 OK on reading from device Program received signal SIGSEGV, Segmentation fault. 0x08048571 in main () at test2.c:39 39 } (gdb) disassemble Dump of assembler code for function main: 0x08048480 : lea ecx,[esp+0x4] 0x08048484 : and esp,0xfffffff0 0x08048487 : push DWORD PTR [ecx-0x4] 0x0804848a : push ebp 0x0804848b : mov ebp,esp 0x0804848d : sub esp,0x238 0x08048493 : mov DWORD PTR [ebp-0xc],ebx 0x08048496 : xor ebx,ebx 0x08048498 : mov DWORD PTR [ebp-0x10],ecx 0x0804849b : mov DWORD PTR [ebp-0x8],esi 0x0804849e : mov DWORD PTR [ebp-0x4],edi 0x080484a1 : lea edi,[ebp-0x1c] 0x080484a4 : mov BYTE PTR [ebp-0x14],0xb0 0x080484a8 : mov BYTE PTR [ebp-0x13],0x1 0x080484ac : mov BYTE PTR [ebp-0x12],0xd1 0x080484b0 : mov BYTE PTR [ebp-0x11],0x1 0x080484b4 : mov DWORD PTR [esp+0x4],ebx 0x080484b8 : lea ebx,[ebp-0x21c] 0x080484be : mov DWORD PTR [esp],0x804867c 0x080484c5 : call 0x804836c 0x080484ca : mov DWORD PTR [ebp-0x224],eax 0x080484d0 : mov DWORD PTR [esp+0x8],ebx 0x080484d4 : mov DWORD PTR [esp+0x4],edi 0x080484d8 : mov DWORD PTR [esp],0x8048685 0x080484df : call 0x80483ac 0x080484e4 : mov ecx,0x31f 0x080484e9 : lea eax,[ebp-0x14] 0x080484ec : mov DWORD PTR [esp+0x4],ecx 0x080484f0 : mov DWORD PTR [esp+0xc],ebx 0x080484f4 : mov DWORD PTR [esp+0x8],eax 0x080484f8 : mov eax,DWORD PTR [ebp-0x224] 0x080484fe : mov DWORD PTR [esp],eax 0x08048501 : call 0x804839c 0x08048506 : mov DWORD PTR [esp+0x8],ebx 0x0804850a : mov DWORD PTR [esp+0x4],edi 0x0804850e : mov DWORD PTR [esp],0x80486a0 0x08048515 : mov esi,eax 0x08048517 : call 0x80483ac 0x0804851c : mov edx,0x200 0x08048521 : mov DWORD PTR [esp+0x4],edx 0x08048525 : mov DWORD PTR [esp],0x80486bb 0x0804852c : call 0x80483ac 0x08048531 : mov DWORD PTR [esp+0x4],esi 0x08048535 : mov DWORD PTR [esp],0x80486cb 0x0804853c : call 0x80483ac 0x08048541 : test esi,esi 0x08048543 : je 0x8048572 0x08048545 : mov eax,0x804867c 0x0804854a : mov DWORD PTR [esp+0x4],eax 0x0804854e : mov DWORD PTR [esp],0x80486f0 0x08048555 : call 0x80483ac 0x0804855a : mov eax,0x1 0x0804855f : mov ecx,DWORD PTR [ebp-0x10] 0x08048562 : mov ebx,DWORD PTR [ebp-0xc] 0x08048565 : mov esi,DWORD PTR [ebp-0x8] 0x08048568 : mov edi,DWORD PTR [ebp-0x4] 0x0804856b : mov esp,ebp 0x0804856d : pop ebp 0x0804856e : lea esp,[ecx-0x4] 0x08048571 : ret 0x08048572 : mov DWORD PTR [esp],0x80486d6 0x08048579 : call 0x80483cc 0x0804857e : mov eax,DWORD PTR [ebp-0x21c] 0x08048584 : mov DWORD PTR [ebp-0x1c],eax 0x08048587 : mov eax,DWORD PTR [ebp-0x218] 0x0804858d : mov DWORD PTR [ebp-0x18],eax 0x08048590 : mov eax,DWORD PTR [ebp-0x224] 0x08048596 : mov DWORD PTR [esp],eax 0x08048599 : call 0x80483bc 0x0804859e : xor eax,eax 0x080485a0 : jmp 0x804855f End of assembler dump. (gdb) bt #0 0x08048571 in main () at test2.c:39 (gdb) info registers eax 0x0 0 ecx 0x33010010 855703568 edx 0xbffa8f1c -1074098404 ebx 0x0 0 esp 0x3301000c 0x3301000c ebp 0x0 0x0 esi 0x0 0 edi 0x19030000 419627008 eip 0x8048571 0x8048571 eflags 0x210246 [ PF ZF IF RF ID ] cs 0x73 115 ss 0x7b 123 ds 0x7b 123 es 0x7b 123 fs 0x0 0 gs 0x33 51 (gdb) -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34716