← Back to index
|
Original Bugzilla link
Bug 10071 – 'real' alignment wrong on several platforms
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-05-12T13:12:00Z
Last change time
2014-06-12T23:09:18Z
Keywords
pull, wrong-code
Assigned to
nobody
Creator
code
Comments
Comment #0
by code — 2013-05-12T13:12:50Z
--- cat > structsize.cpp <<EOF #include <stdio.h> #include <stddef.h> typedef long double real; struct S { int a; real d; bool e; }; S s; int main() { printf("struct size: %lu\n", sizeof(S)); printf("int offset: %lu\n", offsetof(S, a)); printf("real offset: %lu\n", offsetof(S, d)); printf("bool offset: %lu\n", offsetof(S, e)); return 0; } EOF clang++ -o structsize -m32 structsize.cpp && ./structsize --- prints --- struct size: 48 int offset: 0 real offset: 16 bool offset: 32 --- but --- cat > structsize.d <<EOF struct S { int a; real d; bool e; }; pragma(msg, "struct size: ", S.sizeof); pragma(msg, "int offset: ", S.a.offsetof); pragma(msg, "real offset: ", S.d.offsetof); pragma(msg, "bool offset: ", S.e.offsetof); EOF dmd -m32 -c structsize.d --- yields --- struct size: 32u int offset: 0u real offset: 8u bool offset: 24u ---
Comment #1
by code — 2013-05-12T13:13:37Z
(OS X 10.7.5, Clang 3.1/XCode 4.6.2, DMD 2.062/Git master)
Comment #2
by yebblies — 2013-11-21T08:04:21Z
Is this still broken? From target.c: else if (global.params.isOSX) { realsize = 16; realpad = 6; realalignsize = 16; }
Comment #3
by yebblies — 2014-06-08T08:10:17Z
Turns out it is still broken, and is the cause of an impossible assertion failure in ddmd.
Comment #4
by yebblies — 2014-06-08T10:15:40Z
It's also broken on linux64 and probably others
https://github.com/D-Programming-Language/dmd/pull/3648
Comment #5
by github-bugzilla — 2014-06-12T23:09:17Z
Commits pushed to master at
https://github.com/D-Programming-Language/dmd
https://github.com/D-Programming-Language/dmd/commit/d9e9991584748042f778fe272cd68f95811a261c
Fix Issue 10071 - 'real' alignment wrong on OS X 32 bit
https://github.com/D-Programming-Language/dmd/commit/647917bd1b988fa49034fe104eea4119fd2812bd
Merge pull request #3648 from yebblies/issue10071 Issue 10071 - 'real' alignment wrong on OS X 32 bit