public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/34716] application segfaults when compiled with -O2, but works well with -O1
       [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
  1 sibling, 0 replies; 8+ messages in thread
From: ktietz at gcc dot gnu.org @ 2014-08-04 10:43 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=34716

Kai Tietz <ktietz at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2014-08-04
                 CC|                            |ktietz at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #7 from Kai Tietz <ktietz at gcc dot gnu.org> ---
As 5.1 is now already for some time no more in maintenance it would be
interesting to learn if that problem is still there for more current version
(4.9, 4.8) gcc.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug rtl-optimization/34716] application segfaults when compiled with -O2, but works well with -O1
       [not found] <bug-34716-4@http.gcc.gnu.org/bugzilla/>
  2014-08-04 10:43 ` [Bug rtl-optimization/34716] application segfaults when compiled with -O2, but works well with -O1 ktietz at gcc dot gnu.org
@ 2014-08-04 10:44 ` ktietz at gcc dot gnu.org
  1 sibling, 0 replies; 8+ messages in thread
From: ktietz at gcc dot gnu.org @ 2014-08-04 10:44 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=34716

--- Comment #8 from Kai Tietz <ktietz at gcc dot gnu.org> ---
(In reply to Kai Tietz from comment #7)
> As 5.1 is now already for some time no more in maintenance it would be
> interesting to learn if that problem is still there for more current version
> (4.9, 4.8) gcc.

Of course I mean 4.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug rtl-optimization/34716] application segfaults when compiled with -O2, but works well with -O1
  2008-01-08 19:29 [Bug rtl-optimization/34716] New: " aleksey dot shipilev at gmail dot com
                   ` (4 preceding siblings ...)
  2008-01-08 21:22 ` pinskia at gcc dot gnu dot org
@ 2008-01-08 21:23 ` aleksey dot shipilev at gmail dot com
  5 siblings, 0 replies; 8+ messages in thread
From: aleksey dot shipilev at gmail dot com @ 2008-01-08 21:23 UTC (permalink / raw)
  To: gcc-bugs



------- 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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug rtl-optimization/34716] application segfaults when compiled with -O2, but works well with -O1
  2008-01-08 19:29 [Bug rtl-optimization/34716] New: " aleksey dot shipilev at gmail dot com
                   ` (3 preceding siblings ...)
  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
  5 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-01-08 21:22 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pinskia at gcc dot gnu dot org  2008-01-08 20:24 -------
Can you run your program under gdb and then give the backtrace?
Are you sure that the ioctl does not keep around the buffer so when you return
from main, the buffer becomes invalid?


-- 


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug rtl-optimization/34716] application segfaults when compiled with -O2, but works well with -O1
  2008-01-08 19:29 [Bug rtl-optimization/34716] New: " aleksey dot shipilev at gmail dot com
                   ` (2 preceding siblings ...)
  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
  5 siblings, 0 replies; 8+ messages in thread
From: aleksey dot shipilev at gmail dot com @ 2008-01-08 21:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from aleksey dot shipilev at gmail dot com  2008-01-08 20:06 -------
Created an attachment (id=14905)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14905&action=view)
Updated test

One should get the read from device working. If the test prints "FAILED" that
mean issue might be not reproduced later in the code.


-- 

aleksey dot shipilev at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #14901|0                           |1
        is obsolete|                            |


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug rtl-optimization/34716] application segfaults when compiled with -O2, but works well with -O1
  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
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: aleksey dot shipilev at gmail dot com @ 2008-01-08 20:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from aleksey dot shipilev at gmail dot com  2008-01-08 19:47 -------
Sorry, Andrew, but result=-1 shows that ioctl failed to read enough data from
the device (maybe your device does not support SMART?). I tried to get rid of
any of such hardware-specific code, but can't eliminate that ioctl(). Sorry
again.

I still think that this is GCC bug, since compiler generates correct code in
mode A and fails to do that in mode B. It's weird again that A + (B-A) != B, so
it looks like general problem.


-- 


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug rtl-optimization/34716] application segfaults when compiled with -O2, but works well with -O1
  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
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-01-08 19:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2008-01-08 19:35 -------
I always get:
before: output=bfda12b4, buf=bfda10b4
after:  output=bfda12b4, buf=bfda10b4
sizeof(buf)=512
result=-1


I really don't think this is a GCC bug.  


-- 


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug rtl-optimization/34716] application segfaults when compiled with -O2, but works well with -O1
  2008-01-08 19:29 [Bug rtl-optimization/34716] New: " aleksey dot shipilev at gmail dot com
@ 2008-01-08 19:36 ` aleksey dot shipilev at gmail dot com
  2008-01-08 19:58 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: aleksey dot shipilev at gmail dot com @ 2008-01-08 19:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from aleksey dot shipilev at gmail dot com  2008-01-08 19:07 -------
Created an attachment (id=14901)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14901&action=view)
test used in issue

This test was derived from powertweak code, which segfaults.


-- 


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-08-04 10:44 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-34716-4@http.gcc.gnu.org/bugzilla/>
2014-08-04 10:43 ` [Bug rtl-optimization/34716] application segfaults when compiled with -O2, but works well with -O1 ktietz at gcc dot gnu.org
2014-08-04 10:44 ` ktietz at gcc dot gnu.org
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 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).