public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/61014] New: [4.6/4.7/4.8/4.9 Regression] gdb can't find symbol of derived data type array in nested subroutine
@ 2014-04-30 11:54 sven.buijssen at math dot uni-dortmund.de
  2014-04-30 12:20 ` [Bug debug/61014] [4.7/4.8/4.9/4.10 " rguenth at gcc dot gnu.org
                   ` (17 more replies)
  0 siblings, 18 replies; 19+ messages in thread
From: sven.buijssen at math dot uni-dortmund.de @ 2014-04-30 11:54 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 61014
           Summary: [4.6/4.7/4.8/4.9 Regression] gdb can't find symbol of
                    derived data type array in nested subroutine
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sven.buijssen at math dot uni-dortmund.de

(I am not exactly sure whether gfortran or gdb are to blame for this issue, but
I tend towards the former.)

The following causes gdb 7.4 to report missing symbols in current context when
compiled with recent gfortran versions:

$ cat <<EOF > debug.f90
program debug
  use module
  implicit none
  type(myint), dimension(1) :: bar
  call foo(bar)
end program debug
EOF
$ cat <<EOF > module.f90
module module
  implicit none
  type myint
    integer :: i = -1
  end type myint

contains
  subroutine foo(bar)
    type(myint), dimension(:) :: bar
    call subfoo()

  contains
    subroutine subfoo()
      bar(1)%i = 1
      print *, bar(1)%i
    end subroutine subfoo
  end subroutine foo
end module module
EOF
$ gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/local/gcc/4.9.0/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-4.9.0/configure --prefix=/usr/local/gcc/4.9.0
--enable-languages=c,c++,fortran --disable-multilib
Thread model: posix
gcc version 4.9.0 (GCC)
$ gfortran -O0 -g -fno-inline -Wall -Wextra -c module.f90
$ gfortran -O0 -g -fno-inline -Wall -Wextra -fno-lto debug.f90 module.o
$ gdb --version
GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.launchpad.net/gdb-linaro/>.
$ gdb a.out
(gdb) break module.f90:10
Breakpoint 1 at 0x4007a0: file module.f90, line 10.
(gdb) break module.f90:14
Breakpoint 2 at 0x400703: file module.f90, line 14.
(gdb) run
Starting program: /tmp/a.out 

Breakpoint 1, 0x00000000004007a0 in __module_MOD_foo ()
(gdb) print bar(1)%i
No symbol "bar" in current context.
(gdb) cont
Continuing.

Breakpoint 2, 0x0000000000400703 in subfoo.2335 ()
(gdb) print bar(1)%i
No symbol "bar" in current context.

#

Dito with GCC 4.8.2.

#

With GCC 4.6.3 and 4.7.3 the respective results of the two print commands in
gdb are:
$1 = -1
value has been optimized out

#

Whereas with GCC 4.4.7 and GCC 4.5.4 the very same version of gdb is able to
show the (expected) value of component i of the first entry of array "bar" at
both breakpoints:
$1 = -1
$2 = -1

$ gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/local/gcc/4.5.4/libexec/gcc/x86_64-unknown-linux-gnu/4.5.4/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --prefix=/usr/local/gcc/4.5.4
--enable-languages=c,c++,fortran --disable-multilib
Thread model: posix
gcc version 4.5.4 (GCC) 

###

With Intel Fortran 14.0.1.106 (aka XE 2013 SP1 Update 1) and its accompanying
debugger one can query the value always:

$ ifort -O0 -g -Warn all -c module.f90
$ ifort -O0 -g -Warn all -c debug.f90
$ ifort -O0 -g -Warn all debug.o module.o
$ idbc a.out
Intel(R) Debugger for applications running on Intel(R) 64, Version 13.0, Build
[80.483.23]
------------------ 
object file name: a.out 
Reading symbols from /tmp/a.out...done.
(idb) break module.f90:10
Breakpoint 1 at 0x402ca5: file /tmp/module.f90, line 10.
(idb) break module.f90:14
Breakpoint 2 at 0x402ce8: file /tmp/module.f90, line 14.
(idb) run
Starting program: /tmp/a.out
[New Thread 23410 (LWP 23410)]

Breakpoint 1, MODULE::foo (bar=(...)) at /tmp/module.f90:10
10          call subfoo()
(idb) print bar(1)%i
$1 = -1
(idb) cont
Continuing.

Breakpoint 2, subfoo () at /tmp/module.f90:14
14            bar(1)%i = 1
(idb) print bar(1)%i
$2 = -1
(idb) next
15            print *, bar(1)%i
(idb) print bar(1)%i
$3 = 1


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

end of thread, other threads:[~2023-07-07 10:30 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-30 11:54 [Bug fortran/61014] New: [4.6/4.7/4.8/4.9 Regression] gdb can't find symbol of derived data type array in nested subroutine sven.buijssen at math dot uni-dortmund.de
2014-04-30 12:20 ` [Bug debug/61014] [4.7/4.8/4.9/4.10 " rguenth at gcc dot gnu.org
2014-04-30 12:20 ` rguenth at gcc dot gnu.org
2014-04-30 13:17 ` burnus at gcc dot gnu.org
2014-04-30 13:24 ` burnus at gcc dot gnu.org
2014-04-30 13:44 ` sven.buijssen at math dot uni-dortmund.de
2014-05-02 19:26 ` burnus at gcc dot gnu.org
2014-05-07 17:38 ` tromey at gcc dot gnu.org
2014-06-12 13:49 ` rguenth at gcc dot gnu.org
2014-12-01 12:00 ` [Bug debug/61014] [4.8/4.9/5 " rguenth at gcc dot gnu.org
2014-12-19 13:44 ` jakub at gcc dot gnu.org
2015-06-23  8:28 ` [Bug debug/61014] [4.8/4.9/5/6 " rguenth at gcc dot gnu.org
2015-06-26 20:19 ` [Bug debug/61014] [4.9/5/6 " jakub at gcc dot gnu.org
2015-06-26 20:39 ` jakub at gcc dot gnu.org
2021-05-14  9:47 ` [Bug debug/61014] [9/10/11/12 " jakub at gcc dot gnu.org
2021-06-01  8:06 ` rguenth at gcc dot gnu.org
2022-05-27  9:35 ` [Bug debug/61014] [10/11/12/13 " rguenth at gcc dot gnu.org
2022-06-28 10:30 ` jakub at gcc dot gnu.org
2023-07-07 10:30 ` [Bug debug/61014] [11/12/13/14 " rguenth at gcc dot gnu.org

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