cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

eudoxos
Journeyman III

Alignment bug (?) in AMD's compiler (with testcase)

AMD's compiler does not respect alignment of types within unions. Within the struct

struct Foo{

    int c;

    union{ double b0; } b;

};

b0 does not have natural alignment (8 bytes). The Intel/nVidia compilers (LLVM) as well as gcc (all tested versions, as host compiler filling the buffer with data) aligns b0 properly. I am attaching test file which demonstrates the difference.

Dumping the part of the memory, I obtain with AMD:

b0 is at 4

b0 : ad 49 b2 d4 01 22 c6 c6

foo: 7d c3 94 25 ad 49 b2 d4   01 22 c6 c6

whereas with Intel/nVidia:

b0 is at 8

b0 : 01 22 c6 c6 21 ea b1 d4

foo: 7d c3 94 25 ad 49 b2 d4   01 22 c6 c6 21 ea b1 d4

0 Likes
1 Reply

eudoxes,

Thank you for supplying us with a test case and reporting this issue. I can confirm that this is an issue with our SDK and that it has been fixed internally. This problem was caused by incorrect alignment in the version of a LLVM that we are shipping. This has been fixed in LLVM already, but we did not have a new enough version that contained the fix. We have backported the fix and it should show up in a future catalyst release.

0 Likes