Bug 11237 – zero initializer emitted to read-only data segment, slow compilation
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-10-12T16:14:00Z
Last change time
2013-11-02T20:31:40Z
Keywords
pull, wrong-code
Assigned to
nobody
Creator
code
Comments
Comment #0 by code — 2013-10-12T16:14:46Z
cat > bug.d << CODE
struct Buffer { ubyte[64 * 1024] buffer; }
CODE
dmd -c bug
----
The compilation takes forever (5s) due to the reasons named in
http://d.puremagic.com/issues/show_bug.cgi?id=10866#c20.
It's a regression introduced after v2.063.2 that the initializer
is not emitted as BSS symbol.
Comment #1 by k.hara.pg — 2013-10-13T00:55:39Z
*** This issue has been marked as a duplicate of issue 11233 ***
Comment #2 by code — 2013-10-13T09:33:19Z
Bug 11233 was resolved which dix the performance issue.
We still need to do something about the rdata vs. BSS thing, otherwise zero initializers use up unnecessary space in the object files.
The broke struct initializers.
They are emitted to object files with a symbol size of 1 byte regardless of their actual size.
Also I wonder why the initializer are now common symbols ('V') while they previously were normal uninitialized variables ('B').
Test case
cat > bug.d << CODE
struct Buffer { ubyte[64 * 1024] buffer; }
CODE
dmd2.063.2 -c bug
nm -S bug.o
0000000000000000 0000000000010000 B _D4bug26Buffer6__initZ
// 1-byte size and weak object
dmd2.064 -c bug
nm -S bug.o
0000000000000000 0000000000000001 V _D4bug26Buffer6__initZ