[Bug debug/101669] error reading variable from debug information when compiling with -O2

guojiufu at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Jul 30 02:21:47 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101669

--- Comment #5 from Jiu Fu Guo <guojiufu at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #4)
> What version of gdb are you using?

Tried gdb8.1/8.3/9.2 on ppc64le.
In gdb, the msg "error reading variable: dwarf2_find_location_expression:"
occurs when stopping at the breakpoint 'sub' on the tip message:
------------
Breakpoint 1, 0x0000000100000a58 in sub (a=<error reading variable:
dwarf2_find_location_expression: Corrupted DWARF expression.>, n=10) at
/home/guojiufu/temp/gdb.f90:7
------------

readelf --debug-dump arg1.exe |grep readelf
readelf: Error: Invalid location list entry type 8
readelf: Warning: Hole and overlap detection requires adjacent view lists and
loclists.

--------
readelf -v
GNU readelf (GNU Binutils for Ubuntu) 2.34
readelf 2.30 can also get the Error/Warning msg.


gfortran -O2 -g ~/temp/gdb.f90 -gdwarf-5 -o arg1.exe

On x86 is similar, readelf2.30/gdb8.1 can reproduce the msg at my side.

Before gcc11, need -gdwarf-5 to reproduce since we default to this dwarf
version in gcc11.


More information about the Gcc-bugs mailing list