http://llvm.org/bugs/show_bug.cgi?id=19529

            Bug ID: 19529
           Summary: Macro expansion not performed on pragma arguments when
                    using -save-temps
           Product: clang
           Version: 3.4
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

Created attachment 12424
  --> http://llvm.org/bugs/attachment.cgi?id=12424&action=edit
C test case

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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to