[Bug 139] GDC writes all-zero initialisers in the rodata section

via D.gnu d.gnu at puremagic.com
Thu Nov 20 10:15:30 PST 2014


http://bugzilla.gdcproject.org/show_bug.cgi?id=139

--- Comment #7 from Johannes Pfau <johannespfau at gmail.com> ---
I'm doing some experiments with D on microcontrollers lately (AVR 8 bit
hello-world(blinking LED) is working: https://github.com/jpf91/GDC/tree/microD
) and I came across this again.

This bugfix leads to the strange situation that zero initializers are a
performance penalty on these systems as RW memory is scarce, but intilizers
with one member not set to zero are put into .rodata and are therefore a better
option.

GCC puts all zero initialzed objects into rodata as well:
------------------------------------------------------------
struct Test
{
    int a;
    int b;
};

const struct Test tb = {0,0};
------------------------------------------------------------
    .globl    tb
    .section    .rodata
    .align 4
    .type    tb, @object
    .size    tb, 8
tb:
    .zero    8
------------------------------------------------------------


So are there any objections against reverting this commit?

-- 
You are receiving this mail because:
You are watching all bug changes.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/d.gnu/attachments/20141120/f89a2fe3/attachment.html>


More information about the D.gnu mailing list