Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

UNREACHABLE executed: Non-canonical or dependent types aren't possible #35785

Open Quuxplusone opened 6 years ago

Quuxplusone commented 6 years ago
Bugzilla Link PR36812
Status NEW
Importance P normal
Reported by Ankur Dedev (ankur.dedev@tuta.io)
Reported on 2018-03-19 23:09:23 -0700
Last modified on 2018-03-20 10:03:36 -0700
Version trunk
Hardware PC Linux
CC dimitry@andric.com, llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also
Hi,

#0 0x0000000001a8e8cf llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/llvm/6.0.0/bin/clang-6.0+0x1a8e8cf)
#1 0x0000000001a8eb76 SignalHandler(int) (/home/llvm/6.0.0/bin/clang-
6.0+0x1a8eb76)
#2 0x00007f4c2c01f5e0 __restore_rt (/lib64/libpthread.so.0+0xf5e0)
#3 0x00000000016c61e0 llvm::Type::isIntegerTy(unsigned int) const
(/home/llvm/6.0.0/bin/clang-6.0+0x16c61e0)
#4 0x0000000001cabac8
clang::CodeGen::CodeGenTypes::ConvertType(clang::QualType)
(/home/llvm/6.0.0/bin/clang-6.0+0x1cabac8)
#5 0x0000000001cab810
clang::CodeGen::CodeGenTypes::ConvertTypeForMem(clang::QualType)
(/home/llvm/6.0.0/bin/clang-6.0+0x1cab810)
#6 0x0000000001c69f1c
clang::CodeGen::CodeGenModule::GetAddrOfGlobalVar(clang::VarDecl const*,
llvm::Type*, clang::CodeGen::ForDefinition_t) (/home/llvm/6.0.0/bin/clang-
6.0+0x1c69f1c)
#7 0x0000000001d5befb
clang::CodeGen::CodeGenFunction::EmitDeclRefLValue(clang::DeclRefExpr const*)
(/home/llvm/6.0.0/bin/clang-6.0+0x1d5befb)
#8 0x0000000001d527f0 clang::CodeGen::CodeGenFunction::EmitLValue(clang::Expr
const*) (/home/llvm/6.0.0/bin/clang-6.0+0x1d527f0)
#9 0x0000000001d59b1a
clang::CodeGen::CodeGenFunction::EmitCheckedLValue(clang::Expr const*,
clang::CodeGen::CodeGenFunction::TypeCheckKind) (/home/llvm/6.0.0/bin/clang-
6.0+0x1d59b1a)
#10 0x0000000001d85ae2 clang::StmtVisitorBase<clang::make_ptr, (anonymous
namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*)
(/home/llvm/6.0.0/bin/clang-6.0+0x1d85ae2)
#11 0x0000000001d80382
clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool)
(/home/llvm/6.0.0/bin/clang-6.0+0x1d80382)
#12 0x0000000001c19b79
clang::CodeGen::CodeGenFunction::EmitReturnStmt(clang::ReturnStmt const&)
(/home/llvm/6.0.0/bin/clang-6.0+0x1c19b79)
#13 0x0000000001c17692 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt
const*, llvm::ArrayRef<clang::Attr const*>) (/home/llvm/6.0.0/bin/clang-
6.0+0x1c17692)
#14 0x0000000001c1fa30
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot) (/home/llvm/6.0.0/bin/clang-
6.0+0x1c1fa30)
#15 0x0000000001c5629d
clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::CodeGen::FunctionArgList&,
clang::Stmt const*) (/home/llvm/6.0.0/bin/clang-6.0+0x1c5629d)
#16 0x0000000001c56ae0
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&)
(/home/llvm/6.0.0/bin/clang-6.0+0x1c56ae0)
#17 0x0000000001c6a795
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (/home/llvm/6.0.0/bin/clang-6.0+0x1c6a795)
#18 0x0000000001c6562d
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (/home/llvm/6.0.0/bin/clang-6.0+0x1c6562d)
#19 0x0000000001c5f528 clang::CodeGen::CodeGenModule::EmitDeferred()
(/home/llvm/6.0.0/bin/clang-6.0+0x1c5f528)
#20 0x0000000001c5eb29 clang::CodeGen::CodeGenModule::Release()
(/home/llvm/6.0.0/bin/clang-6.0+0x1c5eb29)
#21 0x00000000022f1a14 (anonymous
namespace)::CodeGeneratorImpl::HandleTranslationUnit(clang::ASTContext&)
(/home/llvm/6.0.0/bin/clang-6.0+0x22f1a14)
#22 0x00000000022eef77
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/home/llvm/6.0.0/bin/clang-6.0+0x22eef77)
#23 0x00000000025512f6 clang::ParseAST(clang::Sema&, bool, bool)
(/home/llvm/6.0.0/bin/clang-6.0+0x25512f6)
#24 0x0000000001f58cff clang::FrontendAction::Execute()
(/home/llvm/6.0.0/bin/clang-6.0+0x1f58cff)
#25 0x0000000001f152a8
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/llvm/6.0.0/bin/clang-6.0+0x1f152a8)
#26 0x0000000001fd9864
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/llvm/6.0.0/bin/clang-6.0+0x1fd9864)
#27 0x0000000000915501 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/llvm/6.0.0/bin/clang-6.0+0x915501)
#28 0x0000000000912ffd main (/home/llvm/6.0.0/bin/clang-6.0+0x912ffd)
#29 0x00007f4c2ac02c05 __libc_start_main (/lib64/libc.so.6+0x21c05)
#30 0x00000000009103c5 _start (/home/llvm/6.0.0/bin/clang-6.0+0x9103c5)

