public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Wu Zhou <woodzltc@cn.ibm.com>
To: gdb@sources.redhat.com
Subject: Program terminated with SIGSEGV when trying to print an array element
Date: Tue, 07 Jun 2005 08:14:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.63.0506071550050.28024@plinuxt18.cn.ibm.com> (raw)

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

             reply	other threads:[~2005-06-07  8:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-07  8:14 Wu Zhou [this message]
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

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=Pine.LNX.4.63.0506071550050.28024@plinuxt18.cn.ibm.com \
    --to=woodzltc@cn.ibm.com \
    --cc=gdb@sources.redhat.com \
    /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).