From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13700 invoked by alias); 7 Jun 2005 08:14:55 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 13680 invoked by uid 22791); 7 Jun 2005 08:14:51 -0000 Received: from ausmtp01.au.ibm.com (HELO ausmtp01.au.ibm.com) (202.81.18.186) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Tue, 07 Jun 2005 08:14:51 +0000 Received: from sd0208e0.au.ibm.com (d23rh904.au.ibm.com [202.81.18.202]) by ausmtp01.au.ibm.com (8.12.10/8.12.10) with ESMTP id j578E3Lk029004 for ; Tue, 7 Jun 2005 18:17:00 +1000 Received: from d23av02.au.ibm.com (d23av02.au.ibm.com [9.190.250.243]) by sd0208e0.au.ibm.com (8.12.10/NCO/VER6.6) with ESMTP id j5780DQw120834 for ; Tue, 7 Jun 2005 18:00:13 +1000 Received: from d23av02.au.ibm.com (loopback [127.0.0.1]) by d23av02.au.ibm.com (8.12.11/8.13.3) with ESMTP id j577vJFX014256 for ; Tue, 7 Jun 2005 17:57:20 +1000 Received: from plinuxt18.cn.ibm.com (plinuxt18.cn.ibm.com [9.181.140.28]) by d23av02.au.ibm.com (8.12.11/8.12.11) with ESMTP id j577vHmt014202 for ; Tue, 7 Jun 2005 17:57:19 +1000 Date: Tue, 07 Jun 2005 08:14:00 -0000 From: Wu Zhou To: gdb@sources.redhat.com Subject: Program terminated with SIGSEGV when trying to print an array element Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-SW-Source: 2005-06/txt/msg00056.txt.bz2 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).