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 debug/15399] New: static link causes segfault under gdb when call is used


The following program exhibits the "segfault" under gcc3.2.2 and gdb 5.3post-0.

I would appreciate it very much if you could test at the current version
of gcc.

Compile the program as (statically link with libc.a):

        gcc -static -g -o test test.c

Run test under gdb and put a break point at printf().  When you do 
        
        gdb> call arrayPrint(array,5)

you get  

Program received signal SIGSEGV, Segmentation fault.
0x0804827c in __libc_start_main ()
The program being debugged was signaled while in a function called from GDB.
GDB remains in the frame where the signal was received.

This problem did not occur under gcc2.96.   

Workaround: link with libc.so (this problem won't occur).

---------------- simple program test.c ------------------
#include <stdio.h>
#include <stdlib.h>
    
void arrayPrint(const int *array, int size)
{
  int i;
  printf("\n");
  for (i=0; i < size; ++i)
    printf("%d ", array[i]);
  printf("\n");
}
    
int main(int argc, char *argv[])
{
  int array[5];
  int i;
    
  for (i=0; i < 5; ++i)
    array[i] = i;
    
  arrayPrint(array, 5);
  printf("put break point here\n");
  return 0;
}

-- 
           Summary: static link causes segfault under gdb when call is used
           Product: gcc
           Version: 3.2.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: debug
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tosa at nmr dot mgh dot harvard dot edu
                CC: gcc-bugs at gcc dot gnu dot org


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


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