<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 - New PM crash w/ tsan: llvm::Value::assertModuleIsMaterializedImpl() const: Assertion `M->isMaterialized()' failed."
   href="https://bugs.llvm.org/show_bug.cgi?id=42877">42877</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>New PM crash w/ tsan: llvm::Value::assertModuleIsMaterializedImpl() const: Assertion `M->isMaterialized()' failed.
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Linux
          </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>leonardchan@google.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>rupprecht@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Note: this repro reliably crashes clang, but doesn't always print the same
stack trace. I only get this specific message ~7% of the time.

$ cat repro.c
typedef enum { a } b;
int h;
struct f {
  int e;
  b c;
};
void static fn1(*d) {
  d[1];
  for (; 0;)
    ;
}
void g() {
  struct f *x = 0;
  switch (x->c)
  case a:
    fn1(h);
}
int i();
int fn3() {
  if (i())
    ;
}

$ clang \
    -cc1 -emit-obj -O3 -w \
    -fsanitize=thread -fexperimental-new-pass-manager \
    repro.c
Error message:
clang:
/usr/local/google/home/rupprecht/src/llvm-project/llvm/lib/IR/Value.cpp:359:
void llvm::Value::assertModuleIsMaterializedImpl() const: Assertion
`M->isMaterialized()' failed.                             
Stack dump:
...
 #9 0x00007f5d3f164133 llvm::Value::materialized_user_begin()
/usr/local/google/home/rupprecht/src/llvm-project/llvm/include/llvm/IR/Value.h:391:66 
#10 0x00007f5d3f164133 llvm::Value::user_begin()
/usr/local/google/home/rupprecht/src/llvm-project/llvm/include/llvm/IR/Value.h:397:0 
#11 0x00007f5d3f164133 llvm::PredIterator<llvm::BasicBlock,
llvm::Value::user_iterator_impl<llvm::User> >::PredIterator(llvm::BasicBlock*)
/usr/local/google/home/rupprecht/src/llvm-project/llvm/include/llvm/IR/CFG.h:65:0
#12 0x00007f5d3f164133 llvm::pred_begin(llvm::BasicBlock*)
/usr/local/google/home/rupprecht/src/llvm-project/llvm/include/llvm/IR/CFG.h:108:0 
#13 0x00007f5d3f164133 llvm::GraphTraits<llvm::Inverse<llvm::BasicBlock*>
<span class="quote">>::child_begin(llvm::BasicBlock*)</span >
/usr/local/google/home/rupprecht/src/llvm-project/llvm/include/llvm/IR/CFG.h:327:0 
#14 0x00007f5d3f164133
llvm::iterator_range<llvm::GraphTraits<llvm::Inverse<llvm::BasicBlock*>
<span class="quote">>::ChildIteratorType> llvm::children<llvm::Inverse<llvm::BasicBlock*>
>(llvm::GraphTraits<llvm::Inverse<llvm::BasicBlock*> >::NodeRef const&)</span >
/usr/local/google/home/rupprecht/src/llvm-project/llvm/include/llvm/ADT/GraphTraits.h:122:0 
#15 0x00007f5d3f164133 llvm::LoopInfoBase<llvm::BasicBlock,
llvm::Loop>::analyze(llvm::DominatorTreeBase<llvm::BasicBlock, false> const&)
/usr/local/google/home/rupprecht/src/llvm-project/llvm/include/llvm/Analysis/LoopInfoImpl.h:549:0
#16 0x00007f5d3f16a1d7 llvm::LoopAnalysis::run(llvm::Function&,
llvm::AnalysisManager<llvm::Function>&)
/usr/local/google/home/rupprecht/src/llvm-project/llvm/lib/Analysis/LoopInfo.cpp:924:1 
#17 0x00007f5d39d53302
std::enable_if<!(std::is_array<llvm::detail::AnalysisResultModel<llvm::Function,
llvm::LoopAnalysis, llvm::LoopInfo, llvm::PreservedAnalyses,
llvm::AnalysisManager<llvm::Function>::Invalidator, true> >::value),
std::unique_ptr<llvm::detail::AnalysisResultModel<llvm::Function,
llvm::LoopAnalysis, llvm::LoopInfo, llvm::PreservedAnalyses,
llvm::AnalysisManager<llvm::Function>::Invalidator, true>,
std::default_delete<llvm::detail::AnalysisResultModel<llvm::Function,
llvm::LoopAnalysis, llvm::LoopInfo, llvm::PreservedAnalyses,
llvm::AnalysisManager<llvm::Function>::Invalidator, true> > > >::type
llvm::make_unique<llvm::detail::AnalysisResultModel<llvm::Function,
llvm::LoopAnalysis, llvm::LoopInfo, llvm::PreservedAnalyses,
llvm::AnalysisManager<llvm::Function>::Invalidator, true>,
llvm::LoopInfo>(llvm::LoopInfo&&)
/usr/local/google/home/rupprecht/src/llvm-project/llvm/include/llvm/ADT/STLExtras.h:1406:29</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>