public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Program terminated with SIGSEGV when trying to print an array element
@ 2005-06-07  8:14 Wu Zhou
  2005-06-07  9:03 ` Wu Zhou
  0 siblings, 1 reply; 6+ messages in thread
From: Wu Zhou @ 2005-06-07  8:14 UTC (permalink / raw)
  To: gdb

This is a fortran program.  It runs ok without GDB's control.  But it 
terminated with SIGSEGV when running under GDB.  This happened when I
am trying to print an array element in the sub-function.

The testcase is as follows:
============================
        dimension a(10)
        write(*,*)'This is a test.'
        call sub(a,10)
        write(*,*) a
        stop
        end

        subroutine sub(a,n)
        dimension a(n)
        do 100 i=1, 10
          a(i)=i
100     continue
        return
        end
        
The failing GDB session is as follows:
=======================================
# gdb -q ./array
Using host libthread_db library "/lib/libthread_db.so.1".
(gdb) b array.f:11
Breakpoint 1 at 0x8048783: file array.f, line 11.
(gdb) r
Starting program: /root/array 
 This is a test.

Breakpoint 1, sub_ (a=0xbf8b9b50, n=@0x804888c) at array.f:11
11                a(i)=i
Current language:  auto; currently fortran
(gdb) p a(1)

Program terminated with signal SIGSEGV, Segmentation fault.
The program no longer exists.
The program being debugged stopped while in a function called from GDB.
When the function (at 0xbf8b9b50) is done executing, GDB will silently
stop (instead of continuing to evaluate the expression containing
the function call).

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

end of thread, other threads:[~2005-06-09  2:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-07  8:14 Program terminated with SIGSEGV when trying to print an array element Wu Zhou
2005-06-07  9:03 ` Wu Zhou
2005-06-07 13:14   ` Daniel Jacobowitz
2005-06-08  6:57     ` Wu Zhou
2005-06-08 13:07       ` Daniel Jacobowitz
2005-06-09  2:47         ` Wu Zhou

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