Description
See https://godbolt.org/z/M5x5Kdnc3, which uses a test case adapted from test/Sema/constant_builtins_vector.cpp
.
clang++: /root/llvm-project/clang/include/clang/AST/Expr.h:4483: llvm::APSInt clang::ShuffleVectorExpr::getShuffleMaskIdx(const clang::ASTContext&, unsigned int) const: Assertion `(N < NumExprs - 2) && "Shuffle idx out of range!"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/clang++ -gdwarf-4 -g -o /app/output.s -mllvm --x86-asm-syntax=intel -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -std=c++2b <source>
1. <source>:22:66: current parser token ';'
#0 0x00000000039a1548 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x39a1548)
#1 0x000000000399f22c llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x399f22c)
#2 0x00000000038f0288 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x000072fd01a42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x000072fd01a969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#5 0x000072fd01a42476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#6 0x000072fd01a287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#7 0x000072fd01a2871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#8 0x000072fd01a39e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
We should just check for this case in Sema and reject it.