[llvm-bugs] [Bug 34142] New: -msse4 -O0 segfault
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Aug 10 06:26:10 PDT 2017
https://bugs.llvm.org/show_bug.cgi?id=34142
Bug ID: 34142
Summary: -msse4 -O0 segfault
Product: new-bugs
Version: 4.0
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: hjl.tools at gmail.com
CC: llvm-bugs at lists.llvm.org
[hjl at gnu-tools-1 pr81389]$ cat x.c
#include <nmmintrin.h>
#include <stdio.h>
int main(int argc, char* argv[]) {
__m128i key128 = { ':' };
const char data[] = "___0123456789:_:abcdefghijklmn";
const char* ptr = argc < 100 ? data : argv[1];
int idx = _mm_cmpestri(key128, 1,
*(const __m128i*)(ptr+3), 16, // don't require memory
align
_SIDD_UBYTE_OPS|_SIDD_CMP_EQUAL_ORDERED|_SIDD_LEAST_SIGNIFICANT);
printf("%zd\n", idx);
return 0;
}
[hjl at gnu-tools-1 pr81389]$ clang -msse4 -O0 x.c
[hjl at gnu-tools-1 pr81389]$ ./a.out
Segmentation fault (core dumped)
[hjl at gnu-tools-1 pr81389]$ clang -msse4 -O2 x.c
[hjl at gnu-tools-1 pr81389]$ ./a.out
10
[hjl at gnu-tools-1 pr81389]$
"*(const __m128i*)(ptr+3)" is an incorrect cast. GCC supports __m128i_u
for this:
[hjl at gnu-tools-1 pr81389]$ cat y.c
#include <nmmintrin.h>
#include <stdio.h>
int main(int argc, char* argv[]) {
__m128i key128 = { ':' };
const char data[] = "___0123456789:_:abcdefghijklmn";
const char* ptr = argc < 100 ? data : argv[1];
int idx = _mm_cmpestri(key128, 1,
*(const __m128i_u*)(ptr+3), 16, // don't require memory
align
_SIDD_UBYTE_OPS|_SIDD_CMP_EQUAL_ORDERED|_SIDD_LEAST_SIGNIFICANT);
printf("%zd\n", idx);
return 0;
}
[hjl at gnu-tools-1 pr81389]$ gcc -msse4 -O0 y.c
[hjl at gnu-tools-1 pr81389]$ ./a.out
10
[hjl at gnu-tools-1 pr81389]$ gcc -msse4 -O2 y.c
[hjl at gnu-tools-1 pr81389]$ ./a.out
10
[hjl at gnu-tools-1 pr81389]$ clang -msse4 -O0 y.c
y.c:9:12: error: unknown type name '__m128i_u'; did you mean '__m128i'?
*(const __m128i_u*)(ptr+3), 16, // don't requir...
^~~~~~~~~
__m128i
/usr/bin/../lib64/clang/4.0.0/include/smmintrin.h:426:55: note: expanded from
macro '_mm_cmpestri'
(__v16qi)(__m128i)(B), (int)(LB), \
^
/usr/bin/../lib64/clang/4.0.0/include/emmintrin.h:30:19: note: '__m128i'
declared here
typedef long long __m128i __attribute__((__vector_size__(16)));
^
1 error generated.
[hjl at gnu-tools-1 pr81389]$
--
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/20170810/0f999d5d/attachment.html>
More information about the llvm-bugs
mailing list