[llvm-bugs] [Bug 33810] New: -fmodules crashes CodeGenModule::getMangledName(), called recursively

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Jul 16 07:57:15 PDT 2017


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

            Bug ID: 33810
           Summary: -fmodules crashes CodeGenModule::getMangledName(),
                    called recursively
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: geek4civic at gmail.com
                CC: llvm-bugs at lists.llvm.org

http://lab.llvm.org:8011/builders/clang-x86_64-linux-selfhost-modules/builds/7503
http://bb.pgr.jp/builders/bootstrap-clang-libcxx-lld-i686-linux

r308041 (and r308040) began crashing.

As far as I investigated, lazily-resolved decls would call
CodeGenModule::getMangledName() recursively, but it is not re-entrant.

  StringRef &FoundStr = MangledDeclNames[CanonicalGD];
  if (!FoundStr.empty())
    return FoundStr;
...
  return FoundStr = Result.first->first();

When (MapVector)MangledDeclName grew (realloc), &FoundStr might not point valid
element, to cause memory corruption.

I think;
  return MangledDeclNames[CanonicalGD] = Result.first->first();
would work, but I'm not sure it'd be the right resolution.

-- 
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/20170716/11be40d1/attachment.html>


More information about the llvm-bugs mailing list