Bug 15130 – dmd emits huge data for zero initialized struct

Status
NEW
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
Linux
Creation time
2015-09-30T10:23:38Z
Last change time
2024-12-13T18:45:00Z
Assigned to
No Owner
Creator
Martin Nowak
Moved to GitHub: dmd#19051 →

Comments

Comment #0 by code — 2015-09-30T10:23:38Z
cat > bug.d << CODE struct Buffer { ubyte[64*1024] bytes; } CODE dmd -c bug nm -S bug.o ---- 0000000000000000 0000000000000088 V _D21TypeInfo_S3bug6Buffer6__initZ 0000000000000010 000000000000000c R _D3bug12__ModuleInfoZ 0000000000000000 0000000000010000 B _D3bug6Buffer6__initZ ---- The _D3bug6Buffer6__initZ is referenced by the typeinfo, but it should be a null array in the typeinfo instead. https://github.com/D-Programming-Language/druntime/blob/1f957372e5dadb92ab1d621d68232dbf8a2dbccf/src/object.d#L2682
Comment #1 by dlang-bugzilla — 2017-07-03T18:54:10Z
2.053 and earlier (before https://github.com/dlang/dmd/pull/605), nm -S output looked like this: 0000000000000000 t U _D15TypeInfo_Struct6__vtblZ 0000000000000000 0000000000000008 V _D22TypeInfo_S4test6Buffer6__initZ 0000000000000000 D _D4test12__ModuleInfoZ 0000000000000000 R _D4test6Buffer6__initZ U _Dmodule_ref However, the object file is still over 64K in size.
Comment #2 by code — 2018-01-14T03:30:42Z
In that PR I had to fix the symbol sizes dmd specifies so that copy relocations work. Before that dmd was specifying some symbols to only be 8 byte while still allocating the space for the full symbol. It also affects ldc-1.7.0 and gdc-4.8.5 btw.
Comment #3 by robert.schadek — 2024-12-13T18:45:00Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19051 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB