[llvm-bugs] [Bug 46268] New: Comparison against fixed-point type leads to crash
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Jun 10 04:02:29 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=46268
Bug ID: 46268
Summary: Comparison against fixed-point type leads to crash
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: andrew.jones at vector.com
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
neeilans at live.com, richard-llvm at metafoo.co.uk
For the following file:
```
void foo(void) {
_Accum x = 0.5k;
if (x == 0.5) {
}
}
```
This build of clang:
```
$ clang --version
clang version 11.0.0 (git at github.com:llvm/llvm-project.git
0ee47cc92f510e4f21b584dc265105f4d51776a0)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/LOCAL/avj/iwyu/root/bin
```
(HEAD as of the time of writing)
Leads to this crash when compiling with `-ffixed-point`:
```
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: clang -ffixed-point -c moo.c
1. <eof> parser at end of file
2. moo.c:2:6: LLVM IR generation of declaration 'foo'
3. moo.c:2:6: Generating code for declaration 'foo'
#0 0x000000000252f58a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/home/LOCAL/avj/iwyu/src/llvm-project/llvm/build/../lib/Support/Unix/Signals.inc:568:3
#1 0x000000000252d594 llvm::sys::RunSignalHandlers()
/home/LOCAL/avj/iwyu/src/llvm-project/llvm/build/../lib/Support/Signals.cpp:68:20
#2 0x000000000252dd59 llvm::sys::CleanupOnSignal(unsigned long)
/home/LOCAL/avj/iwyu/src/llvm-project/llvm/build/../lib/Support/Unix/Signals.inc:361:31
#3 0x00000000024bced8 HandleCrash
/home/LOCAL/avj/iwyu/src/llvm-project/llvm/build/../lib/Support/CrashRecoveryContext.cpp:75:27
#4 0x00000000024bced8 CrashRecoverySignalHandler(int)
/home/LOCAL/avj/iwyu/src/llvm-project/llvm/build/../lib/Support/CrashRecoveryContext.cpp:382:62
#5 0x00007f45d49b05f0 __restore_rt (/lib64/libpthread.so.0+0xf5f0)
#6 0x0000000001f3c104 llvm::PointerType::get(llvm::Type*, unsigned int)
/home/LOCAL/avj/iwyu/src/llvm-project/llvm/build/../lib/IR/Type.cpp:661:48
#7 0x0000000002a1c998 llvm::GetElementPtrInst::getGEPReturnType(llvm::Type*,
llvm::Value*, llvm::ArrayRef<llvm::Value*>)
/home/LOCAL/avj/iwyu/src/llvm-project/llvm/include/llvm/IR/Instructions.h:1020:44
#8 0x0000000002a1c998 llvm::GetElementPtrInst::GetElementPtrInst(llvm::Type*,
llvm::Value*, llvm::ArrayRef<llvm::Value*>, unsigned int, llvm::Twine const&,
llvm::Instruction*)
/home/LOCAL/avj/iwyu/src/llvm-project/llvm/include/llvm/IR/Instructions.h:1090:61
#9 0x0000000002a1c998 llvm::GetElementPtrInst::Create(llvm::Type*,
llvm::Value*, llvm::ArrayRef<llvm::Value*>, llvm::Twine const&,
llvm::Instruction*)
/home/LOCAL/avj/iwyu/src/llvm-project/llvm/include/llvm/IR/Instructions.h:886:64
#10 0x0000000002a1c998 llvm::GetElementPtrInst::CreateInBounds(llvm::Type*,
llvm::Value*, llvm::ArrayRef<llvm::Value*>, llvm::Twine const&,
llvm::Instruction*)
/home/LOCAL/avj/iwyu/src/llvm-project/llvm/include/llvm/IR/Instructions.h:919:15
#11 0x0000000002a1c998
llvm::IRBuilderBase::CreateConstInBoundsGEP2_32(llvm::Type*, llvm::Value*,
unsigned int, unsigned int, llvm::Twine const&)
/home/LOCAL/avj/iwyu/src/llvm-project/llvm/include/llvm/IR/IRBuilder.h:1856:18
#12 0x0000000002a1c998 llvm::IRBuilderBase::CreateStructGEP(llvm::Type*,
llvm::Value*, unsigned int, llvm::Twine const&)
/home/LOCAL/avj/iwyu/src/llvm-project/llvm/include/llvm/IR/IRBuilder.h:1926:38
#13 0x0000000002a1c998
clang::CodeGen::CGBuilderTy::CreateStructGEP(clang::CodeGen::Address, unsigned
int, llvm::Twine const&)
/home/LOCAL/avj/iwyu/src/llvm-project/clang/lib/CodeGen/CGBuilder.h:180:12
#14 0x0000000002a1c998
clang::CodeGen::CodeGenFunction::emitAddrOfRealComponent(clang::CodeGen::Address,
clang::QualType)
/home/LOCAL/avj/iwyu/src/llvm-project/clang/lib/CodeGen/CGExprComplex.cpp:336:68
#15 0x0000000002a1d3af clang::CodeGen::Address::getName() const
/home/LOCAL/avj/iwyu/src/llvm-project/clang/lib/CodeGen/Address.h:62:34
#16 0x0000000002a1d3af (anonymous
namespace)::ComplexExprEmitter::EmitLoadOfLValue(clang::CodeGen::LValue,
clang::SourceLocation)
/home/LOCAL/avj/iwyu/src/llvm-project/clang/lib/CodeGen/CGExprComplex.cpp:359:65
#17 0x0000000002a20612 EmitLoadOfLValue
/home/LOCAL/avj/iwyu/src/llvm-project/clang/lib/CodeGen/CGExprComplex.cpp:74:63
#18 0x0000000002a20612 VisitDeclRefExpr
/home/LOCAL/avj/iwyu/src/llvm-project/clang/lib/CodeGen/CGExprComplex.cpp:142:30
#19 0x0000000002a20612 clang::StmtVisitorBase<std::add_pointer, (anonymous
namespace)::ComplexExprEmitter, std::pair<llvm::Value*, llvm::Value*>
>::Visit(clang::Stmt*)
/home/LOCAL/avj/iwyu/src/llvm-project/llvm/build/tools/clang/include/clang/AST/StmtNodes.inc:979:1
#20 0x0000000002a21a51 Visit
/home/LOCAL/avj/iwyu/src/llvm-project/clang/lib/CodeGen/CGExprComplex.cpp:95:33
#21 0x0000000002a21a51 (anonymous
namespace)::ComplexExprEmitter::EmitCast(clang::CastKind, clang::Expr*,
clang::QualType)
/home/LOCAL/avj/iwyu/src/llvm-project/clang/lib/CodeGen/CGExprComplex.cpp:465:20
#22 0x0000000002a1f198 VisitImplicitCastExpr
/home/LOCAL/avj/iwyu/src/llvm-project/clang/lib/CodeGen/CGExprComplex.cpp:176:68
#23 0x0000000002a1f198 clang::StmtVisitorBase<std::add_pointer, (anonymous
namespace)::ComplexExprEmitter, std::pair<llvm::Value*, llvm::Value*>
>::Visit(clang::Stmt*)
/home/LOCAL/avj/iwyu/src/llvm-project/llvm/build/tools/clang/include/clang/AST/StmtNodes.inc:919:1
#24 0x0000000002a21479 Visit
/home/LOCAL/avj/iwyu/src/llvm-project/clang/lib/CodeGen/CGExprComplex.cpp:95:33
#25 0x0000000002a21479 (anonymous
namespace)::ComplexExprEmitter::EmitCast(clang::CastKind, clang::Expr*,
clang::QualType)
/home/LOCAL/avj/iwyu/src/llvm-project/clang/lib/CodeGen/CGExprComplex.cpp:543:53
#26 0x0000000002a1f198 VisitImplicitCastExpr
/home/LOCAL/avj/iwyu/src/llvm-project/clang/lib/CodeGen/CGExprComplex.cpp:176:68
#27 0x0000000002a1f198 clang::StmtVisitorBase<std::add_pointer, (anonymous
namespace)::ComplexExprEmitter, std::pair<llvm::Value*, llvm::Value*>
>::Visit(clang::Stmt*)
/home/LOCAL/avj/iwyu/src/llvm-project/llvm/build/tools/clang/include/clang/AST/StmtNodes.inc:919:1
#28 0x0000000002a20ab2 Visit
/home/LOCAL/avj/iwyu/src/llvm-project/clang/lib/CodeGen/CGExprComplex.cpp:95:33
#29 0x0000000002a20ab2
clang::CodeGen::CodeGenFunction::EmitComplexExpr(clang::Expr const*, bool,
bool)
/home/LOCAL/avj/iwyu/src/llvm-project/clang/lib/CodeGen/CGExprComplex.cpp:1115:35
#30 0x0000000002a36b0e (anonymous
namespace)::ScalarExprEmitter::EmitCompare(clang::BinaryOperator const*,
llvm::CmpInst::Predicate, llvm::CmpInst::Predicate, llvm::CmpInst::Predicate,
bool)
/home/LOCAL/avj/iwyu/src/llvm-project/clang/lib/CodeGen/CGExprScalar.cpp:4120:44
#31 0x0000000002a2f24c VisitBinEQ
/home/LOCAL/avj/iwyu/src/llvm-project/clang/lib/CodeGen/CGExprScalar.cpp:848:3
#32 0x0000000002a2f24c clang::StmtVisitorBase<std::add_pointer, (anonymous
namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*)
/home/LOCAL/avj/iwyu/src/llvm-project/clang/include/clang/AST/StmtVisitor.h:63:26
#33 0x0000000002a344cf Visit
/home/LOCAL/avj/iwyu/src/llvm-project/clang/lib/CodeGen/CGExprScalar.cpp:428:33
#34 0x0000000002a344cf
clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool)
/home/LOCAL/avj/iwyu/src/llvm-project/clang/lib/CodeGen/CGExprScalar.cpp:4723:13
#35 0x00000000029f1d84
clang::CodeGen::CodeGenFunction::EvaluateExprAsBool(clang::Expr const*)
/home/LOCAL/avj/iwyu/src/llvm-project/clang/lib/CodeGen/CGExpr.cpp:186:32
#36 0x00000000027fce9c
clang::CodeGen::CodeGenFunction::EmitBranchOnBoolExpr(clang::Expr const*,
llvm::BasicBlock*, llvm::BasicBlock*, unsigned long) (.localalias.913)
/home/LOCAL/avj/iwyu/src/llvm-project/clang/lib/CodeGen/CodeGenFunction.cpp:1618:38
#37 0x00000000027be010
clang::CodeGen::CodeGenFunction::EmitIfStmt(clang::IfStmt const&)
/home/LOCAL/avj/iwyu/src/llvm-project/clang/lib/CodeGen/CGStmt.cpp:702:12
#38 0x00000000027bd727 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt
const*, llvm::ArrayRef<clang::Attr const*>)
/home/LOCAL/avj/iwyu/src/llvm-project/clang/lib/CodeGen/CGStmt.cpp:143:75
#39 0x00000000027bd86c
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot)
/home/LOCAL/avj/iwyu/src/llvm-project/clang/lib/CodeGen/CGStmt.cpp:453:15
#40 0x00000000027fcc66
clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*)
/home/LOCAL/avj/iwyu/src/llvm-project/clang/lib/CodeGen/CodeGenFunction.cpp:1108:1
#41 0x0000000002805a76 clang::CodeGen::CodeGenFunction::getLangOpts() const
/home/LOCAL/avj/iwyu/src/llvm-project/clang/lib/CodeGen/CodeGenFunction.h:1779:67
#42 0x0000000002805a76
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&)
/home/LOCAL/avj/iwyu/src/llvm-project/clang/lib/CodeGen/CodeGenFunction.cpp:1280:19
#43 0x0000000002841611
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*)
/home/LOCAL/avj/iwyu/src/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:4531:3
#44 0x000000000283f435
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*)
/home/LOCAL/avj/iwyu/src/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:2898:47
#45 0x000000000283f8c3
clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl)
/home/LOCAL/avj/iwyu/src/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:2651:5
#46 0x0000000002844b47
clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (.part.5270)
/home/LOCAL/avj/iwyu/src/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:5340:37
#47 0x00000000031e6191 (anonymous
namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef)
/home/LOCAL/avj/iwyu/src/llvm-project/clang/lib/CodeGen/ModuleBuilder.cpp:170:34
#48 0x00000000031dc92c
clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef)
/home/LOCAL/avj/iwyu/src/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:216:7
#49 0x0000000003b98fe4 clang::ParseAST(clang::Sema&, bool, bool)
/home/LOCAL/avj/iwyu/src/llvm-project/clang/lib/Parse/ParseAST.cpp:162:17
#50 0x0000000002c6cdf1 clang::FrontendAction::Execute()
/home/LOCAL/avj/iwyu/src/llvm-project/clang/lib/Frontend/FrontendAction.cpp:953:21
#51 0x0000000002c32e8b llvm::Error::operator bool()
/home/LOCAL/avj/iwyu/src/llvm-project/llvm/include/llvm/Support/Error.h:236:22
#52 0x0000000002c32e8b
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
/home/LOCAL/avj/iwyu/src/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:973:42
#53 0x0000000002d24c23
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
/home/LOCAL/avj/iwyu/src/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:283:43
#54 0x0000000000990292 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*)
/home/LOCAL/avj/iwyu/src/llvm-project/clang/tools/driver/cc1_main.cpp:240:40
#55 0x000000000098d84b ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
/home/LOCAL/avj/iwyu/src/llvm-project/clang/tools/driver/driver.cpp:330:20
#56 0x0000000002b2a075 operator()
/home/LOCAL/avj/iwyu/src/llvm-project/clang/lib/Driver/Job.cpp:417:32
#57 0x0000000002b2a075 void llvm::function_ref<void
()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
>, std::string*, bool*) const::'lambda'()>(long)
/home/LOCAL/avj/iwyu/src/llvm-project/llvm/include/llvm/ADT/STLExtras.h:185:52
#58 0x00000000024bcfd3
llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>)
/home/LOCAL/avj/iwyu/src/llvm-project/llvm/build/../lib/Support/CrashRecoveryContext.cpp:420:1
#59 0x0000000002b2ad7b
clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
>, std::string*, bool*) const (.part.157)
/home/LOCAL/avj/iwyu/src/llvm-project/clang/lib/Driver/Job.cpp:421:10
#60 0x0000000002b08958
clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&,
clang::driver::Command const*&) const
/home/LOCAL/avj/iwyu/src/llvm-project/clang/lib/Driver/Compilation.cpp:195:22
#61 0x0000000002b09113
clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const
/home/LOCAL/avj/iwyu/src/llvm-project/clang/lib/Driver/Compilation.cpp:246:5
#62 0x0000000002b10eba
clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&)
/home/LOCAL/avj/iwyu/src/llvm-project/clang/lib/Driver/Driver.cpp:1483:28
#63 0x00000000008ef498 main
/home/LOCAL/avj/iwyu/src/llvm-project/clang/tools/driver/driver.cpp:502:39
#64 0x00007f45d358a505 __libc_start_main (/lib64/libc.so.6+0x22505)
#65 0x000000000098d3c5 _start (/home/LOCAL/avj/iwyu/root/bin/clang-11+0x98d3c5)
clang-11: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 11.0.0 (git at github.com:llvm/llvm-project.git
0ee47cc92f510e4f21b584dc265105f4d51776a0)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/LOCAL/avj/iwyu/root/bin
clang-11: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-11: note: diagnostic msg: /tmp/moo-bb3cb8.c
clang-11: note: diagnostic msg: /tmp/moo-bb3cb8.sh
clang-11: note: diagnostic msg:
********************
```
I will attach the requested files in subsequent comments.
--
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/20200610/a0337a85/attachment-0001.html>
More information about the llvm-bugs
mailing list