← Back to index
|
Original Bugzilla link
Bug 22311 – dmd slice length is wrong on DWARF
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2021-09-17T20:58:42Z
Last change time
2021-09-19T04:52:56Z
Keywords
DebugInfo, pull
Assigned to
No Owner
Creator
mhh
Comments
Comment #0
by maxhaton — 2021-09-17T20:58:42Z
Compile this simple code (on 64 bit): --- int[] x; static assert(x.length.sizeof == 8); --- Now run the binary through pahole, we get: --- struct _Array_int { uint long length; /* 0 4 */ /* XXX 4 bytes hole, try to pack */ int * ptr; /* 8 8 */ /* size: 16, cachelines: 1, members: 2 */ /* sum members: 12, holes: 1, sum holes: 4 */ /* last cacheline: 16 bytes */ }; --- i.e. the debug info says the slice has a length of 4bytes, this is clearly wrong. GDB agrees --- /* offset | size */ type = struct _Array_int { /* 0 | 4 */ ulong length; /* XXX 4-byte hole */ /* 8 | 8 */ int *ptr; /* total size (bytes): 16 */ } ---
Comment #1
by dlang-bot — 2021-09-17T21:52:39Z
@maxhaton created dlang/dmd pull request #13081 "Fix Issue 22311 - Slice .length DWARF type" fixing this issue: - Fix Issue 22311
https://github.com/dlang/dmd/pull/13081
Comment #2
by dlang-bot — 2021-09-19T04:52:56Z
dlang/dmd pull request #13081 "Fix Issue 22311 - Slice .length DWARF type" was merged into master: - 77775a01d0e3964525a04ff70a2dbae1e2603a75 by Max Haughton: Fix Issue 22311
https://github.com/dlang/dmd/pull/13081