[llvm-bugs] [Bug 39732] New: Crash in SROA pass for initializing non-first base class from variadic function template

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Nov 20 12:44:24 PST 2018


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

            Bug ID: 39732
           Summary: Crash in SROA pass for initializing non-first base
                    class from variadic function template
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: max.langhof at gmx.de
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

Minimal code (https://godbolt.org/z/R6TQQ8):

  #include <memory>

  struct A {
    std::unique_ptr<int> x;
  };

  struct B {
    std::unique_ptr<int> y;
  };

  struct AB : A, B
  {};

  void foo() {
    AB ab{ nullptr, std::make_unique<int>(1) };
  }

Condensed, most interesting cases:
https://godbolt.org/z/R1WNy3

Lots of test cases:
https://godbolt.org/z/dTpb4-


This crash exists in all clang versions (that are new enough to compile the
above), see godbolt links.

##############

Stack trace:

0.      Program arguments:
/opt/compiler-explorer/clang-trunk-20181111/bin/clang-8 -cc1 -triple
x86_64-unknown-linux-gnu -S -disable-free -disable-llvm-verifier
-discard-value-names -main-file-name example.cpp -mrelocation-model static
-mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases
-munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info
-debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb
-momit-leaf-frame-pointer -coverage-notes-file
/tmp/compiler-explorer-compiler1181020-55-j6o6z1.avoz/output.gcno -resource-dir
/opt/compiler-explorer/clang-trunk-20181111/lib/clang/8.0.0 -internal-isystem
/opt/compiler-explorer/gcc-8.2.0/lib/gcc/x86_64-linux-gnu/8.2.0/../../../../include/c++/8.2.0
-internal-isystem
/opt/compiler-explorer/gcc-8.2.0/lib/gcc/x86_64-linux-gnu/8.2.0/../../../../include/c++/8.2.0/x86_64-linux-gnu
-internal-isystem
/opt/compiler-explorer/gcc-8.2.0/lib/gcc/x86_64-linux-gnu/8.2.0/../../../../include/c++/8.2.0/backward
-internal-isystem /usr/local/include -internal-isystem
/opt/compiler-explorer/clang-trunk-20181111/lib/clang/8.0.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include -O1
-std=c++17 -fdeprecated-macro -fdebug-compilation-dir
/tmp/compiler-explorer-compiler1181020-55-j6o6z1.avoz -ferror-limit 19
-fmessage-length 0 -fobjc-runtime=gcc -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -mllvm --x86-asm-syntax=intel -o
/tmp/compiler-explorer-compiler1181020-55-j6o6z1.avoz/output.s -x c++ <source>
-faddrsig 

1.      <eof> parser at end of file

2.      Per-function optimization

3.      Running pass 'SROA' on function '@_Z3foov'

#0 0x000055f18ccfdcfa llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/opt/compiler-explorer/clang-trunk-20181111/bin/clang-8+0x2362cfa)

#1 0x000055f18ccfc264 llvm::sys::RunSignalHandlers()
(/opt/compiler-explorer/clang-trunk-20181111/bin/clang-8+0x2361264)

#2 0x000055f18ccfc3a2 SignalHandler(int)
(/opt/compiler-explorer/clang-trunk-20181111/bin/clang-8+0x23613a2)

#3 0x00007effde8ed890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)

#4 0x000055f18c69f8f0 llvm::BasicBlock::getModule() const
(/opt/compiler-explorer/clang-trunk-20181111/bin/clang-8+0x1d048f0)

#5 0x000055f18cc0fd0e
llvm::sroa::AllocaSlices::SliceBuilder::visitStoreInst(llvm::StoreInst&)
(/opt/compiler-explorer/clang-trunk-20181111/bin/clang-8+0x2274d0e)

#6 0x000055f18cc15753 llvm::sroa::AllocaSlices::AllocaSlices(llvm::DataLayout
const&, llvm::AllocaInst&)
(/opt/compiler-explorer/clang-trunk-20181111/bin/clang-8+0x227a753)

#7 0x000055f18cc204db llvm::SROA::runOnAlloca(llvm::AllocaInst&)
(/opt/compiler-explorer/clang-trunk-20181111/bin/clang-8+0x22854db)

#8 0x000055f18cc22231 llvm::SROA::runImpl(llvm::Function&,
llvm::DominatorTree&, llvm::AssumptionCache&)
(/opt/compiler-explorer/clang-trunk-20181111/bin/clang-8+0x2287231)

#9 0x000055f18cc23dbc
llvm::sroa::SROALegacyPass::runOnFunction(llvm::Function&)
(/opt/compiler-explorer/clang-trunk-20181111/bin/clang-8+0x2288dbc)

#10 0x000055f18c74aa09 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/opt/compiler-explorer/clang-trunk-20181111/bin/clang-8+0x1dafa09)

#11 0x000055f18c74ab1c
llvm::legacy::FunctionPassManagerImpl::run(llvm::Function&)
(/opt/compiler-explorer/clang-trunk-20181111/bin/clang-8+0x1dafb1c)

#12 0x000055f18c74ae02 llvm::legacy::FunctionPassManager::run(llvm::Function&)
(/opt/compiler-explorer/clang-trunk-20181111/bin/clang-8+0x1dafe02)

#13 0x000055f18cf0356b (anonymous
namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/opt/compiler-explorer/clang-trunk-20181111/bin/clang-8+0x256856b)

#14 0x000055f18cf05cfe clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::HeaderSearchOptions const&, clang::CodeGenOptions const&,
clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout
const&, llvm::Module*, clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/opt/compiler-explorer/clang-trunk-20181111/bin/clang-8+0x256acfe)

#15 0x000055f18d821eaf
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/opt/compiler-explorer/clang-trunk-20181111/bin/clang-8+0x2e86eaf)

#16 0x000055f18df9b2b9 clang::ParseAST(clang::Sema&, bool, bool)
(/opt/compiler-explorer/clang-trunk-20181111/bin/clang-8+0x36002b9)

#17 0x000055f18d820da7 clang::CodeGenAction::ExecuteAction()
(/opt/compiler-explorer/clang-trunk-20181111/bin/clang-8+0x2e85da7)

#18 0x000055f18d3810c6 clang::FrontendAction::Execute()
(/opt/compiler-explorer/clang-trunk-20181111/bin/clang-8+0x29e60c6)

#19 0x000055f18d345a2c
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/opt/compiler-explorer/clang-trunk-20181111/bin/clang-8+0x29aaa2c)

#20 0x000055f18d43d76b
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/opt/compiler-explorer/clang-trunk-20181111/bin/clang-8+0x2aa276b)

#21 0x000055f18b441668 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/opt/compiler-explorer/clang-trunk-20181111/bin/clang-8+0xaa6668)

#22 0x000055f18b395b09 main
(/opt/compiler-explorer/clang-trunk-20181111/bin/clang-8+0x9fab09)

#23 0x00007effdd7a6b97 __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x21b97)

#24 0x000055f18b43e90a _start
(/opt/compiler-explorer/clang-trunk-20181111/bin/clang-8+0xaa390a)

-- 
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/20181120/64719d0a/attachment.html>


More information about the llvm-bugs mailing list