[LLVMbugs] [Bug 19529] New: Macro expansion not performed on pragma arguments when using -save-temps

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Apr 23 07:37:49 PDT 2014


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: unassignedclangbugs at nondot.org
          Reporter: tthery at free.fr
                CC: llvmbugs at cs.uiuc.edu
    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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140423/46f22c90/attachment.html>


More information about the llvm-bugs mailing list