It looks like the -malign-double
compiler option has been removed from Clang. Code example:
#include <stddef.h> #include <stdio.h> typedef struct X { char a; long long b; } X; int main(void) { printf("%zd\n", offsetof(X, b)); return 0; }
When compiling with GCC in 32-bit mode ( -m32
), this can be done to output 8 or 4, depending on whether the -malign-double
option is -malign-double
or not. But Clang does not support this option:
$ clang test.c -m32 -malign-double clang: warning: argument unused during compilation: '-malign-double' $ ./a.out 4
Clang Version:
Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn) Target: x86_64-apple-darwin11.3.0 Thread model: posix
I cannot find any official documentation in the full list of compiler flags supported by Clang, they seem to be most likely to refer to the GCC documentation.
Does Clang have the current equivalent -malign-double
? Or am I stuck to use another compiler? I need it to compile some code that references a third-party binary library that uses this flag.
source share