Hide Forgot
This bug reappeared when compiled with a toolset gcc. Additionally, the toolset gcc toolset does not like the empty (if you supply something then it compiles) -Wl options in the original testcase: $ scl enable devtoolset-1.0 'sh ./mk.sh' gcc: error: unrecognized command line option ‘-Wl’ gcc: error: unrecognized command line option ‘-Wl’ gcc: error: unrecognized command line option ‘-Wl’ But when you remove them, you get the gdb behavior described in the bug. Both system (RHEL5+6) and Toolset gdb shows '$1 = 0' in the output.
1) the rejection of bogus options passed to gcc driver when linking is documented: http://gcc.gnu.org/gcc-4.7/porting_to.html 2) I don't see how this testcase is related to PR39563, that PR was about block scope extern decls, there are none in the testcase 3) gcc generates the same debug info (and comparable code) in all versions I've tried (4.1/4.4/4.7/4.8), so if this worked, it would be a gdb change. Try /usr/bin/gdb instead of gdb ?
GDB does not support properly copy-relocations and conflicting names. This is: common/.bss variables from shared libraries not displayed correctly http://sourceware.org/bugzilla/show_bug.cgi?id=11717 The possibilities how to fix it were discussed at: gfortran invalid DW_AT_location for overridable variables http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40040 You may get random result depending on which order GDB expands symtabs etc. This is DTS-unrelated, it is a general GDB Bug/FEAT to fix.
(In reply to comment #3) > 2) I don't see how this testcase is related to PR39563, that PR was about block > scope extern decls, there are none in the testcase I admit I just used the testcase, saw the reported behavior and reported it for DTS. Sorry. > > 3) gcc generates the same debug info (and comparable code) in all versions I've > tried (4.1/4.4/4.7/4.8), so if this worked, it would be a gdb change. Try > /usr/bin/gdb instead of gdb ? That is weird, because the factor is actually whether I use Toolset gcc or not. If I compile with Toolset gcc, I get '$1 = 0' with both system and Toolset gdb If I compile with system gcc, I get '$1 = 42' with both system and Toolset gdb (In reply to comment #4) > GDB does not support properly copy-relocations and conflicting names. > > This is: > common/.bss variables from shared libraries not displayed correctly > http://sourceware.org/bugzilla/show_bug.cgi?id=11717 > > The possibilities how to fix it were discussed at: > gfortran invalid DW_AT_location for overridable variables > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40040 > > You may get random result depending on which order GDB expands symtabs etc. > > This is DTS-unrelated, it is a general GDB Bug/FEAT to fix. Not sure if this is true - it seems to me that RHEL5/RHEL6 gdb/gcc (or whatever is the cause) is better than the Toolset one.
Proposed patch for testing the issue (upstream): https://sourceware.org/ml/gdb-patches/2014-09/msg00136.html
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHBA-2015-0404.html