public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/101669] New: error reading variable from debug information when compiling with -O2
@ 2021-07-29  6:28 guojiufu at gcc dot gnu.org
  2021-07-29  7:01 ` [Bug debug/101669] " rguenth at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: guojiufu at gcc dot gnu.org @ 2021-07-29  6:28 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101669
           Summary: error reading variable from debug information when
                    compiling with -O2
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot gnu.org
          Reporter: guojiufu at gcc dot gnu.org
  Target Milestone: ---

For below case:
----------gdb.f90
  integer :: a(10), b(12)
  call sub (a, 10)
  call sub (b, 12)
  write (*,*) a, b
end

subroutine sub (a, n)
  integer :: a(n), n
  integer(kind=8) nl, i
  nl = n

  do i = 1, nl
    a(i) = i
  end do
  write (*,*) a                                                  
end subroutine
------------
At -O2, using command "gfortran -O2 -g ~/temp/gdb.f90 -o arg1.exe" to compile,
when debugger it with gdb, there is log:
a=<error reading variable: dwarf2_find_location_expression: Corrupted DWARF
expression.>

$ gdb arg1.exe
...
(gdb) b sub
Breakpoint 1 at 0x400710: file /home/guojiufu/temp/gdb.f90, line 7.
(gdb) r
Starting program: /home/guojiufu/gcc/build/gcc-mainline-base/arg1.exe 

Breakpoint 1, sub (a=<error reading variable: dwarf2_find_location_expression:
Corrupted DWARF expression.>, 
    n=10) at /home/guojiufu/temp/gdb.f90:7
7       subroutine sub (a, n)

This msg does not occur when compiling with -O3 -g.

This issue can be reproduced on x86/ppc64le with the latest trunk, and also
occur in gcc11.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-07-30  3:04 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-29  6:28 [Bug debug/101669] New: error reading variable from debug information when compiling with -O2 guojiufu at gcc dot gnu.org
2021-07-29  7:01 ` [Bug debug/101669] " rguenth at gcc dot gnu.org
2021-07-29  8:46 ` guojiufu at gcc dot gnu.org
2021-07-29 10:09 ` jakub at gcc dot gnu.org
2021-07-29 16:25 ` pinskia at gcc dot gnu.org
2021-07-30  2:21 ` guojiufu at gcc dot gnu.org
2021-07-30  2:34 ` pinskia at gcc dot gnu.org
2021-07-30  2:58 ` pinskia at gcc dot gnu.org
2021-07-30  3:04 ` guojiufu at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).