[dmd-internals] Testcase in test42.d

David Nadlinger code at klickverbot.at
Fri Apr 5 10:15:14 PDT 2013


On 4 Apr 2013, at 20:02, Walter Bright wrote:
> On 4/4/2013 9:57 AM, Iain Buclaw wrote:
>> What exactly is this testing for?  Should I even care if it fails?
>>
>> https://github.com/D-Programming-Language/dmd/blob/master/test/runnable/test42.d#L613
>>
>> It *looks* like it is expecting the data to be aligned to 16 bytes.
>
> Yes.
>
>> But why should this matter?
>
> People use such constructs to support SIMD code, which requires 16 
> byte alignment.

I think you might be wrong here:

»struct A { int[4] a; }« is equivalent to »struct A { int a0, a1, a2, 
a3; }« by your own definition, and GCC/Clang emit a global of this type 
aligned to 4 bytes. Thus, generally requiring 16 byte alignment would 
break C ABI compatibility.

For this reasons, I disabled the test for LDC as well. If you think that 
it should pass, where does the 16 byte figure come from (in terms of 
both lang spec and DMD frontend)? At least back when I had a look at the 
test case for LDC, I couldn't really find a justification.

David


More information about the dmd-internals mailing list