| Issue |
63324
|
| Summary |
Crash at -O0 on x86_64-linux_gnu: Assertion `isa<T>(CanonicalType)' failed.
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
shao-hua-li
|
Compiler explorer: https://godbolt.org/z/jWocx1h8E
Input program:
```C
int printf(const char *, ...);
char a, b, c, f;
int d = -1625723284, h = -1306316094;
signed char *e;
long g;
signed char **i = &e;
char j[] = {077};
long(k)() { return 0; }
int l(char *n) {
for (;;)
if (*n <= '9')
;
else
return 0;
}
static int o() {
int m;
c = a - 9;
for (; c == 0;)
for (; b;)
if (k())
return 0;
for (; *e + d + (h - -1306316094) - -1625723339 <= 1;) {
m = 0;
for (; d + (h - -1306316094) - -1625723285 + m <= 1; m++)
for (; g <= 1; g++)
l(j);
return 0;
}
return 7;
}
int main() {
f = 202;
*i = &f;
o();
printf("%d\n", (int)g);
}
```
```console
% clang-tk -O0 -fsanitize=undefined a.c
clang-17: /zdata/shaoli/compilers/ccbuilder-repos/llvm-project/clang/include/clang/AST/Type.h:7520: const T* clang::Type::castAs() const [with T = clang::FunctionProtoType]: Assertion `isa<T>(CanonicalType)' 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: /zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -dumpdir a- -disable-free -clear-ast-before-backend -main-file-name a.c -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/zdata/shaoli/realsmith/debug -resource-dir /zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/lib/clang/17 -internal-isystem /zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/lib/clang/17/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/11/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O0 -fdebug-compilation-dir=/zdata/shaoli/realsmith/debug -ferror-limit 19 -fsanitize=alignment,array-bounds,bool,builtin,enum,float-cast-overflow,function,integer-divide-by-zero,nonnull-attribute,null,pointer-overflow,return,returns-nonnull-attribute,shift-base,shift-exponent,signed-integer-overflow,unreachable,vla-bound,vptr -fsanitize-recover=alignment,array-bounds,bool,builtin,enum,float-cast-overflow,function,integer-divide-by-zero,nonnull-attribute,null,pointer-overflow,returns-nonnull-attribute,shift-base,shift-exponent,signed-integer-overflow,vla-bound,vptr -fno-sanitize-memory-param-retval -fno-sanitize-address-use-odr-indicator -fgnuc-version=4.2.1 -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/a-28d726.o -x c a.c
1. a.c:9:1: current parser token 'int'
2. a.c:8:6: LLVM IR generation of declaration 'k'
3. a.c:8:6: Generating code for declaration 'k'
#0 0x0000558777c0d27f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x3b4627f)
#1 0x0000558777c0a9d4 SignalHandler(int) Signals.cpp:0:0
#2 0x00007f0ccd482420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#3 0x00007f0ccced300b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
#4 0x00007f0ccceb2859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
#5 0x00007f0ccceb2729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
#6 0x00007f0cccec3fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
#7 0x000055877aee1023 (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x6e1a023)
#8 0x000055877af1e5e1 clang::ASTContext::getFunctionTypeWithExceptionSpec(clang::QualType, clang::FunctionProtoType::ExceptionSpecInfo const&) const (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x6e575e1)
#9 0x000055877af1e530 clang::ASTContext::getFunctionTypeWithExceptionSpec(clang::QualType, clang::FunctionProtoType::ExceptionSpecInfo const&) const (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x6e57530)
#10 0x0000558777fa1961 clang::CodeGen::CodeGenFunction::getUBSanFunctionTypeHash(clang::QualType) const (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x3eda961)
#11 0x0000558777fb28dc clang::CodeGen::CodeGenFunction::StartFunction(clang::GlobalDecl, clang::QualType, llvm::Function*, clang::CodeGen::CGFunctionInfo const&, clang::CodeGen::FunctionArgList const&, clang::SourceLocation, clang::SourceLocation) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x3eeb8dc)
#12 0x0000558777fb64c7 clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x3eef4c7)
#13 0x000055877801a919 clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x3f53919)
#14 0x00005587780158c5 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x3f4e8c5)
#15 0x0000558778016498 clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x3f4f498)
#16 0x000055877801f2d3 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (.part.0) CodeGenModule.cpp:0:0
#17 0x0000558778e9f8a6 (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) ModuleBuilder.cpp:0:0
#18 0x0000558778e8fd00 clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x4dc8d00)
#19 0x000055877a019fa4 clang::ParseAST(clang::Sema&, bool, bool) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x5f52fa4)
#20 0x0000558778e9c578 clang::CodeGenAction::ExecuteAction() (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x4dd5578)
#21 0x00005587786ecd79 clang::FrontendAction::Execute() (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x4625d79)
#22 0x0000558778671c86 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x45aac86)
#23 0x00005587787cf326 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x4708326)
#24 0x00005587751280f4 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x10610f4)
#25 0x0000558775123e1a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#26 0x00005587751253ec clang_main(int, char**, llvm::ToolContext const&) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x105e3ec)
#27 0x000055877503a165 main (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0xf73165)
#28 0x00007f0ccceb4083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#29 0x000055877511ebfe _start (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x1057bfe)
clang-tk: error: unable to execute command: Aborted
clang-tk: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 17.0.0 (https://github.com/llvm/llvm-project.git 53d405762219d798286b99c297098a14643440fe)
%
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs