[VECLIB] LLVM assertion when pow function is called without arguments
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
consider the following program
```
int pow ();
int main ()
{
return pow ();
return 0;
}
```
The program is used in configure script of libpng.
when compiled with -fveclib=libmvec, the compiler asserts
$clang -O3 -fveclib=libmvec x1.c
```
clang-22: /home/amd/llvm_trunk/llvm-project/llvm/lib/Transforms/Utils/InjectTLIMappings.cpp:45: void addVariantDeclaration(llvm::CallInst&, const llvm::ElementCount&, const llvm::VecDesc*): Assertion `!ScalarFTy->isVarArg() && "VarArg functions are not supported."' 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: /home/amd/shivaram/llvm_mir_flang/bin/clang-22 -cc1 -triple x86_64-unknown-linux-gnu -O3 -emit-obj -dumpdir a- -disable-free -clear-ast-before-backend -main-file-name x1.c -mrelocation-model pic -pic-level 2 -pic-is-pie -fveclib=libmvec -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/home/amd/shivaram/libpng/libpng-1.2.44 -fcoverage-compilation-dir=/home/amd/shivaram/libpng/libpng-1.2.44 -resource-dir /home/amd/shivaram/llvm_mir_flang/lib/clang/22 -internal-isystem /home/amd/shivaram/llvm_mir_flang/lib/clang/22/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -ferror-limit 19 -fmessage-length=189 -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcolor-diagnostics -vectorize-loops -vectorize-slp -faddrsig -fdwarf2-cfi-asm -o /tmp/x1-5b0393.o -x c x1.c
1. parser at end of file
2. Optimizer
3. Running pass "function(drop-unnecessary-assumes,float2int,lower-constant-intrinsics,chr,loop(loop-rotate,loop-deletion),loop-distribute,inject-tli-mappings,loop-vectorize,infer-alignment,loop-load-elim,instcombine,simplifycfg,slp-vectorizer,vector-combine,instcombine,loop-unroll,transform-warning,sroa,infer-alignment,instcombine,loop-mssa(licm),alignment-from-assumptions,loop-sink,instsimplify,div-rem-pairs,tailcallelim,simplifycfg)" on module "x1.c"
4. Running pass "inject-tli-mappings" on function "main"
#0 0x00007f8ac429f032 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/amd/shivaram/llvm_mir_flang/bin/../lib/libLLVMSupport.so.22.0git+0x20b032)
#1 0x00007f8ac429ba0f llvm::sys::RunSignalHandlers() (/home/amd/shivaram/llvm_mir_flang/bin/../lib/libLLVMSupport.so.22.0git+0x207a0f)
#2 0x00007f8ac429bb5c SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#3 0x00007f8ac3c75520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x00007f8ac3cc99fc __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
#5 0x00007f8ac3cc99fc __pthread_kill_internal ./nptl/pthread_kill.c:78:10
#6 0x00007f8ac3cc99fc pthread_kill ./nptl/pthread_kill.c:89:10
#7 0x00007f8ac3c75476 gsignal ./signal/../sysdeps/posix/raise.c:27:6
#8 0x00007f8ac3c5b7f3 abort ./stdlib/abort.c:81:7
#9 0x00007f8ac3c5b71b _nl_load_domain ./intl/loadmsgcat.c:1177:9
#10 0x00007f8ac3c6ce96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#11 0x00007f8ac5457cb3 addMappingsFromTLI(llvm::TargetLibraryInfo const&, llvm::CallInst&)::'lambda'(llvm::ElementCount const&, bool)::operator()(llvm::ElementCount const&, bool) const InjectTLIMappings.cpp:0:0
#12 0x00007f8ac5458453 runImpl(llvm::TargetLibraryInfo const&, llvm::Function&) (.isra.0) InjectTLIMappings.cpp:0:0
#13 0x00007f8ac5458df7 llvm::InjectTLIMappings::run(llvm::Function&, llvm::AnalysisManager&) (/home/amd/shivaram/llvm_mir_flang/bin/../lib/libLLVMTransformUtils.so.22.0git+0x15bdf7)
#
```
It is not a normal usage of compiler, but graceful exit is expected.
Contributor guide
Assessment
This issue has not been assessed yet.