[llvm-bugs] [Bug 39087] New: Ternary define/macro with a dead branch is always evaluated
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Sep 26 10:00:28 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=39087
Bug ID: 39087
Summary: Ternary define/macro with a dead branch is always
evaluated
Product: clang
Version: unspecified
Hardware: Other
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Frontend
Assignee: unassignedclangbugs at nondot.org
Reporter: joe at benden.us
CC: llvm-bugs at lists.llvm.org
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.
--
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/20180926/b883011f/attachment.html>
More information about the llvm-bugs
mailing list