public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "chihin.ko at oracle dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug debug/65821] New: [4.8.2 regression] incorrect debug line # info for main
Date: Mon, 20 Apr 2015 23:32:00 -0000	[thread overview]
Message-ID: <bug-65821-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 65821
           Summary: [4.8.2 regression] incorrect debug line # info for
                    main
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot gnu.org
          Reporter: chihin.ko at oracle dot com

this happen since 4.8.2, 4.9.0 also have same problem.

cat t.cc
==========================================================
  1 #include <stdio.h>
  2
  3 int b = 12;
  4
  5 inline void foo(const int &x = (b+3))
  6 {
  7     printf("%d\n", x);
  8 }   9
 10 inline void baz(const int &x = 200)
 11 {
 12     printf("%d\n", x);
 13 }
 14
 15 inline void bar(int &x = b)
 16 {  17     printf("%d\n", x);
 18     x = 100;
 19     printf("%d\n", x);
 20 }
 21
 22
 23 void
 24 bob(char *s = "hello")  25 {
 26     printf("%s\n", s);
 27 }  28
 29 int main()
 30 {
 31   foo();  32   baz();
 33   bar();
 34   bob();
 35   return 0;
 36 }
====================================================
The line table for main is incorrect:

< 1><0x0000067e>    DW_TAG_subprogram
                      DW_AT_external              yes(1)
                      DW_AT_name                  "main"
                      DW_AT_decl_file             0x00000001 t.cc
                      DW_AT_decl_line             0x0000001d
                      DW_AT_type                  <0x00000491>
                      DW_AT_low_pc                0x0040129f
                      DW_AT_high_pc               0x004012ff
.debug_line
---
....
0x0040129f  [  30, 0] NS
0x004012a7  [   5, 0] NS   <==== extra line info
0x004012b0  [  31, 0] NS
0x004012bf  [  32, 0] NS DI=0x1
0x004012d2  [  33, 0] NS
0x004012dc  [  34, 0] NS

This cause follwing problem:
(gdb) b main
Breakpoint 1 at 0x4006ea: file c++defargs3.cc, line 5.  <== should be line 31
(gdb) run
Starting program:
/workspace/chko/ws/dinstall/dbx_test/intel_S11_gcc482/c++defargs3.dbx,gcc/g47/a.out

Breakpoint 1, main () at c++defargs3.cc:5
5       inline void foo(const int &x = (b+3))


             reply	other threads:[~2015-04-20 23:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-20 23:32 chihin.ko at oracle dot com [this message]
2015-04-21  2:57 ` [Bug debug/65821] " pinskia at gcc dot gnu.org
2015-04-21  3:24 ` chihin.ko at oracle dot com
2015-04-21  7:44 ` [Bug debug/65821] [4.8/4.9/5/6 " rguenth at gcc dot gnu.org
2015-04-21 21:15 ` chihin.ko at oracle dot com
2015-04-21 21:18 ` chihin.ko at oracle dot com
2015-06-23  8:21 ` rguenth at gcc dot gnu.org
2015-06-26 19:58 ` [Bug debug/65821] [4.9/5/6 " jakub at gcc dot gnu.org
2015-06-26 20:28 ` jakub at gcc dot gnu.org
2015-06-30 10:23 ` rguenth at gcc dot gnu.org
2020-12-09 13:45 ` [Bug debug/65821] [7 " jason 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-65821-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).