https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95041
Bug ID: 95041 Summary: gdb does not prints variables inside an equivalence statement in a module Product: gcc Version: 9.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: debug Assignee: unassigned at gcc dot gnu.org Reporter: fmolina2b at gmail dot com Target Milestone: --- Created attachment 48499 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48499&action=edit Source files and temps I found impossible to watch variables declared in equivalence statements in a module. I could not find anything similar in bugzilla. Here follows an example from win 10 using gcc 9.20 from equation.com, the most recent version of gfortran that I could find (see below for linux) *************************************************************************** c:\test>copy con m.f90 program m use mod1 real*8 a k=3.0 a=f(5d0) print *,a,k,y(1) read(*,*) end program ^Z c:\test>copy con mod1.f90 module mod1 real*8 y(10) real*8 k equivalence (y(1),k) contains real*8 function f(x) real*8 x y(1)=1d0 f=x**2 return end function end module ^Z c:\test>gfortran -v Built by Equation Solution <http://www.Equation.com>. Using built-in specs. COLLECT_GCC=gfortran COLLECT_LTO_WRAPPER=c:/gcc/bin/../libexec/gcc/i686-pc-mingw32/9.2.0/lto-wrapper.exe Target: i686-pc-mingw32 Configured with: ../gcc-9.2.0-mingw/configure --host=i686-pc-mingw32 --build=x86_64-unknown-linux-gnu --target=i686-pc-mingw32 --prefix=/home/gfortran/gcc-home/binary/mingw32/native/x86_32/gcc/9.2.0 --with-gcc --with-gnu-as --with-gnu-ld --with-cloog=/home/gfortran/gcc-home/binary/mingw32/native/x86_32/cloog --with-gmp=/home/gfortran/gcc-home/binary/mingw32/native/x86_32/gmp --with-mpfr=/home/gfortran/gcc-home/binary/mingw32/native/x86_32/mpfr --with-mpc=/home/gfortran/gcc-home/binary/mingw32/native/x86_32/mpc --with-diagnostics-color=auto --enable-cloog-backend=isl --with-sysroot=/home/gfortran/gcc-home/binary/mingw32/cross/x86_32/gcc/9-20190310 --disable-shared --disable-nls --disable-tls --disable-libgcc2 --disable-win32-registry --enable-build-with-cxx --enable-libquadmath-support --enable-libquadmath --enable-languages=c,c++,fortran --disable-checking --enable-libgomp --enable-threads=win32 --enable-lto --enable-static --enable-shared=lto-plugin --enable-plugins --enable-ld=yes Thread model: win32 gcc version 9.2.0 (GCC) c:\test>gfortran mod1.f90 m.f90 -g -save-temps c:\test>a 25.000000000000000 1.0000000000000000 1.0000000000000000 c:\test>gdb a.exe This binary was built by Equation Solution <http://www.Equation.com>. GNU gdb (GDB) 7.12 Copyright (C) 2016 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 "i686-pc-mingw32". Type "show configuration" for configuration details. For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from a.exe...done. (gdb) b 7 Breakpoint 1 at 0x4015e1: file m.f90, line 7. (gdb) r Starting program: c:\test\a.exe [New Thread 9712.0x1318] warning: Can not parse XML library list; XML support was disabled at compile time 25.000000000000000 1.0000000000000000 1.0000000000000000 Breakpoint 1, m () at m.f90:7 7 read(*,*) (gdb) p k c:\test> ****************************************************************************** gdb crashes silently. The same happens trying to print y or y(1) Commenting out the equivalence statement in mod1.f90 gdb behaves correctly ****************************************************************************** [snip] Reading symbols from a.exe...done. (gdb) b 7 Breakpoint 1 at 0x4015e1: file m.f90, line 7. (gdb) r Starting program: c:\test\a.exe [New Thread 8444.0x30b4] warning: Can not parse XML library list; XML support was disabled at compile time 25.000000000000000 3.0000000000000000 1.0000000000000000 Breakpoint 1, m () at m.f90:7 7 read(*,*) (gdb) p k $1 = 3 (gdb) p y $2 = (1, 0, 0, 0, 0, 0, 0, 0, 0, 0) (gdb) ********************************************************************** However, gdb is rather old (7.16) Doing the same text with gcc 8.4.0 in Mageia Linux with gdb 8.2.8 I got: *********************************************************************** [fer@localhost test]$ gdb a.out GNU gdb (GDB) 8.2-8.mga7 (Mageia release 7) Copyright (C) 2018 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-mageia-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from a.out...done. (gdb) b 7 Breakpoint 1 at 0x401264: file m.f90, line 7. (gdb) r Starting program: /home/fer/test/a.out Missing separate debuginfos, use: debuginfo-install glibc-2.29-20.mga7.x86_64 25.000000000000000 1.0000000000000000 1.0000000000000000 Breakpoint 1, m () at m.f90:7 7 read(*,*) Missing separate debuginfos, use: debuginfo-install lib64zlib1-1.2.11-7.mga7.x86_64 libgcc1-8.4.0-1.mga7.x86_64 libgfortran5-8.4.0-1.mga7.x86_64 libquadmath0-8.4.0-1.mga7.x86_64 (gdb) p k No symbol "k" in current context. ************************************************************************ Variables in modules inside an equivalence statement are not seen by gdb I add an attachment with the files generated by gfortran 9.2.0