* [Bug debug/40012] Bad debug info for local variables
2009-05-03 22:04 [Bug debug/40012] New: Bad debug info for local variables gcc at magfr dot user dot lysator dot liu dot se
@ 2009-05-03 22:06 ` gcc at magfr dot user dot lysator dot liu dot se
2009-05-05 17:09 ` [Bug debug/40012] [4.5 Regression] " pinskia at gcc dot gnu dot org
` (13 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: gcc at magfr dot user dot lysator dot liu dot se @ 2009-05-03 22:06 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from gcc at magfr dot user dot lysator dot liu dot se 2009-05-03 22:05 -------
Created an attachment (id=17794)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17794&action=view)
Test case demonstrating the problem.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40012
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug debug/40012] [4.5 Regression] Bad debug info for local variables
2009-05-03 22:04 [Bug debug/40012] New: Bad debug info for local variables gcc at magfr dot user dot lysator dot liu dot se
2009-05-03 22:06 ` [Bug debug/40012] " gcc at magfr dot user dot lysator dot liu dot se
@ 2009-05-05 17:09 ` pinskia at gcc dot gnu dot org
2009-05-28 14:52 ` rguenth at gcc dot gnu dot org
` (12 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-05-05 17:09 UTC (permalink / raw)
To: gcc-bugs
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-debug
Summary|Bad debug info for local |[4.5 Regression] Bad debug
|variables |info for local variables
Target Milestone|--- |4.5.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40012
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug debug/40012] [4.5 Regression] Bad debug info for local variables
2009-05-03 22:04 [Bug debug/40012] New: Bad debug info for local variables gcc at magfr dot user dot lysator dot liu dot se
2009-05-03 22:06 ` [Bug debug/40012] " gcc at magfr dot user dot lysator dot liu dot se
2009-05-05 17:09 ` [Bug debug/40012] [4.5 Regression] " pinskia at gcc dot gnu dot org
@ 2009-05-28 14:52 ` rguenth at gcc dot gnu dot org
2009-05-29 3:22 ` [Bug debug/40012] [4.5 Regression] Revision 146817 generated bad " hjl dot tools at gmail dot com
` (11 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-05-28 14:52 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from rguenth at gcc dot gnu dot org 2009-05-28 14:52 -------
Confirmed.
(gdb) start
Temporary breakpoint 2, main () at dlmod.i:24
24 list a3 = { 0 };
(gdb) p &a3
$4 = (list *) 0xffffd05c
(gdb) n
25 f0(0, 0, 0, &a3);
(gdb) s
f0 (a=0x0, b=0x0, c=0x0, d=0xffffd05c) at dlmod.i:15
15 for(problem = d; problem; problem = problem->next) {
(gdb) n
16 int variable = 0;
(gdb) p problem
$5 = (list *) 0x0
(gdb) n
17 f1(c, problem);
(gdb) s
f1 (a=0x0, b=0xffffd05c) at dlmod.i:29
29 void f1(void*a, list*b) { }
(gdb) p b
$6 = (list *) 0xffffd05c
(gdb) up
#1 0x0804840b in f0 (a=0x0, b=0x0, c=0x0, d=0xffffd05c) at dlmod.i:17
17 f1(c, problem);
(gdb) p problem
$7 = (list *) 0x0
works with 4.4.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Known to fail| |4.5.0
Known to work| |4.4.0
Priority|P3 |P1
Last reconfirmed|0000-00-00 00:00:00 |2009-05-28 14:52:09
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40012
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug debug/40012] [4.5 Regression] Revision 146817 generated bad debug info for local variables
2009-05-03 22:04 [Bug debug/40012] New: Bad debug info for local variables gcc at magfr dot user dot lysator dot liu dot se
` (2 preceding siblings ...)
2009-05-28 14:52 ` rguenth at gcc dot gnu dot org
@ 2009-05-29 3:22 ` hjl dot tools at gmail dot com
2009-06-01 21:49 ` dje at gcc dot gnu dot org
` (10 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: hjl dot tools at gmail dot com @ 2009-05-29 3:22 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from hjl dot tools at gmail dot com 2009-05-29 03:22 -------
Revision 146817:
http://gcc.gnu.org/ml/gcc-cvs/2009-04/msg01459.html
is the cause.
--
hjl dot tools at gmail dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |hjl dot tools at gmail dot
| |com, matz at suse dot de
Summary|[4.5 Regression] Bad debug |[4.5 Regression] Revision
|info for local variables |146817 generated bad debug
| |info for local variables
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40012
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug debug/40012] [4.5 Regression] Revision 146817 generated bad debug info for local variables
2009-05-03 22:04 [Bug debug/40012] New: Bad debug info for local variables gcc at magfr dot user dot lysator dot liu dot se
` (3 preceding siblings ...)
2009-05-29 3:22 ` [Bug debug/40012] [4.5 Regression] Revision 146817 generated bad " hjl dot tools at gmail dot com
@ 2009-06-01 21:49 ` dje at gcc dot gnu dot org
2009-06-02 12:51 ` dje at gcc dot gnu dot org
` (9 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: dje at gcc dot gnu dot org @ 2009-06-01 21:49 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from dje at gcc dot gnu dot org 2009-06-01 21:49 -------
Local variable debugging is broken for AIX stabs as well.
On AIX, the DECL and the insn contain different offsets from virtual-stack-vars
for the same variable:
(mem/c/i:SI (plus:SI (reg/f:SI 115 virtual-stack-vars)
(const_int 8 [0x8])) [0 a+0 S4 A128])
versus
(insn 11 10 12 3 ad.c:11 (set (reg:SI 123)
(mem/c/i:SI (reg/f:SI 115 virtual-stack-vars) [0 a+0 S4 A32])) -1
(nil))
--
dje at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dje at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40012
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug debug/40012] [4.5 Regression] Revision 146817 generated bad debug info for local variables
2009-05-03 22:04 [Bug debug/40012] New: Bad debug info for local variables gcc at magfr dot user dot lysator dot liu dot se
` (4 preceding siblings ...)
2009-06-01 21:49 ` dje at gcc dot gnu dot org
@ 2009-06-02 12:51 ` dje at gcc dot gnu dot org
2009-06-02 23:02 ` ppluzhnikov at google dot com
` (8 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: dje at gcc dot gnu dot org @ 2009-06-02 12:51 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from dje at gcc dot gnu dot org 2009-06-02 12:51 -------
cfgexpand.c:expand_used_vars() expands and instantiates virtual-stack-vars for
INSNs when it walks the partion map:
for (i = 0; i < SA.map->num_partitions; i++)
{
tree var = partition_to_var (SA.map, i);
gcc_assert (is_gimple_reg (var));
if (TREE_CODE (SSA_NAME_VAR (var)) == VAR_DECL)
expand_one_var (var, true, true);
It then instantiates the same virtual-stack-vars in debug DECLs when it calls
expand_used_vars_for_block (outer_block, true), which calls
/* Expand all variables at this level. */
for (t = BLOCK_VARS (block); t ; t = TREE_CHAIN (t))
if (TREE_USED (t))
expand_one_var (t, toplevel, true);
The INSN var is an SSA_NAME and expand_one_stack_var_at() uses the alignment in
the DECL; the BLOCK var is not an SSA_NAME and the alignment is computed as the
STACK_BOUNDARY.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40012
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug debug/40012] [4.5 Regression] Revision 146817 generated bad debug info for local variables
2009-05-03 22:04 [Bug debug/40012] New: Bad debug info for local variables gcc at magfr dot user dot lysator dot liu dot se
` (5 preceding siblings ...)
2009-06-02 12:51 ` dje at gcc dot gnu dot org
@ 2009-06-02 23:02 ` ppluzhnikov at google dot com
2009-06-03 9:51 ` matz at gcc dot gnu dot org
` (7 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: ppluzhnikov at google dot com @ 2009-06-02 23:02 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from ppluzhnikov at google dot com 2009-06-02 23:02 -------
Also a problem on x86_64-linux:
http://gcc.gnu.org/ml/gcc-patches/2009-06/msg00190.html
--
ppluzhnikov at google dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ppluzhnikov at google dot
| |com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40012
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug debug/40012] [4.5 Regression] Revision 146817 generated bad debug info for local variables
2009-05-03 22:04 [Bug debug/40012] New: Bad debug info for local variables gcc at magfr dot user dot lysator dot liu dot se
` (6 preceding siblings ...)
2009-06-02 23:02 ` ppluzhnikov at google dot com
@ 2009-06-03 9:51 ` matz at gcc dot gnu dot org
2009-06-03 13:17 ` ramana at gcc dot gnu dot org
` (6 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: matz at gcc dot gnu dot org @ 2009-06-03 9:51 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from matz at gcc dot gnu dot org 2009-06-03 09:51 -------
I'm looking at this now.
--
matz at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |matz at gcc dot gnu dot org
|dot org |
Status|NEW |ASSIGNED
Last reconfirmed|2009-05-28 14:52:09 |2009-06-03 09:51:23
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40012
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug debug/40012] [4.5 Regression] Revision 146817 generated bad debug info for local variables
2009-05-03 22:04 [Bug debug/40012] New: Bad debug info for local variables gcc at magfr dot user dot lysator dot liu dot se
` (7 preceding siblings ...)
2009-06-03 9:51 ` matz at gcc dot gnu dot org
@ 2009-06-03 13:17 ` ramana at gcc dot gnu dot org
2009-06-03 15:57 ` matz at gcc dot gnu dot org
` (5 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: ramana at gcc dot gnu dot org @ 2009-06-03 13:17 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from ramana at gcc dot gnu dot org 2009-06-03 13:17 -------
Also broken on arm-eabi cross. Using gdb and the exact steps as in Comment #0
shows me problem as 0x100.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40012
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug debug/40012] [4.5 Regression] Revision 146817 generated bad debug info for local variables
2009-05-03 22:04 [Bug debug/40012] New: Bad debug info for local variables gcc at magfr dot user dot lysator dot liu dot se
` (8 preceding siblings ...)
2009-06-03 13:17 ` ramana at gcc dot gnu dot org
@ 2009-06-03 15:57 ` matz at gcc dot gnu dot org
2009-06-08 11:37 ` matz at gcc dot gnu dot org
` (4 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: matz at gcc dot gnu dot org @ 2009-06-03 15:57 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from matz at gcc dot gnu dot org 2009-06-03 15:57 -------
Bah, simply not expanding those variables (whose SSA partitions were already)
by clearing TREE_USED on them fixes the problem, but makes those variables
have no debug info at all, as the DECLs then have no DECL_RTL_SET anymore.
Which indeed we can't easily use in case one base variable got split into
several SSA partitions: we have several places but only one DECL. This is
no problem in -g -O0 mode, so I can hack around this.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40012
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug debug/40012] [4.5 Regression] Revision 146817 generated bad debug info for local variables
2009-05-03 22:04 [Bug debug/40012] New: Bad debug info for local variables gcc at magfr dot user dot lysator dot liu dot se
` (9 preceding siblings ...)
2009-06-03 15:57 ` matz at gcc dot gnu dot org
@ 2009-06-08 11:37 ` matz at gcc dot gnu dot org
2009-06-08 11:38 ` matz at gcc dot gnu dot org
` (3 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: matz at gcc dot gnu dot org @ 2009-06-08 11:37 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from matz at gcc dot gnu dot org 2009-06-08 11:37 -------
Subject: Bug 40012
Author: matz
Date: Mon Jun 8 11:37:12 2009
New Revision: 148273
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=148273
Log:
PR debug/40012
* cfgexpand.c (set_rtl): Store place also in DECL_RTL, if all
partitions use the same.
(expand_one_var): Deal with DECL_RTL sometimes begin set also
for basevars of SSA_NAMEs.
(expand_used_vars): Reset TREE_USED for basevars of SSA_NAMEs,
to not expand them twice.
(gimple_expand_cfg): Clear DECL_RTL for those decls that have
multiple places.
Modified:
trunk/gcc/ChangeLog
trunk/gcc/cfgexpand.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40012
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug debug/40012] [4.5 Regression] Revision 146817 generated bad debug info for local variables
2009-05-03 22:04 [Bug debug/40012] New: Bad debug info for local variables gcc at magfr dot user dot lysator dot liu dot se
` (10 preceding siblings ...)
2009-06-08 11:37 ` matz at gcc dot gnu dot org
@ 2009-06-08 11:38 ` matz at gcc dot gnu dot org
2009-06-27 0:49 ` ppluzhnikov at google dot com
` (2 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: matz at gcc dot gnu dot org @ 2009-06-08 11:38 UTC (permalink / raw)
To: gcc-bugs
------- Comment #11 from matz at gcc dot gnu dot org 2009-06-08 11:38 -------
Fixed.
--
matz at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40012
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug debug/40012] [4.5 Regression] Revision 146817 generated bad debug info for local variables
2009-05-03 22:04 [Bug debug/40012] New: Bad debug info for local variables gcc at magfr dot user dot lysator dot liu dot se
` (11 preceding siblings ...)
2009-06-08 11:38 ` matz at gcc dot gnu dot org
@ 2009-06-27 0:49 ` ppluzhnikov at google dot com
2009-06-27 20:18 ` ebotcazou at gcc dot gnu dot org
2009-06-29 20:11 ` ppluzhnikov at google dot com
14 siblings, 0 replies; 16+ messages in thread
From: ppluzhnikov at google dot com @ 2009-06-27 0:49 UTC (permalink / raw)
To: gcc-bugs
------- Comment #12 from ppluzhnikov at google dot com 2009-06-27 00:49 -------
This appears to still be broken in 32-bit mode.
I just built GCC @148996 on x86_64, and compiled the attached test case with
'-m32':
(gdb) start
Breakpoint 1 at 0x80483d9: file gcc-pr40012-test.c, line 24.
main () at gcc-pr40012-test.c:24
24 list a3 = { 0 };
(gdb) n
25 f0(0, 0, 0, &a3);
(gdb) p &a3
$1 = (list *) 0xffffccb4
(gdb) s
f0 (a=0x0, b=0x0, c=0x0, d=0xffffcc8c) at gcc-pr40012-test.c:15
15 for(problem = d; problem; problem = problem->next) {
Clearly GDB and GCC are in disagreement about the location of a3.
Disassebly shows:
0x080483d0 <main+0>: push %ebp
0x080483d1 <main+1>: mov %esp,%ebp
0x080483d3 <main+3>: and $0xfffffff0,%esp
0x080483d6 <main+6>: sub $0x20,%esp
0x080483d9 <main+9>: movl $0x0,0x1c(%esp)
0x080483e1 <main+17>: lea 0x1c(%esp),%eax
0x080483e5 <main+21>: mov %eax,0xc(%esp)
0x080483e9 <main+25>: movl $0x0,0x8(%esp)
0x080483f1 <main+33>: movl $0x0,0x4(%esp)
0x080483f9 <main+41>: movl $0x0,(%esp)
0x08048400 <main+48>: call 0x8048394 <f0>
0x08048405 <main+53>: mov $0x0,%eax
0x0804840a <main+58>: leave
0x0804840b <main+59>: ret
readelf -w:
<1><1ee>: Abbrev Number: 12 (DW_TAG_subprogram)
<1ef> DW_AT_external : 1
<1f0> DW_AT_name : (indirect string, offset: 0xf5): main
<1f4> DW_AT_decl_file : 1
<1f5> DW_AT_decl_line : 22
<1f6> DW_AT_type : <0x1df>
<1fa> DW_AT_low_pc : 0x80483d0
<1fe> DW_AT_high_pc : 0x804840c
<202> DW_AT_frame_base : 0x38 (location list)
<206> DW_AT_sibling : <0x218>
<2><20a>: Abbrev Number: 13 (DW_TAG_variable)
<20b> DW_AT_name : a3
<20e> DW_AT_decl_file : 1
<20f> DW_AT_decl_line : 24
<210> DW_AT_type : <0x161>
<214> DW_AT_location : 2 byte block: 91 14 (DW_OP_fbreg: 20)
And
00000038 080483d0 080483d1 (DW_OP_breg4: 4)
00000038 080483d1 080483d3 (DW_OP_breg4: 8)
00000038 080483d3 0804840b (DW_OP_breg5: 8)
00000038 0804840b 0804840c (DW_OP_breg4: 4)
00000038 <End of list>
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40012
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug debug/40012] [4.5 Regression] Revision 146817 generated bad debug info for local variables
2009-05-03 22:04 [Bug debug/40012] New: Bad debug info for local variables gcc at magfr dot user dot lysator dot liu dot se
` (12 preceding siblings ...)
2009-06-27 0:49 ` ppluzhnikov at google dot com
@ 2009-06-27 20:18 ` ebotcazou at gcc dot gnu dot org
2009-06-29 20:11 ` ppluzhnikov at google dot com
14 siblings, 0 replies; 16+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2009-06-27 20:18 UTC (permalink / raw)
To: gcc-bugs
------- Comment #13 from ebotcazou at gcc dot gnu dot org 2009-06-27 20:18 -------
> This appears to still be broken in 32-bit mode.
Yes, I've seen similar problems with 4.4.0 and 4.5.0 on x86. Probably the
stack realignment stuff. I'd suggest opening a new PR.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40012
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug debug/40012] [4.5 Regression] Revision 146817 generated bad debug info for local variables
2009-05-03 22:04 [Bug debug/40012] New: Bad debug info for local variables gcc at magfr dot user dot lysator dot liu dot se
` (13 preceding siblings ...)
2009-06-27 20:18 ` ebotcazou at gcc dot gnu dot org
@ 2009-06-29 20:11 ` ppluzhnikov at google dot com
14 siblings, 0 replies; 16+ messages in thread
From: ppluzhnikov at google dot com @ 2009-06-29 20:11 UTC (permalink / raw)
To: gcc-bugs
------- Comment #14 from ppluzhnikov at google dot com 2009-06-29 20:11 -------
I verified that @146817 is not causing the current 32-bit breakage; I'll open a
separate PR.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40012
^ permalink raw reply [flat|nested] 16+ messages in thread