public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "aleksey dot shipilev at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/34716] application segfaults when compiled with -O2, but works well with -O1
Date: Tue, 08 Jan 2008 21:23:00 -0000	[thread overview]
Message-ID: <20080108203720.13433.qmail@sourceware.org> (raw)
In-Reply-To: <bug-34716-15595@http.gcc.gnu.org/bugzilla/>



------- 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 <main+0>:    lea    ecx,[esp+0x4]
0x08048484 <main+4>:    and    esp,0xfffffff0
0x08048487 <main+7>:    push   DWORD PTR [ecx-0x4]
0x0804848a <main+10>:   push   ebp
0x0804848b <main+11>:   mov    ebp,esp
0x0804848d <main+13>:   sub    esp,0x238
0x08048493 <main+19>:   mov    DWORD PTR [ebp-0xc],ebx
0x08048496 <main+22>:   xor    ebx,ebx
0x08048498 <main+24>:   mov    DWORD PTR [ebp-0x10],ecx
0x0804849b <main+27>:   mov    DWORD PTR [ebp-0x8],esi
0x0804849e <main+30>:   mov    DWORD PTR [ebp-0x4],edi
0x080484a1 <main+33>:   lea    edi,[ebp-0x1c]
0x080484a4 <main+36>:   mov    BYTE PTR [ebp-0x14],0xb0
0x080484a8 <main+40>:   mov    BYTE PTR [ebp-0x13],0x1
0x080484ac <main+44>:   mov    BYTE PTR [ebp-0x12],0xd1
0x080484b0 <main+48>:   mov    BYTE PTR [ebp-0x11],0x1
0x080484b4 <main+52>:   mov    DWORD PTR [esp+0x4],ebx
0x080484b8 <main+56>:   lea    ebx,[ebp-0x21c]
0x080484be <main+62>:   mov    DWORD PTR [esp],0x804867c
0x080484c5 <main+69>:   call   0x804836c <open@plt>
0x080484ca <main+74>:   mov    DWORD PTR [ebp-0x224],eax
0x080484d0 <main+80>:   mov    DWORD PTR [esp+0x8],ebx
0x080484d4 <main+84>:   mov    DWORD PTR [esp+0x4],edi
0x080484d8 <main+88>:   mov    DWORD PTR [esp],0x8048685
0x080484df <main+95>:   call   0x80483ac <printf@plt>
0x080484e4 <main+100>:  mov    ecx,0x31f
0x080484e9 <main+105>:  lea    eax,[ebp-0x14]
0x080484ec <main+108>:  mov    DWORD PTR [esp+0x4],ecx
0x080484f0 <main+112>:  mov    DWORD PTR [esp+0xc],ebx
0x080484f4 <main+116>:  mov    DWORD PTR [esp+0x8],eax
0x080484f8 <main+120>:  mov    eax,DWORD PTR [ebp-0x224]
0x080484fe <main+126>:  mov    DWORD PTR [esp],eax
0x08048501 <main+129>:  call   0x804839c <ioctl@plt>
0x08048506 <main+134>:  mov    DWORD PTR [esp+0x8],ebx
0x0804850a <main+138>:  mov    DWORD PTR [esp+0x4],edi
0x0804850e <main+142>:  mov    DWORD PTR [esp],0x80486a0
0x08048515 <main+149>:  mov    esi,eax
0x08048517 <main+151>:  call   0x80483ac <printf@plt>
0x0804851c <main+156>:  mov    edx,0x200
0x08048521 <main+161>:  mov    DWORD PTR [esp+0x4],edx
0x08048525 <main+165>:  mov    DWORD PTR [esp],0x80486bb
0x0804852c <main+172>:  call   0x80483ac <printf@plt>
0x08048531 <main+177>:  mov    DWORD PTR [esp+0x4],esi
0x08048535 <main+181>:  mov    DWORD PTR [esp],0x80486cb
0x0804853c <main+188>:  call   0x80483ac <printf@plt>
0x08048541 <main+193>:  test   esi,esi
0x08048543 <main+195>:  je     0x8048572 <main+242>
0x08048545 <main+197>:  mov    eax,0x804867c
0x0804854a <main+202>:  mov    DWORD PTR [esp+0x4],eax
0x0804854e <main+206>:  mov    DWORD PTR [esp],0x80486f0
0x08048555 <main+213>:  call   0x80483ac <printf@plt>
0x0804855a <main+218>:  mov    eax,0x1
0x0804855f <main+223>:  mov    ecx,DWORD PTR [ebp-0x10]
0x08048562 <main+226>:  mov    ebx,DWORD PTR [ebp-0xc]
0x08048565 <main+229>:  mov    esi,DWORD PTR [ebp-0x8]
0x08048568 <main+232>:  mov    edi,DWORD PTR [ebp-0x4]
0x0804856b <main+235>:  mov    esp,ebp
0x0804856d <main+237>:  pop    ebp
0x0804856e <main+238>:  lea    esp,[ecx-0x4]
0x08048571 <main+241>:  ret
0x08048572 <main+242>:  mov    DWORD PTR [esp],0x80486d6
0x08048579 <main+249>:  call   0x80483cc <puts@plt>
0x0804857e <main+254>:  mov    eax,DWORD PTR [ebp-0x21c]
0x08048584 <main+260>:  mov    DWORD PTR [ebp-0x1c],eax
0x08048587 <main+263>:  mov    eax,DWORD PTR [ebp-0x218]
0x0804858d <main+269>:  mov    DWORD PTR [ebp-0x18],eax
0x08048590 <main+272>:  mov    eax,DWORD PTR [ebp-0x224]
0x08048596 <main+278>:  mov    DWORD PTR [esp],eax
0x08048599 <main+281>:  call   0x80483bc <close@plt>
0x0804859e <main+286>:  xor    eax,eax
0x080485a0 <main+288>:  jmp    0x804855f <main+223>
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 <main+241>
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


  parent reply	other threads:[~2008-01-08 20:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-08 19:29 [Bug rtl-optimization/34716] New: " aleksey dot shipilev at gmail dot com
2008-01-08 19:36 ` [Bug rtl-optimization/34716] " aleksey dot shipilev at gmail dot com
2008-01-08 19:58 ` pinskia at gcc dot gnu dot org
2008-01-08 20:07 ` aleksey dot shipilev at gmail dot com
2008-01-08 21:21 ` aleksey dot shipilev at gmail dot com
2008-01-08 21:22 ` pinskia at gcc dot gnu dot org
2008-01-08 21:23 ` aleksey dot shipilev at gmail dot com [this message]
     [not found] <bug-34716-4@http.gcc.gnu.org/bugzilla/>
2014-08-04 10:43 ` ktietz at gcc dot gnu.org
2014-08-04 10:44 ` ktietz at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080108203720.13433.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).