This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB 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]

fortran/2155: Segmentation fault with passed-length character arguments


>Number:         2155
>Category:       fortran
>Synopsis:       Segmentation fault with passed-length character arguments
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Aug 11 09:38:01 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     grb@tf.uni-kiel.de
>Release:        6.5 & 6.3
>Organization:
>Environment:

>Description:
The program 
      PROGRAM  gdbcrash
      call foo('foo')
      END

      SUBROUTINE foo(name)
      CHARACTER*(*)     name
      END

compiled with gfortran 4.0.2
causes gdb 6.5 & 6.3 to segfault like this:

(gdb) break foo_ 
Breakpoint 1 at 0x80484d5: file gdbcrash.F, line 5.
(gdb) run
Starting program: /home/grb/work/foo/gdbcrash 

Breakpoint 1, foo_ (name=@0x8048634, _name=3) at gdbcrash.F:5
Current language:  auto; currently fortran
(gdb) pt name
type = REF TO -> ( char (-1))
(gdb) x/s 0x8048634
0x8048634 <_IO_stdin_used+4>:	 'foo\000'
(gdb) p name

Debugger segmentation fault

With ifort 9.1 (Intel) I got:

(gdb) break foo_ 
Breakpoint 1 at 0x8049462: file gdbcrash.F, line 5.
(gdb) run
Starting program: /home/grb/work/foo/gdbcrash 

Breakpoint 1, 0x08049462 in foo (name=Cannot access memory at address 0x808a168
) at gdbcrash.F:5
warning: Source file is more recent than executable.
Current language:  auto; currently fortran
(gdb) pt name
type = character*136937736
(gdb) p  name
Cannot access memory at address 0x808a168
(gdb) x/s 0x808a168
0x808a168 <STRLITPACK_0>:	 'foo\000'

(gdb) 

likewise if compiled with pgi 6.1 

I works if compiled with g77:
(gdb) break foo_ 
Breakpoint 1 at 0x8048719: file gdbcrash.F, line 7.
(gdb) run
Starting program: /home/grb/work/foo/gdbcrash 

Breakpoint 1, foo_ (name=0x8048924, __g77_length_name=3) at gdbcrash.F:7
Current language:  auto; currently fortran
(gdb) pt name
type = PTR TO -> ( char (1))
(gdb) p name
$1 = (PTR TO -> ( char (1))) 0x8048924
(gdb) 


>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/x-fortran; name="gdbcrash.F"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="gdbcrash.F"

ICAgICAgUFJPR1JBTSAgZ2RiY3Jhc2gKICAgICAgY2FsbCBmb28oJ2ZvbycpCiAgICAgIEVORAoK
ICAgICAgU1VCUk9VVElORSBmb28obmFtZSkKICAgICAgQ0hBUkFDVEVSKigqKSAgICAgbmFtZQog
ICAgICBFTkQK


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