Run script:
# Crash reproducer for clang version 6.0.0 (tags/RELEASE_600/final)
# Driver args: "--driver-mode=g++" "example.cpp"
# Original command:  "/home/llvm/6.0.0/bin/clang-6.0" "-cc1" "-triple" "x86_64-
unknown-linux-gnu" "-emit-obj" "-mrelax-all" "-disable-free" "-disable-llvm-
verifier" "-discard-value-names" "-main-file-name" "example.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" "/home/llvm/6.0.0/lib64/clang/6.0.0" "-internal-isystem"
"/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5" "-
internal-isystem" "/usr/lib/gcc/x86_64-redhat-
linux/4.8.5/../../../../include/c++/4.8.5/x86_64-redhat-linux" "-internal-
isystem" "/usr/lib/gcc/x86_64-redhat-
linux/4.8.5/../../../../include/c++/4.8.5/backward" "-internal-isystem"
"/usr/local/include" "-internal-isystem"
"/home/llvm/6.0.0/lib64/clang/6.0.0/include" "-internal-externc-isystem"
"/include" "-internal-externc-isystem" "/usr/include" "-fdeprecated-macro" "-
fdebug-compilation-dir" "/tmp/example" "-ferror-limit" "19" "-fmessage-length"
"191" "-fobjc-runtime=gcc" "-fcxx-exceptions" "-fexceptions" "-fdiagnostics-
show-option" "-fcolor-diagnostics" "-o" "/tmp/example-1aa6d7.o" "-x" "c++"
"example.cpp"
 "/home/llvm/6.0.0/bin/clang-6.0" "-cc1" "-triple" "x86_64-unknown-linux-gnu" "-emit-obj" "-mrelax-all" "-disable-free" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "example.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" "-fdeprecated-macro" "-ferror-limit" "19" "-fmessage-length" "191" "-fobjc-runtime=gcc" "-fcxx-exceptions" "-fexceptions" "-fdiagnostics-show-option" "-fcolor-diagnostics" "-x" "c++" "example-962994.cpp"

Preprocessed source:
# 1 "<built-in>"
# 1 "example.cpp"
// An example struct.
template<typename OBJECT>
struct Example
{
  // A variable template.
  template<int>
  static Example const* _pointer;

  // A static method.
  static Example const* get_pointer() { return _pointer<0>; }
};

// Variable template initialization.
template<typename OBJECT>
template<int>
Example<OBJECT> const* Example<OBJECT>::_pointer = nullptr;

// Main function.
int main(int, char*[])
{
  // This instantiation generates the issue.
  Example<int>::get_pointer();

  // Returns zero.
  return 0;
}
Quuxplusone commented 6 years ago

This crash reproduces with trunk r327700, and it seems to have been in there forever, I tried old versions up to r250000, and it crashed the same. Must be a very old mistake. :)