llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

__builtin_shufflevector clang++ crash/SIGSEGV

Open zngos opened this issue 1 month ago • 2 comments

Repros in 22.1.8 and 23.1.5

--- m.cppm

export module m;
export template <int N> int f() {
  typedef int v4 __attribute__((vector_size(16)));
  v4 a{};
  return __builtin_shufflevector(a, a, 1, 0, 3, 2)[0];
}

--- use.cpp

import m;
int main() { return f<0>(); }
clang++ -std=c++20 --precompile m.cppm -o m.pcm
clang++ -std=c++20 -fmodule-file=m=m.pcm -fsyntax-only use.cpp   # crashes
Stack dump:
0.	Program arguments: third_party/toolchain/clang++ -std=c++20 -fmodule-file=m=/tmp/m.pcm -fsyntax-only /tmp/use.cpp
1.	<eof> parser at end of file
2.	/tmp/m.cppm:2:29: instantiating function definition 'f<0>'
clang++: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 23.1.5
Target: x86_64-alpine-linux-musl
Thread model: posix
InstalledDir: ---------
clang++: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING CRASH REPRODUCER FILES TO THE BUG REPORT:
clang++: note: diagnostic msg: /tmp/use-56bea6.cpp
clang++: note: diagnostic msg: /tmp/use-56bea6.sh
clang++: note: diagnostic msg: 

********************

use-56bea6.sh use-56bea6.cpp

zngos avatar Nov 04 '26 10:11 zngos

failing assertion: https://github.com/llvm/llvm-project/blob/c44e0095624a153e11943ace485c3b54be7c491d/clang/lib/Sema/TreeTransform.h#L4067

tbaederr avatar Nov 04 '26 11:11 tbaederr

@llvm/issue-subscribers-clang-modules

Author: zngos

Repros in 22.1.8 and 23.1.5

--- m.cppm

export module m;
export template &lt;int N&gt; int f() {
  typedef int v4 __attribute__((vector_size(16)));
  v4 a{};
  return __builtin_shufflevector(a, a, 1, 0, 3, 2)[0];
}

--- use.cpp

import m;
int main() { return f&lt;0&gt;(); }
clang++ -std=c++20 --precompile m.cppm -o m.pcm
clang++ -std=c++20 -fmodule-file=m=m.pcm -fsyntax-only use.cpp   # crashes
Stack dump:
0.	Program arguments: third_party/toolchain/clang++ -std=c++20 -fmodule-file=m=/tmp/m.pcm -fsyntax-only /tmp/use.cpp
1.	&lt;eof&gt; parser at end of file
2.	/tmp/m.cppm:2:29: instantiating function definition 'f&lt;0&gt;'
clang++: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 23.1.5
Target: x86_64-alpine-linux-musl
Thread model: posix
InstalledDir: ---------
clang++: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING CRASH REPRODUCER FILES TO THE BUG REPORT:
clang++: note: diagnostic msg: /tmp/use-56bea6.cpp
clang++: note: diagnostic msg: /tmp/use-56bea6.sh
clang++: note: diagnostic msg: 

********************

use-56bea6.sh use-56bea6.cpp