public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "guojiufu at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug debug/101669] New: error reading variable from debug information when compiling with -O2
Date: Thu, 29 Jul 2021 06:28:42 +0000	[thread overview]
Message-ID: <bug-101669-4@http.gcc.gnu.org/bugzilla/> (raw)

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.

             reply	other threads:[~2021-07-29  6:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-29  6:28 guojiufu at gcc dot gnu.org [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-101669-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).