Bug 1815504 - Regression in the line information debug information generated by gcc
Summary: Regression in the line information debug information generated by gcc
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Developer Toolset
Classification: Red Hat
Component: gcc
Version: DTS 9.0 RHEL 7
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: alpha
: 9.1
Assignee: Marek Polacek
QA Contact: Alexandra Petlanová Hájková
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-03-20 13:00 UTC by Carlos Santos
Modified: 2021-06-03 11:18 UTC (History)
10 users (show)

Fixed In Version: devtoolset-10-gcc-10.2.1-10.1.el7
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-06-03 11:18:41 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
GNU Compiler Collection 94311 0 P3 NEW LTO produces line info entries with invalid line numbers 2021-02-12 16:57:47 UTC

Description Carlos Santos 2020-03-20 13:00:10 UTC
Description of problem:

The regression was detected when compiling and running valgrind, as valgrind
reads its own debug information, and reports strange values found in the debug
info.

Valgrind reports then that line numbers > 1048575 are found in its own debug
info, when compiled with lto and gcc 9.

Version-Release number of selected component (if applicable):

devtoolset-9-gcc-9.1.1-2.6.el7.x86_64

How reproducible:

Always

Steps to Reproduce:

1. Dowload the valgrind code

   $ wget https://sourceware.org/pub/valgrind/valgrind-3.15.0.tar.bz2

2. Extract the source code

   $ tar -xf valgrind-3.15.0.tar.bz2

3. Configure and build

   $ source scl_source enable devtoolset-9
   $ { ./autogen.sh; \
   ./configure --prefix=`pwd`/install --enable-only64bit --enable-lto; \
   make -j2 install; \
   } >& build.log

Actual results:

   $ ./install/bin/valgrind -q date
   ==14497== warning: Can't handle line info entry with line number 177277754 greater than 1048575
   ==14497== (Nb: this message is only shown once)
   ==14497== warning: Can't handle inlined call info entry with line number 177277750 greater than 1048575 
   ==14497== (Nb: this message is only shown once)
   Fri Mar 20 09:53:41 -03 2020
Expected results:

   $ valgrind -q date
   Fri Mar 20 09:55:17 -03 2020

Additional info:

#### Double check that valgrind debug info reader is correct:
gdb ./.in_place/memcheck-amd64-linux
Reading symbols from ./.in_place/memcheck-amd64-linux...
(gdb) info line guest_amd64_toIR.c:177277754
Line number 177277754 is out of range for "priv/guest_amd64_toIR.c".
Line 177277754 of "priv/guest_amd64_toIR.c" starts at address 0x58069001 <dis_ESC_0F__SSE4+17> and ends at 0x58069005 <dis_ESC_0F__SSE4+21>.
(gdb)
You can also try:
(gdb) disass /s dis_ESC_0F__SSE4
and it shows lots of useless lines.

You can ask valgrind to show more info about what it is doing/reading by doing

./install/bin/valgrind -v -v -v -v -d -d -d -d --debug-dump=line  date |& tee d.out

Comment 2 Marek Polacek 2020-03-20 15:25:53 UTC
You mention this is a regression, what version of GCC handled this right, GCC 8 from DTS 8?

Comment 3 Carlos Santos 2020-03-20 16:54:00 UTC
(In reply to Marek Polacek from comment #2)
> You mention this is a regression, what version of GCC handled this right,
> GCC 8 from DTS 8?

Right, it's a regression regarding devtoolset-8-gcc-8.3.1-3.1.el7.x86_64.

Comment 4 Marek Polacek 2020-03-20 17:39:46 UTC
Reproduced with devtoolset-9-gcc-9.3.1-1.el7.x86_64.  I'll try mainline gcc now.

Comment 5 Marek Polacek 2020-03-20 18:55:49 UTC
Also happens with gcc-10.0.1-0.9.fc32.x86_64 so I think this will require an upstream PR.

Comment 6 Marek Polacek 2020-03-24 19:58:14 UTC
Upstream PR opened.  Hopefully someone who understands LTO more than I will take a look at it before long.

Comment 13 Marek Polacek 2020-10-19 15:33:47 UTC
Fixed upstream.

Comment 25 errata-xmlrpc 2021-06-03 11:18:41 UTC
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 (devtoolset-10-gcc bug fix update), 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://access.redhat.com/errata/RHBA-2021:2219


Note You need to log in before you can comment on or make changes to this bug.