Open
Description
Bugzilla Link | 19529 |
Version | 3.7 |
OS | Linux |
Attachments | C test case |
Reporter | LLVM Bugzilla Contributor |
CC | @rnk |
Extended Description
Consider the following C code:
#define PACK_SZ 1
#pragma pack(PACK_SZ)
struct s1 {
char a;
int b;
};
struct s1 myst;
When compiling it without '-save-temps',
the pragma is correctly handled:
clang pragma_pack.c -O2 -S -emit-llvm
cat pragma_pack.ll
[...]
%struct.s1 = type <{ i8, i32 }>
@myst = common global %struct.s1 zeroinitializer, align 1
[...]
When compiling it with '-save-temps', the macro
is not expanded and the pragma is then ignored:
clang pragma_pack.c -O2 -S -emit-llvm -save-temps
pragma_pack.c:4:14: warning: unknown action for '#pragma pack' - ignored
#pragma pack(PACK_SZ)
^
1 warning generated.
cat
[...]
%struct.s1 = type { i8, i32 }
@myst = common global %struct.s1 zeroinitializer, align 4
[...]
The problem has been reproduced with other pragmas.
The problem is present in CLANG 3.4, but likely in other version as well.