public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/18281] New: Miscomputes or does not handle dwarf expression
@ 2015-04-20 9:55 rguenth at gcc dot gnu.org
2021-02-22 2:43 ` [Bug gdb/18281] " tromey at sourceware dot org
0 siblings, 1 reply; 2+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-04-20 9:55 UTC (permalink / raw)
To: gdb-prs
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug gdb/18281] Miscomputes or does not handle dwarf expression
2015-04-20 9:55 [Bug gdb/18281] New: Miscomputes or does not handle dwarf expression rguenth at gcc dot gnu.org
@ 2021-02-22 2:43 ` tromey at sourceware dot org
0 siblings, 0 replies; 2+ messages in thread
From: tromey at sourceware dot org @ 2021-02-22 2:43 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=18281
Tom Tromey <tromey at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Target Milestone|--- |9.2
Status|NEW |RESOLVED
CC| |tromey at sourceware dot org
--- Comment #1 from Tom Tromey <tromey at sourceware dot org> ---
I get
(gdb) ptype a
type = char [2]
(gdb) p sizeof(a)
$1 = 2
with the Fedora 32 system gcc (10.2) and gdb (9.1).
So, I think this works now.
If not, feel free to reopen. Attaching the failing executable would be good.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-02-22 2:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-20 9:55 [Bug gdb/18281] New: Miscomputes or does not handle dwarf expression rguenth at gcc dot gnu.org
2021-02-22 2:43 ` [Bug gdb/18281] " tromey at sourceware dot 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).