This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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]

[Bug fortran/24526] renamed variables from modules not visible in gdb


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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org

--- Comment #7 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-06-23 16:12:00 UTC ---
My impression is that this is a bug in GDB and not in GCC (cf. readelf output
below). For the following program, the result is: myvar is not found and gdb
prints the wrong variable of the two "var33": Namely, the renamed one from
"mod" and not the one of "mod2". Using "mod::var33" and "mod2::var33" works as
expected. 

14        print *, myvar
(gdb)
          33
15        print *, var33
(gdb)
         -42
16      end program test
(gdb) p var33
$1 = 33
(gdb) p myvar
No symbol "myvar" in current context. 



Test program:

module mod
  integer :: var11 = 11, var22 = 22, var33 = 33
end module mod

module mod2
  integer :: var33 = -42
end module mod2

program test
  use mod, myvar => var33
  use mod2 ! imports var33 == -42
  implicit none
  print *, var11  ! prints: 11
  print *, myvar  ! prints: 33
  print *, var33  ! prints: -42
end program test


Readelf looks as follows:

 [   12f]    subprogram
...
             sibling              (ref4) [   1a5]
 [   153]      imported_module
               decl_file            (data1) 1
               decl_line            (data1) 11
               import               (ref4) [   1a5]
 [   15a]      imported_module
               decl_file            (data1) 1
               decl_line            (data1) 10
               import               (ref4) [   1cb]
               sibling              (ref4) [   171]
 [   165]        imported_declaration
                 decl_file            (data1) 1
                 decl_line            (data1) 10
                 name                 (strp) "myvar"
                 import               (ref4) [   1d6]


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