<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </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 --- - FindExternalVisibleDeclsByName iterator invalidation when using modules"
   href="http://llvm.org/bugs/show_bug.cgi?id=21323">21323</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>FindExternalVisibleDeclsByName iterator invalidation when using modules
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

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

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Frontend
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>comexk@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>In ASTReader::FindExternalVisibleDeclsByName, in the loop 'for (auto *MergedDC
: Merged->second)', it is possible for Merged to change, with the following
stack trace:

  * frame #0: 0x000000010018db10
clang`clang::ASTDeclReader::MergeDefinitionData(clang::CXXRecordDecl*,
clang::CXXRecordDecl::DefinitionData&)
    frame #1: 0x000000010018eb00
clang`clang::ASTDeclReader::VisitCXXRecordDeclImpl(clang::CXXRecordDecl*) + 560
    frame #2: 0x0000000100197e58
clang`clang::declvisitor::Base<clang::declvisitor::make_ptr,
clang::ASTDeclReader, void>::Visit(clang::Decl*) + 1016
    frame #3: 0x0000000100178f55
clang`clang::ASTDeclReader::Visit(clang::Decl*) + 21
    frame #4: 0x0000000100194934
clang`clang::ASTReader::ReadDeclRecord(unsigned int) + 1988
    frame #5: 0x000000010016b0d8 clang`clang::RecordDecl*
clang::ASTReader::ReadDeclAs<clang::RecordDecl>(clang::serialization::ModuleFile&,
llvm::SmallVector<unsigned long long, 64u> const&, unsigned int&) + 88
    frame #6: 0x000000010015513a
clang`clang::ASTReader::readTypeRecord(unsigned int) + 3114
    frame #7: 0x000000010014fe63 clang`clang::ASTReader::GetType(unsigned int)
+ 147
    frame #8: 0x00000001001579f4
clang`clang::ASTReader::readTypeRecord(unsigned int) + 13540
    frame #9: 0x000000010014fe63 clang`clang::ASTReader::GetType(unsigned int)
+ 147
    frame #10: 0x000000010015710a
clang`clang::ASTReader::readTypeRecord(unsigned int) + 11258
    frame #11: 0x000000010014fe63 clang`clang::ASTReader::GetType(unsigned int)
+ 147
    frame #12: 0x00000001001873b5
clang`clang::ASTDeclReader::VisitValueDecl(clang::ValueDecl*) + 149
    frame #13: 0x0000000100187515
clang`clang::ASTDeclReader::VisitDeclaratorDecl(clang::DeclaratorDecl*) + 21
    frame #14: 0x00000001001876a0
clang`clang::ASTDeclReader::VisitFunctionDecl(clang::FunctionDecl*) + 80
    frame #15: 0x000000010018ed46
clang`clang::ASTDeclReader::VisitCXXMethodDecl(clang::CXXMethodDecl*) + 22
    frame #16: 0x0000000100178f55
clang`clang::ASTDeclReader::Visit(clang::Decl*) + 21
    frame #17: 0x0000000100194934
clang`clang::ASTReader::ReadDeclRecord(unsigned int) + 1988
    frame #18: 0x0000000100176a29
clang`clang::ASTReader::GetLocalDecl(clang::serialization::ModuleFile&,
unsigned int) + 201
    frame #19: 0x00000001001698a0 clang`(anonymous
namespace)::DeclContextNameLookupVisitor::visit(clang::serialization::ModuleFile&,
void*) + 336
    frame #20: 0x0000000100228611
clang`clang::serialization::ModuleManager::visit(bool
(*)(clang::serialization::ModuleFile&, void*), void*,
llvm::SmallPtrSetImpl<clang::serialization::ModuleFile*>*) + 1297
    frame #21: 0x000000010015e3d8
clang`clang::ASTReader::FindExternalVisibleDeclsByName(clang::DeclContext
const*, clang::DeclarationName) + 2232
    frame #22: 0x0000000100ea18a7
clang`clang::DeclContext::lookup(clang::DeclarationName) + 999
    frame #23: 0x0000000100e12fb9
clang`clang::Redeclarable<clang::FunctionDecl>::DeclLink::getNext(clang::FunctionDecl
const*) const + 169
    frame #24: 0x000000010038423c
clang`clang::CodeGen::CodeGenModule::Release() + 972
    frame #25: 0x0000000100377ac4
clang`clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) + 100
    frame #26: 0x000000010040ee84 clang`clang::ParseAST(clang::Sema&, bool,
bool) + 468
    frame #27: 0x000000010037663b clang`clang::CodeGenAction::ExecuteAction() +
123
    frame #28: 0x000000010007c993 clang`clang::FrontendAction::Execute() + 67
    frame #29: 0x000000010004f19c
clang`clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 972
    frame #30: 0x000000010000a8c5
clang`clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 4149

This causes a crash.  Test case is hairy for now, though...</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>