Inlining Code Test

Don nospam at nospam.com
Fri Dec 17 17:17:46 PST 2010


Nick Voronin wrote:
> I found this on bugzilla.
> http://d.puremagic.com/issues/show_bug.cgi?id=2278
> 
> So it's not really a bug. Yet there is no simple workaround. And gap 
> between int and double looks strange when stack frame itself is unaligned.

Interestingly, since I filed that bug, DMD for MacOSX was created, which 
  ensures that the stack stays aligned in the way I described! So the 
DMD backend is perfectly capable of doing it now.

> btw, is there no explicit alignment for variables in D at all?
> align(8) double d; compiles if d is global, but it does nothing.

That's a regression. Large globals are always aligned to a 16-byte 
boundary (see changelog for 2.007)
However this code:

import core.stdc.stdio: printf;

int a;
double[4] d;

void main() {
     printf("%u %u\n", (cast(size_t)&a) % 8, (cast(size_t)&d) % 8);
}
shows that it stopped doing that somewhere between 2.027 and 2.030.


More information about the Digitalmars-d mailing list