This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug gdb/18281] New: Miscomputes or does not handle dwarf expression
- From: "rguenth at gcc dot gnu.org" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Mon, 20 Apr 2015 09:55:32 +0000
- Subject: [Bug gdb/18281] New: Miscomputes or does not handle dwarf expression
- Auto-submitted: auto-generated
https://sourceware.org/bugzilla/show_bug.cgi?id=18281
Bug ID: 18281
Summary: Miscomputes or does not handle dwarf expression
Product: gdb
Version: 7.9
Status: NEW
Severity: normal
Priority: P2
Component: gdb
Assignee: unassigned at sourceware dot org
Reporter: rguenth at gcc dot gnu.org
For
int main (int argc, char **argv)
{
char a[argc + 1];
a[0] = 0;
return a[0];
}
gcc with -O -g on x86_64 generates just
00000000004004fd <main>:
4004fd: b8 00 00 00 00 mov $0x0,%eax
400502: c3 retq
but
<2><1c3>: Abbrev Number: 4 (DW_TAG_variable)
<1c4> DW_AT_name : a
<1c6> DW_AT_decl_file : 1
<1c7> DW_AT_decl_line : 3
<1c8> DW_AT_type : <0x1e7>
...
<1><1e7>: Abbrev Number: 8 (DW_TAG_array_type)
<1e8> DW_AT_type : <0x1e0>
<1ec> DW_AT_sibling : <0x201>
<2><1f0>: Abbrev Number: 9 (DW_TAG_subrange_type)
<1f1> DW_AT_type : <0x201>
<1f5> DW_AT_upper_bound : 10 byte block: 75 1 8 20 24 8 20 26 31 1c
(DW_OP_breg5 (rdi): 1; DW_OP_const1u: 32; DW_OP_shl; DW_OP_const1u: 32;
DW_OP_shra; DW_OP_lit1; DW_OP_minus)
should be able to evaluate sizeof (a) at the start of main correctly.
(gdb) start
Temporary breakpoint 1 at 0x4004fd: file t.c, line 6.
(gdb) ptype a
type = char [variable length]
(gdb) p sizeof (a)
$1 = 0
so either gdb should print out 'optimized out' as it does for
(gdb) p a
$2 = <optimized out>
or compute a correct value for sizeof (a). Just computing zero looks
wrong to me.
The DWARF expression for the upper bound is thus either not evaluated
or evaluated to a wrong expression.
This causes a GCC testsuite FAIL for gcc.dg/guality/vla-1.c
--
You are receiving this mail because:
You are on the CC list for the bug.