[llvm-bugs] [Bug 44624] New: Cast from _Complex int to _Complex double causes crash

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jan 22 08:13:40 PST 2020


https://bugs.llvm.org/show_bug.cgi?id=44624

            Bug ID: 44624
           Summary: Cast from _Complex int to _Complex double causes crash
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: bevin.hansson at ericsson.com
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

The code:

  _Complex int a;
  void fn1() { (_Complex double) a; }

causes a crash in Clang. This can be reproduced all the way to Clang 3.0.

Godbolt: https://godbolt.org/z/rajvzs

Stack dump:
0.      Program arguments: /opt/compiler-explorer/clang-trunk/bin/clang -g -o
./output.s -mllvm --x86-asm-syntax=intel -S
--gcc-toolchain=/opt/compiler-explorer/gcc-9.2.0 -fcolor-diagnostics
-fno-crash-diagnostics <source> 
1.      <eof> parser at end of file
2.      <source>:2:6: LLVM IR generation of declaration 'fn1'
3.      <source>:2:6: Generating code for declaration 'fn1'
 #0 0x00005638efe2ef1a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/opt/compiler-explorer/clang-trunk/bin/clang+0x2883f1a)
 #1 0x00005638efe2caf4 llvm::sys::RunSignalHandlers()
(/opt/compiler-explorer/clang-trunk/bin/clang+0x2881af4)
 #2 0x00005638efe2cd65 llvm::sys::CleanupOnSignal(unsigned long)
(/opt/compiler-explorer/clang-trunk/bin/clang+0x2881d65)
 #3 0x00005638efda9cc4 (anonymous
namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long)
(/opt/compiler-explorer/clang-trunk/bin/clang+0x27fecc4)
 #4 0x00005638efdaa1e4 CrashRecoverySignalHandler(int)
(/opt/compiler-explorer/clang-trunk/bin/clang+0x27ff1e4)
 #5 0x00007f47d942b890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
 #6 0x00005638f0325818 (anonymous
namespace)::ScalarExprEmitter::EmitScalarConversion(llvm::Value*,
clang::QualType, clang::QualType, clang::SourceLocation, (anonymous
namespace)::ScalarExprEmitter::ScalarConversionOpts)
(/opt/compiler-explorer/clang-trunk/bin/clang+0x2d7a818)
 #7 0x00005638f0327a36
clang::CodeGen::CodeGenFunction::EmitScalarConversion(llvm::Value*,
clang::QualType, clang::QualType, clang::SourceLocation)
(/opt/compiler-explorer/clang-trunk/bin/clang+0x2d7ca36)
 #8 0x00005638f031b9da (anonymous
namespace)::ComplexExprEmitter::EmitCast(clang::CastKind, clang::Expr*,
clang::QualType) (/opt/compiler-explorer/clang-trunk/bin/clang+0x2d709da)
 #9 0x00005638f0319f4c (anonymous
namespace)::ComplexExprEmitter::Visit(clang::Expr*)
(/opt/compiler-explorer/clang-trunk/bin/clang+0x2d6ef4c)
#10 0x00005638f031b544
clang::CodeGen::CodeGenFunction::EmitComplexExpr(clang::Expr const*, bool,
bool) (/opt/compiler-explorer/clang-trunk/bin/clang+0x2d70544)
#11 0x00005638f02df831 clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr
const*, clang::CodeGen::AggValueSlot, bool)
(/opt/compiler-explorer/clang-trunk/bin/clang+0x2d34831)
#12 0x00005638f02f147e
clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(clang::Expr const*)
(/opt/compiler-explorer/clang-trunk/bin/clang+0x2d4647e)
#13 0x00005638f00a7de3 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt
const*, llvm::ArrayRef<clang::Attr const*>)
(/opt/compiler-explorer/clang-trunk/bin/clang+0x2afcde3)
#14 0x00005638f00a841c
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot)
(/opt/compiler-explorer/clang-trunk/bin/clang+0x2afd41c)
#15 0x00005638f00e8101
clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*)
(/opt/compiler-explorer/clang-trunk/bin/clang+0x2b3d101)
#16 0x00005638f00f141e
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&)
(/opt/compiler-explorer/clang-trunk/bin/clang+0x2b4641e)
#17 0x00005638f0131261
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (/opt/compiler-explorer/clang-trunk/bin/clang+0x2b86261)
#18 0x00005638f012ecd5
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (/opt/compiler-explorer/clang-trunk/bin/clang+0x2b83cd5)
#19 0x00005638f012f3a3
clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl)
(/opt/compiler-explorer/clang-trunk/bin/clang+0x2b843a3)
#20 0x00005638f01349f7
clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (.part.4744)
(/opt/compiler-explorer/clang-trunk/bin/clang+0x2b899f7)
#21 0x00005638f0b36491 (anonymous
namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef)
(/opt/compiler-explorer/clang-trunk/bin/clang+0x358b491)
#22 0x00005638f0b29ae6
clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef)
(/opt/compiler-explorer/clang-trunk/bin/clang+0x357eae6)
#23 0x00005638f1547e34 clang::ParseAST(clang::Sema&, bool, bool)
(/opt/compiler-explorer/clang-trunk/bin/clang+0x3f9ce34)
#24 0x00005638f0597f29 clang::FrontendAction::Execute()
(/opt/compiler-explorer/clang-trunk/bin/clang+0x2fecf29)
#25 0x00005638f05576ba
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/opt/compiler-explorer/clang-trunk/bin/clang+0x2fac6ba)
#26 0x00005638f066161b
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/opt/compiler-explorer/clang-trunk/bin/clang+0x30b661b)
#27 0x00005638ee1f5674 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/opt/compiler-explorer/clang-trunk/bin/clang+0xc4a674)
#28 0x00005638f0439fcb 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::'lambda'()>(long)
(/opt/compiler-explorer/clang-trunk/bin/clang+0x2e8efcb)
#29 0x00005638efdaa293
llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>)
(/opt/compiler-explorer/clang-trunk/bin/clang+0x27ff293)
#30 0x00005638f043ac30
clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
>, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >*, bool*) const
(/opt/compiler-explorer/clang-trunk/bin/clang+0x2e8fc30)
#31 0x00005638f0415025
clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&,
clang::driver::Command const*&) const
(/opt/compiler-explorer/clang-trunk/bin/clang+0x2e6a025)
#32 0x00005638f0415a81
clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const
(/opt/compiler-explorer/clang-trunk/bin/clang+0x2e6aa81)
#33 0x00005638f041e4e5
clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&)
(/opt/compiler-explorer/clang-trunk/bin/clang+0x2e734e5)
#34 0x00005638ee156884 main
(/opt/compiler-explorer/clang-trunk/bin/clang+0xbab884)
#35 0x00007f47d82e9b97 __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x21b97)
#36 0x00005638ee1f2a0a _start
(/opt/compiler-explorer/clang-trunk/bin/clang+0xc47a0a)
clang-11: error: clang frontend command failed due to signal (use -v to see
invocation)
Compiler returned: 254

-- 
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/20200122/6ece9e60/attachment-0001.html>


More information about the llvm-bugs mailing list