[llvm-bugs] [Bug 49266] New: clang (inline-asm): assertio 'castIsValid(op, S, Ty) && "Invalid cast!"' failed
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Feb 19 08:05:47 PST 2021
https://bugs.llvm.org/show_bug.cgi?id=49266
Bug ID: 49266
Summary: clang (inline-asm): assertio 'castIsValid(op, S, Ty)
&& "Invalid cast!"' failed
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: zhan3299 at purdue.edu
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
neeilans at live.com, richard-llvm at metafoo.co.uk
It seems a less-interesting ICE, caused by inline-asm. The test-case escapes
from the frontend checking.
I just report here for any future improvement.
$ cat /tmp/test-f03a27.c
# 1 "<built-in>"
# 1 "test.c"
int a;
long b;
int main() { asm("" : "=a"(a), "=d"(b) : "1"(__builtin_nanf(0))); }
$ cat /tmp/test-f03a27.sh
# Crash reproducer for clang version 13.0.0
(https://github.com/llvm/llvm-project.git
b006902b2dfac792e8ade73798ca1b216654faf7)
# Driver args: "-c" "-o" "/tmp/a.out" "-x" "c" "test.c"
# Original command: "/data/xxx/git/llvm-project/build_trunk/bin/clang-13"
"-cc1" "-triple" "x86_64-unknown-linux-gnu" "-emit-obj" "-mrelax-all"
"--mrelax-relocations" "-disable-free" "-main-file-name" "test.c"
"-mrelocation-model" "static" "-mframe-pointer=all" "-fmath-errno"
"-fno-rounding-math" "-mconstructor-aliases" "-munwind-tables" "-target-cpu"
"x86-64" "-tune-cpu" "generic" "-fno-split-dwarf-inlining"
"-debugger-tuning=gdb" "-resource-dir"
"/data/xxx/git/llvm-project/build_trunk/lib/clang/13.0.0" "-internal-isystem"
"/usr/local/include" "-internal-isystem"
"/data/xxx/git/llvm-project/build_trunk/lib/clang/13.0.0/include"
"-internal-externc-isystem" "/usr/include/x86_64-linux-gnu"
"-internal-externc-isystem" "/include" "-internal-externc-isystem"
"/usr/include" "-fdebug-compilation-dir=/home/xxx/data/docker_share/clang"
"-ferror-limit" "19" "-fgnuc-version=4.2.1" "-fcolor-diagnostics" "-faddrsig"
"-o" "/tmp/a.out" "-x" "c" "test.c"
"/data/xxx/git/llvm-project/build_trunk/bin/clang-13" "-cc1" "-triple"
"x86_64-unknown-linux-gnu" "-emit-obj" "-mrelax-all" "--mrelax-relocations"
"-disable-free" "-main-file-name" "test.c" "-mrelocation-model" "static"
"-mframe-pointer=all" "-fmath-errno" "-fno-rounding-math"
"-mconstructor-aliases" "-munwind-tables" "-target-cpu" "x86-64" "-tune-cpu"
"generic" "-fno-split-dwarf-inlining" "-debugger-tuning=gdb"
"-fdebug-compilation-dir=/home/xxx/data/docker_share/clang" "-ferror-limit"
"19" "-fgnuc-version=4.2.1" "-fcolor-diagnostics" "-faddrsig" "-x" "c"
"test-f03a27.c"
$ /data/xxx/git/llvm-project/build_trunk/bin/clang -c -o /tmp/a.out -x c test.c
clang: /home/xxx/data/git/llvm-project/llvm/lib/IR/Instructions.cpp:2946:
static llvm::CastInst *llvm::CastInst::Create(Instruction::CastOps, llvm::Value
*, llvm::Type *, const llvm::Twine &, llvm::Instruction *): Assertion
`castIsValid(op, S, Ty) && "Invalid cast!"' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash
backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /data/xxx/git/llvm-project/build_trunk/bin/clang -c
-o /tmp/a.out -x c test.c
1. <eof> parser at end of file
2. test.c:3:5: LLVM IR generation of declaration 'main'
3. test.c:3:5: Generating code for declaration 'main'
#0 0x0000000000dfd0a1 __interceptor_backtrace.part.117
asan_interceptors.cc.o:0:0
#1 0x000000000d7fb43a llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
/home/xxx/data/git/llvm-project/llvm/lib/Support/Unix/Signals.inc:561:7
#2 0x000000000d7f1bc1 llvm::sys::RunSignalHandlers()
/home/xxx/data/git/llvm-project/llvm/lib/Support/Signals.cpp:72:18
#3 0x000000000d7f805f llvm::sys::CleanupOnSignal(unsigned long)
/home/xxx/data/git/llvm-project/llvm/lib/Support/Unix/Signals.inc:0:3
#4 0x000000000d504245 (anonymous
namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long)
/home/xxx/data/git/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:75:5
#5 0x000000000d504d0c CrashRecoverySignalHandler(int)
/home/xxx/data/git/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:389:1
#6 0x00007f59f4f278a0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x128a0)
#7 0x00007f59f494af47 raise
/build/glibc-2ORdQG/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
#8 0x00007f59f494c8b1 abort /build/glibc-2ORdQG/glibc-2.27/stdlib/abort.c:81:0
#9 0x00007f59f493c42a __assert_fail_base
/build/glibc-2ORdQG/glibc-2.27/assert/assert.c:89:0
#10 0x00007f59f493c4a2 (/lib/x86_64-linux-gnu/libc.so.6+0x304a2)
#11 0x000000000aa8e5ef llvm::CastInst::Create(llvm::Instruction::CastOps,
llvm::Value*, llvm::Type*, llvm::Twine const&, llvm::Instruction*)
/home/xxx/data/git/llvm-project/llvm/lib/IR/Instructions.cpp:2962:12
#12 0x00000000015f2847 llvm::CastInst*
llvm::IRBuilderBase::Insert<llvm::CastInst>(llvm::CastInst*, llvm::Twine
const&) const
/home/xxx/data/git/llvm-project/llvm/include/llvm/IR/IRBuilder.h:0:0
#13 0x00000000015f2847
llvm::IRBuilderBase::CreateCast(llvm::Instruction::CastOps, llvm::Value*,
llvm::Type*, llvm::Twine const&)
/home/xxx/data/git/llvm-project/llvm/include/llvm/IR/IRBuilder.h:2064:0
#14 0x000000000e89f1a2
clang::CodeGen::CodeGenFunction::EmitAsmStmt(clang::AsmStmt const&)
/home/xxx/data/git/llvm-project/clang/lib/CodeGen/CGStmt.cpp:2415:15
#15 0x000000000e87e69f clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt
const*, llvm::ArrayRef<clang::Attr const*>)
/home/xxx/data/git/llvm-project/clang/lib/CodeGen/CGStmt.cpp:154:32
#16 0x000000000e8ad262
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot)
/home/xxx/data/git/llvm-project/clang/lib/CodeGen/CGStmt.cpp:479:7
#17 0x000000000eac34d5
clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*)
/home/xxx/data/git/llvm-project/clang/lib/CodeGen/CodeGenFunction.cpp:1184:5
#18 0x000000000eac6f54
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&)
/home/xxx/data/git/llvm-project/clang/lib/CodeGen/CodeGenFunction.cpp:1364:7
#19 0x000000000eb82ddc
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*)
/home/xxx/data/git/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:4697:3
#20 0x000000000eb5961e
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*)
/home/xxx/data/git/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:0:12
#21 0x000000000eb704e4
clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl)
/home/xxx/data/git/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:2844:5
#22 0x000000000eb91c22
clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*)
/home/xxx/data/git/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:5515:5
#23 0x0000000012d1d30c (anonymous
namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef)
/home/xxx/data/git/llvm-project/clang/lib/CodeGen/ModuleBuilder.cpp:169:35
#24 0x0000000012d0c741
clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef)
/home/xxx/data/git/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:220:11
#25 0x00000000183047b2 clang::ParseAST(clang::Sema&, bool, bool)
/home/xxx/data/git/llvm-project/clang/lib/Parse/ParseAST.cpp:162:11
#26 0x00000000105c90c3 clang::ASTFrontendAction::ExecuteAction()
/home/xxx/data/git/llvm-project/clang/lib/Frontend/FrontendAction.cpp:1058:1
#27 0x0000000012cff7d9 clang::CodeGenAction::ExecuteAction()
/home/xxx/data/git/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:1082:30
#28 0x00000000105c5efd clang::FrontendAction::Execute()
/home/xxx/data/git/llvm-project/clang/lib/Frontend/FrontendAction.cpp:0:8
#29 0x0000000010394e0a llvm::Error::operator bool()
/home/xxx/data/git/llvm-project/llvm/include/llvm/Support/Error.h:0:0
#30 0x0000000010394e0a
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
/home/xxx/data/git/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:949:0
#31 0x0000000010ac5a2e
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
/home/xxx/data/git/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:278:25
#32 0x0000000000e9b85d cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) /home/xxx/data/git/llvm-project/clang/tools/driver/cc1_main.cpp:246:15
#33 0x0000000000e82e17 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
/home/xxx/data/git/llvm-project/clang/tools/driver/driver.cpp:330:12
#34 0x000000000ff0a39d
clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
>, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >*, bool*) const::$_1::operator()() const
/home/xxx/data/git/llvm-project/clang/lib/Driver/Job.cpp:404:30
#35 0x000000000ff0a39d void llvm::function_ref<void
()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
>, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >*, bool*) const::$_1>(long)
/home/xxx/data/git/llvm-project/llvm/include/llvm/ADT/STLExtras.h:185:0
#36 0x000000000d503de4 llvm::function_ref<void ()>::operator()() const
/home/xxx/data/git/llvm-project/llvm/include/llvm/ADT/STLExtras.h:209:12
#37 0x000000000d503de4
llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>)
/home/xxx/data/git/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:424:0
#38 0x000000000ff08be2
clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
>, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >*, bool*) const
/home/xxx/data/git/llvm-project/clang/lib/Driver/Job.cpp:404:7
#39 0x000000000fdfc32e
clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&,
clang::driver::Command const*&) const
/home/xxx/data/git/llvm-project/clang/lib/Driver/Compilation.cpp:195:15
#40 0x000000000fdfcf7c
clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const
/home/xxx/data/git/llvm-project/clang/lib/Driver/Compilation.cpp:248:19
#41 0x000000000fe6126a llvm::SmallVectorBase<unsigned int>::empty() const
/home/xxx/data/git/llvm-project/llvm/include/llvm/ADT/SmallVector.h:0:0
#42 0x000000000fe6126a
clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&)
/home/xxx/data/git/llvm-project/clang/lib/Driver/Driver.cpp:1529:0
#43 0x0000000000e7fd4f main
/home/xxx/data/git/llvm-project/clang/tools/driver/driver.cpp:502:21
#44 0x00007f59f492db97 __libc_start_main
/build/glibc-2ORdQG/glibc-2.27/csu/../csu/libc-start.c:344:0
#45 0x0000000000d7aada _start
(/data/xxx/git/llvm-project/build_trunk/bin/clang+0xd7aada)
clang-13: error: clang frontend command failed with exit code 134 (use -v to
see invocation)
clang version 13.0.0 (https://github.com/llvm/llvm-project.git
b006902b2dfac792e8ade73798ca1b216654faf7)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /data/xxx/git/llvm-project/build_trunk/bin
clang-13: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-13: note: diagnostic msg: /tmp/test-f03a27.c
clang-13: note: diagnostic msg: /tmp/test-f03a27.sh
clang-13: note: diagnostic msg:
********************
--
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/20210219/83ca370b/attachment-0001.html>
More information about the llvm-bugs
mailing list