This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug rtl-optimization/51447] [4.6/4.7 Regression] global register variable definition incorrectly removed as dead code


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

Jack Howarth <howarth at nitro dot med.uc.edu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |howarth at nitro dot
                   |                            |med.uc.edu

--- Comment #16 from Jack Howarth <howarth at nitro dot med.uc.edu> 2013-01-20 22:18:04 UTC ---
The test case gcc.c-torture/execute/pr51447.c fails its execution test at -m32
(but not -m64) on x86_64-apple-darwin12 in gcc trunk. Adding -fno-PIC to the
compile flags eliminates the execution failure at all optimization levels for
-m32 on x86_64-apple-darwin12.

# gdb ./pr51447.x0
GNU gdb 6.3.50-20050815 (Apple version gdb-1822) (Sun Aug  5 03:00:42 UTC 2012)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin"...Reading symbols for shared
libraries ... done

(gdb) b main
Breakpoint 1 at 0x1eed: file
/sw/src/fink.build/gcc48-4.8.0-1000/gcc-4.8-20130120/gcc/testsuite/gcc.c-torture/execute/pr51447.c,
line 13.
Breakpoint 2 at 0x1ec8: file
/sw/src/fink.build/gcc48-4.8.0-1000/gcc-4.8-20130120/gcc/testsuite/gcc.c-torture/execute/pr51447.c,
line 18.
warning: Multiple breakpoints were set.
Use the "delete" command to delete unwanted breakpoints.
(gdb) disp/i $pc
(gdb) r
Starting program:
/sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/gcc/testsuite/gcc/pr51447.x0 
warning: posix_spawn failed, trying execvp, error: 86
Reading symbols for shared libraries ++......................... done

Breakpoint 1, 0x00001eed in main () at
/sw/src/fink.build/gcc48-4.8.0-1000/gcc-4.8-20130120/gcc/testsuite/gcc.c-torture/execute/pr51447.c:13
13    {
1: x/i $pc  0x1eed <main+9>:    call   0x1f3e <__x86.get_pc_thunk.bx>
(gdb) si
0x00001f3e in __x86.get_pc_thunk.bx ()
1: x/i $pc  0x1f3e <__x86.get_pc_thunk.bx>:    mov    (%esp),%ebx
(gdb) 
0x00001f41 in __x86.get_pc_thunk.bx ()
1: x/i $pc  0x1f41 <__x86.get_pc_thunk.bx+3>:    ret    
(gdb) 
0x00001ef2 in main () at
/sw/src/fink.build/gcc48-4.8.0-1000/gcc-4.8-20130120/gcc/testsuite/gcc.c-torture/execute/pr51447.c:13
13    {
1: x/i $pc  0x1ef2 <main+14>:    lea    -0x18(%ebp),%eax
(gdb) 
0x00001ef5    13    {
1: x/i $pc  0x1ef5 <main+17>:    mov    %eax,-0x24(%ebp)
(gdb) 
0x00001ef8    13    {
1: x/i $pc  0x1ef8 <main+20>:    mov    %esp,-0x20(%ebp)
(gdb) 
21      bar (&&nonlocal_lab);
1: x/i $pc  0x1efb <main+23>:    lea    -0x24(%ebp),%eax
(gdb) 
0x00001efe    21      bar (&&nonlocal_lab);
1: x/i $pc  0x1efe <main+26>:    lea    0x26(%ebx),%edx
(gdb) 
0x00001f04    21      bar (&&nonlocal_lab);
1: x/i $pc  0x1f04 <main+32>:    mov    %edx,(%esp)
(gdb) 
0x00001f07    21      bar (&&nonlocal_lab);
1: x/i $pc  0x1f07 <main+35>:    mov    %eax,%ecx
(gdb) 
0x00001f09    21      bar (&&nonlocal_lab);
1: x/i $pc  0x1f09 <main+37>:    call   0x1ebd <bar>
(gdb) 
bar (func=0x1f18) at
/sw/src/fink.build/gcc48-4.8.0-1000/gcc-4.8-20130120/gcc/testsuite/gcc.c-torture/execute/pr51447.c:17
17          {
1: x/i $pc  0x1ebd <bar>:    push   %ebp
(gdb) 
0x00001ebe    17          {
1: x/i $pc  0x1ebe <bar+1>:    mov    %esp,%ebp
(gdb) 
0x00001ec0    17          {
1: x/i $pc  0x1ec0 <bar+3>:    push   %ebx
(gdb) 
0x00001ec1    17          {
1: x/i $pc  0x1ec1 <bar+4>:    call   0x1f3e <__x86.get_pc_thunk.bx>
(gdb) 
0x00001f3e in __x86.get_pc_thunk.bx ()
1: x/i $pc  0x1f3e <__x86.get_pc_thunk.bx>:    mov    (%esp),%ebx
(gdb) 
0x00001f41 in __x86.get_pc_thunk.bx ()
1: x/i $pc  0x1f41 <__x86.get_pc_thunk.bx+3>:    ret    
(gdb) 
0x00001ec6 in bar (func=0x1f18) at
/sw/src/fink.build/gcc48-4.8.0-1000/gcc-4.8-20130120/gcc/testsuite/gcc.c-torture/execute/pr51447.c:17
17          {
1: x/i $pc  0x1ec6 <bar+9>:    mov    %ecx,%edx
(gdb) 

Breakpoint 2, bar (func=0x1f18) at
/sw/src/fink.build/gcc48-4.8.0-1000/gcc-4.8-20130120/gcc/testsuite/gcc.c-torture/execute/pr51447.c:18
18        ptr = func;
1: x/i $pc  0x1ec8 <bar+11>:    lea    0x142(%ebx),%eax
(gdb) 
0x00001ece    18        ptr = func;
1: x/i $pc  0x1ece <bar+17>:    mov    (%eax),%eax
(gdb) 
0x00001ed0    18        ptr = func;
1: x/i $pc  0x1ed0 <bar+19>:    mov    0x8(%ebp),%ecx
(gdb) 
0x00001ed3    18        ptr = func;
1: x/i $pc  0x1ed3 <bar+22>:    mov    %ecx,(%eax)
(gdb) 
19        goto nonlocal_lab;
1: x/i $pc  0x1ed5 <bar+24>:    mov    %edx,%eax
(gdb) 
0x00001ed7    19        goto nonlocal_lab;
1: x/i $pc  0x1ed7 <bar+26>:    lea    0x4f(%ebx),%edx
(gdb) 
0x00001edd    19        goto nonlocal_lab;
1: x/i $pc  0x1edd <bar+32>:    mov    (%eax),%ebp
(gdb) 
0x00001edf in bar (func=0xbffff8e0) at
/sw/src/fink.build/gcc48-4.8.0-1000/gcc-4.8-20130120/gcc/testsuite/gcc.c-torture/execute/pr51447.c:19
19        goto nonlocal_lab;
1: x/i $pc  0x1edf <bar+34>:    mov    0x4(%eax),%esp
(gdb) 
0x00001ee2    19        goto nonlocal_lab;
1: x/i $pc  0x1ee2 <bar+37>:    jmp    *%edx
(gdb) 
0x00001f15 in main () at
/sw/src/fink.build/gcc48-4.8.0-1000/gcc-4.8-20130120/gcc/testsuite/gcc.c-torture/execute/pr51447.c:22
22      return 1;
1: x/i $pc  0x1f15 <main+49>:    lea    0x18(%ebp),%ebp
(gdb) 
main () at
/sw/src/fink.build/gcc48-4.8.0-1000/gcc-4.8-20130120/gcc/testsuite/gcc.c-torture/execute/pr51447.c:24
24      if (ptr != &&nonlocal_lab)
1: x/i $pc  0x1f18 <main+52>:    lea    0x116(%ebx),%eax
(gdb) 
0x00001f1e    24      if (ptr != &&nonlocal_lab)
1: x/i $pc  0x1f1e <main+58>:    mov    (%eax),%eax
(gdb) 
0x00001f20    24      if (ptr != &&nonlocal_lab)
1: x/i $pc  0x1f20 <main+60>:    mov    (%eax),%edx
(gdb) 

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0104c700
0x00001f20 in main () at
/sw/src/fink.build/gcc48-4.8.0-1000/gcc-4.8-20130120/gcc/testsuite/gcc.c-torture/execute/pr51447.c:24
24      if (ptr != &&nonlocal_lab)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]