Bug 19635 - gdb.fortran/library-module.exp false regression on GCC upgrade
Summary: gdb.fortran/library-module.exp false regression on GCC upgrade
Status: NEW
Alias: None
Product: gdb
Classification: Unclassified
Component: fortran (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-13 20:27 UTC by Jan Kratochvil
Modified: 2016-02-13 20:27 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Kratochvil 2016-02-13 20:27:52 UTC
gcc-4.9.2-6.fc21.x86_64 -> gcc-5.3.1-2.fc23.x86_64
-PASS: gdb.fortran/library-module.exp: print var_i in lib
+FAIL: gdb.fortran/library-module.exp: print var_i in lib
-PASS: gdb.fortran/library-module.exp: print var_i in main
+FAIL: gdb.fortran/library-module.exp: print var_i in main

But that is not a bug in gfortran, it is a bug in GDB.

It can be workarounded by:
	sed -i -e 's/GNU Fortran2008/GNU Fortran 008/' library-module-lib.so

It is due to gdb/dwarf2read.c:
                  /* Workaround gfortran PR debug/40040 - it uses
                     DW_AT_location for variables in -fPIC libraries which may
                     get overriden by other libraries/executable and get
                     a different address.  Resolve it by the minimal symbol
                     which may come from inferior's executable using copy
                     relocation.  Make this workaround only for gfortran as for
                     other compilers GDB cannot guess the minimal symbol
                     Fortran mangling kind.  */
                  if (cu->language == language_fortran && die->parent
                      && die->parent->tag == DW_TAG_module
                      && cu->producer
                      && startswith (cu->producer, "GNU Fortran "))
                                                    ^^^^^^^^^^^^
                    SYMBOL_ACLASS_INDEX (sym) = LOC_UNRESOLVED;

At least I think it is a bug in GDB but I do not have a fix.