<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - Macro expansion not performed on pragma arguments when using -save-temps"
href="http://llvm.org/bugs/show_bug.cgi?id=19529">19529</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Macro expansion not performed on pragma arguments when using -save-temps
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.4
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>tthery@free.fr
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=12424" name="attach_12424" title="C test case">attachment 12424</a> <a href="attachment.cgi?id=12424&action=edit" title="C test case">[details]</a></span>
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:
----------------------------------------
<span class="quote">> clang pragma_pack.c -O2 -S -emit-llvm
> cat pragma_pack.ll</span >
[...]
%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:
-----------------------------------------------
<span class="quote">> clang pragma_pack.c -O2 -S -emit-llvm -save-temps</span >
pragma_pack.c:4:14: warning: unknown action for '#pragma pack' - ignored
#pragma pack(PACK_SZ)
^
1 warning generated.
<span class="quote">> cat</span >
[...]
%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.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>