<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Crash in SROA pass for initializing non-first base class from variadic function template"
   href="https://bugs.llvm.org/show_bug.cgi?id=39732">39732</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Crash in SROA pass for initializing non-first base class from variadic function template
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>max.langhof@gmx.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Minimal code (<a href="https://godbolt.org/z/R6TQQ8">https://godbolt.org/z/R6TQQ8</a>):

  #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:
<a href="https://godbolt.org/z/R1WNy3">https://godbolt.org/z/R1WNy3</a>

Lots of test cases:
<a href="https://godbolt.org/z/dTpb4">https://godbolt.org/z/dTpb4</a>-


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)</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>