[llvm-bugs] [Bug 43928] New: Clang 8.0 crashes during compilation

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Nov 7 04:01:20 PST 2019


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

            Bug ID: 43928
           Summary: Clang 8.0 crashes during compilation
           Product: clang
           Version: 8.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: aaron.pohle at gmail.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

Created attachment 22782
  --> https://bugs.llvm.org/attachment.cgi?id=22782&action=edit
Preprocessed source(s) and associated run script(s)

During the compilation of the following Code clash 8.0 crashes:
#include <cstdint>

template<typename type, typename unitenum, unitenum DefaultUnit>
class CommonUnit
{
public:
   typedef unitenum eUnit;
   typedef type DataType;

   template<typename settype>
   inline void set(settype Value = 0, unitenum theUnit = DefaultUnit)
   {
      m_Value = static_cast<type>(Value * static_cast<settype>(theUnit));
   }

private:
   type m_Value;

};

enum eSpeedUnit
{
   CentimetersPerSecond = 1,
};

typedef CommonUnit<int32_t, eSpeedUnit, CentimetersPerSecond> Speed;

template<>
template<typename settype>
inline void Speed::set(settype Value, eSpeedUnit theUnit)
{
}

int main(void)
{
    Speed s;
    s.set(1);
}

$ clang++-8 main.cpp 
Stack dump:
0.      Program arguments: /usr/lib/llvm-8/bin/clang -cc1 -triple
x86_64-pc-linux-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier
-discard-value-names -main-file-name main.cpp -mrelocation-model static
-mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose
-mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64
-dwarf-column-info -debugger-tuning=gdb -resource-dir
/usr/lib/llvm-8/lib/clang/8.0.0 -internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/x86_64-linux-gnu/c++/7.4.0
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/x86_64-linux-gnu/c++/7.4.0
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0/backward
-internal-isystem /usr/include/clang/8.0.0/include/ -internal-isystem
/usr/local/include -internal-isystem /usr/lib/llvm-8/lib/clang/8.0.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-fdeprecated-macro -fdebug-compilation-dir /home/aaron/src/test/DEFECT-45956/v2
-ferror-limit 19 -fmessage-length 244 -fobjc-runtime=gcc -fcxx-exceptions
-fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o
/tmp/main-2af4bd.o -x c++ main.cpp -faddrsig 
1.      <eof> parser at end of file
2.      main.cpp:35:5: LLVM IR generation of declaration 'main'
3.      main.cpp:35:5: Generating code for declaration 'main'
 #0 0x00007f55c9ed34bf llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/lib/x86_64-linux-gnu/libLLVM-8.so.1+0x9724bf)
 #1 0x00007f55c9ed1910 llvm::sys::RunSignalHandlers()
(/usr/lib/x86_64-linux-gnu/libLLVM-8.so.1+0x970910)
 #2 0x00007f55c9ed38c8 (/usr/lib/x86_64-linux-gnu/libLLVM-8.so.1+0x9728c8)
 #3 0x00007f55cd1c0890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
 #4 0x00000000009489e9 (/usr/lib/llvm-8/bin/clang+0x9489e9)
 #5 0x00000000008b5236
clang::CodeGen::CodeGenFunction::EmitLoadOfLValue(clang::CodeGen::LValue,
clang::SourceLocation) (/usr/lib/llvm-8/bin/clang+0x8b5236)
 #6 0x00000000008dfd42 (/usr/lib/llvm-8/bin/clang+0x8dfd42)
 #7 0x00000000008dfe28 (/usr/lib/llvm-8/bin/clang+0x8dfe28)
 #8 0x00000000008d7d8f
clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool)
(/usr/lib/llvm-8/bin/clang+0x8d7d8f)
 #9 0x00000000008a5e06 clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr
