<html>
<head>
<base href="https://bugs.llvm.org/">
</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 - Ternary define/macro with a dead branch is always evaluated"
href="https://bugs.llvm.org/show_bug.cgi?id=39087">39087</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Ternary define/macro with a dead branch is always evaluated
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Other
</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>Frontend
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>joe@benden.us
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>The following sample program refuses to compile; yet works fine on other
compilers.
```
#include <arm_neon.h>
#define vroti_epi32(x, i) \
(i < 0 ? vsliq_n_u32(vshrq_n_u32(x, 32 - i), x, i) \
: vsriq_n_u32(vshlq_n_u32(x, 32 + i), x, -i))
int main()
{
uint32x4_t x = vdupq_n_u32(42);
uint32x4_t value = vroti_epi32(x, 12);
return 0;
}
```
When compiling, the following output is shown:
```
example.c:10:21: error: argument should be a value from 0 to 31
uint32x4_t value = vroti_epi32(x, 12);
^
example.c:5:30: note: expanded from macro 'vroti_epi32'
: vsriq_n_u32(vshlq_n_u32(x, 32 + i), x, -i))
^
/usr/lib/llvm-3.6/bin/../lib/clang/3.6.0/include/arm_neon.h:23019:24: note:
expanded from macro 'vshlq_n_u32'
__ret = (uint32x4_t) __builtin_neon_vshlq_n_v((int8x16_t)__s0, __p1, 50); \
^
/usr/lib/llvm-3.6/bin/../lib/clang/3.6.0/include/arm_neon.h:24704:21: note:
expanded from macro 'vsriq_n_u32'
uint32x4_t __s0 = __p0; \
^
example.c:10:21: error: argument should be a value from 1 to 32
uint32x4_t value = vroti_epi32(x, 12);
^
example.c:5:18: note: expanded from macro 'vroti_epi32'
: vsriq_n_u32(vshlq_n_u32(x, 32 + i), x, -i))
^
/usr/lib/llvm-3.6/bin/../lib/clang/3.6.0/include/arm_neon.h:24707:24: note:
expanded from macro 'vsriq_n_u32'
__ret = (uint32x4_t) __builtin_neon_vsriq_n_v((int8x16_t)__s0,
(int8x16_t)__s1, __p2, 50); \
^
2 errors generated.
```
I expected that the program compile and execute, successfully.</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>