Bug 25101

Summary: Assertion `TYPE_NFIELDS (type) > 0' failed
Product: gdb Reporter: Martin <gdb.bugs>
Component: gdbAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED FIXED    
Severity: normal CC: tromey
Priority: P2    
Version: 8.3.1   
Target Milestone: ---   
Host: Target:
Build: win 64 Last reconfirmed:

Description Martin 2019-10-14 23:03:29 UTC
"&"gdbtypes.c:2160: internal-error: type* resolve_dynamic_struct(type*, property_addr_info*): Assertion `TYPE_NFIELDS (type) > 0' failed.\nA problem internal to GDB has been detected,\nfurther debugging may prove unreliable.\n"
&"\nThis is a bug, please report it."

To reproduce compile the below with fpc 3.0.4
using command-line options -gw3 for dwarf 3

Presumingly gdb does dislike the fact that the structure has no members?
However there is nothing in the DWARF spec (not that I have found) that prohibits this.


program Project1;
var
  a: IUnknown;

begin
  a:= nil;
end.
Comment 1 Martin 2019-10-14 23:14:05 UTC
To get the error do a
ptype a

or 
p a
Comment 2 Tom Tromey 2022-11-07 20:47:20 UTC
This works for me with Fedora 34 system gdb:

GNU gdb (GDB) Fedora 11.1-5.fc34

(gdb) p a
$1 = {
}

so, I'm going to close this bug.
Feel free to reopen if you can reproduce with a newer version.