const*, clang::CodeGen::AggValueSlot, bool)
(/usr/lib/llvm-8/bin/clang+0x8a5e06)
#10 0x00000000008a667d
clang::CodeGen::CodeGenFunction::EmitAnyExprToTemp(clang::Expr const*)
(/usr/lib/llvm-8/bin/clang+0x8a667d)
#11 0x0000000000874b60
clang::CodeGen::CodeGenFunction::EmitCallArg(clang::CodeGen::CallArgList&,
clang::Expr const*, clang::QualType) (/usr/lib/llvm-8/bin/clang+0x874b60)
#12 0x0000000000873eef
clang::CodeGen::CodeGenFunction::EmitCallArgs(clang::CodeGen::CallArgList&,
llvm::ArrayRef<clang::QualType>,
llvm::iterator_range<clang::Stmt::ConstExprIterator>,
clang::CodeGen::CodeGenFunction::AbstractCallee, unsigned int,
clang::CodeGen::CodeGenFunction::EvaluationOrder)
(/usr/lib/llvm-8/bin/clang+0x873eef)
#13 0x00000000007e0c11 (/usr/lib/llvm-8/bin/clang+0x7e0c11)
#14 0x00000000008c7c07 (/usr/lib/llvm-8/bin/clang+0x8c7c07)
#15 0x00000000008c7832
clang::CodeGen::CodeGenFunction::EmitCXXMemberOrOperatorCall(clang::CXXMethodDecl
const*, clang::CodeGen::CGCallee const&, clang::CodeGen::ReturnValueSlot,
llvm::Value*, llvm::Value*, clang::QualType, clang::CallExpr const*,
clang::CodeGen::CallArgList*) (/usr/lib/llvm-8/bin/clang+0x8c7832)
#16 0x00000000008c9a79
clang::CodeGen::CodeGenFunction::EmitCXXMemberOrOperatorMemberCallExpr(clang::CallExpr
const*, clang::CXXMethodDecl const*, clang::CodeGen::ReturnValueSlot, bool,
clang::NestedNameSpecifier*, bool, clang::Expr const*)
(/usr/lib/llvm-8/bin/clang+0x8c9a79)
#17 0x00000000008c804f
clang::CodeGen::CodeGenFunction::EmitCXXMemberCallExpr(clang::CXXMemberCallExpr
const*, clang::CodeGen::ReturnValueSlot) (/usr/lib/llvm-8/bin/clang+0x8c804f)
#18 0x00000000008bc56f
clang::CodeGen::CodeGenFunction::EmitCallExpr(clang::CallExpr const*,
clang::CodeGen::ReturnValueSlot) (/usr/lib/llvm-8/bin/clang+0x8bc56f)
#19 0x00000000008e626f (/usr/lib/llvm-8/bin/clang+0x8e626f)
#20 0x00000000008d7d8f
clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool)
(/usr/lib/llvm-8/bin/clang+0x8d7d8f)
#21 0x00000000008a5e06 clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr
const*, clang::CodeGen::AggValueSlot, bool)
(/usr/lib/llvm-8/bin/clang+0x8a5e06)
#22 0x00000000008a5d59
clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(clang::Expr const*)
(/usr/lib/llvm-8/bin/clang+0x8a5d59)
#23 0x00000000007134c2 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt
const*, llvm::ArrayRef<clang::Attr const*>)
(/usr/lib/llvm-8/bin/clang+0x7134c2)
#24 0x000000000071c4d0
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot)
(/usr/lib/llvm-8/bin/clang+0x71c4d0)
#25 0x0000000000755f3e
clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*)
(/usr/lib/llvm-8/bin/clang+0x755f3e)
#26 0x00000000007567bf
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&)
(/usr/lib/llvm-8/bin/clang+0x7567bf)
#27 0x000000000076d032
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (/usr/lib/llvm-8/bin/clang+0x76d032)
#28 0x000000000076782b
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (/usr/lib/llvm-8/bin/clang+0x76782b)
#29 0x000000000076f682
clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*)
(/usr/lib/llvm-8/bin/clang+0x76f682)
#30 0x0000000000d5ab2f (/usr/lib/llvm-8/bin/clang+0xd5ab2f)
#31 0x0000000000d585a2 (/usr/lib/llvm-8/bin/clang+0xd585a2)
#32 0x00000000011df363 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/lib/llvm-8/bin/clang+0x11df363)
#33 0x0000000000addfcf clang::FrontendAction::Execute()
(/usr/lib/llvm-8/bin/clang+0xaddfcf)
#34 0x0000000000a9bb18
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/lib/llvm-8/bin/clang+0xa9bb18)
#35 0x0000000000b644c6
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/lib/llvm-8/bin/clang+0xb644c6)
#36 0x00000000006a32e7 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/lib/llvm-8/bin/clang+0x6a32e7)
#37 0x00000000006a17d6 main (/usr/lib/llvm-8/bin/clang+0x6a17d6)
#38 0x00007f55c8852b97 __libc_start_main
/build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
#39 0x000000000069eeca _start (/usr/lib/llvm-8/bin/clang+0x69eeca)
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 8.0.0-3~ubuntu18.04.1 (tags/RELEASE_800/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang: note: diagnostic msg: PLEASE submit a bug report to
https://bugs.llvm.org/ and include the crash backtrace, preprocessed source,
and associated run script.
clang: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/main-ba60e7.cpp
clang: note: diagnostic msg: /tmp/main-ba60e7.sh
clang: 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/20191107/c3c54171/attachment-0001.html>


More information about the llvm-bugs mailing list