[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


            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


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