[LLVMbugs] [Bug 23200] New: AddDiscriminators and DILocation::computeNewDiscriminator() modifies the LLVMContext inappropriately

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Apr 10 17:34:34 PDT 2015


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

            Bug ID: 23200
           Summary: AddDiscriminators and
                    DILocation::computeNewDiscriminator() modifies the
                    LLVMContext inappropriately
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: DebugInfo
          Assignee: unassignedbugs at nondot.org
          Reporter: dexonsmith at apple.com
                CC: aprantl at apple.com, dblaikie at gmail.com,
                    dnovillo at google.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

`DILocation::computeNewDiscriminator()` modifies a table in the LLVMContext
indexed by filename/line.  This will changes results in other modules created
in the same context, and the table doesn't get serialized to bitcode/assembly
(so roundtripping will change the results of `computeNewDiscriminator()`).

Although it doesn't cause problems for `clang` in practice, this is fairly
broken.

Fortunately, the fix is simple: move the table (and logic) into
`AddDiscriminators::runOnFunction()` and stop modifying the LLVMContext.  This
table is discriminating between adjacent basic blocks, so it doesn't need
global state.

I'll add FIXMEs and tag this PR when I move the function over to MDLocation,
and hopefully circle back to fix it soon after (if no one beats me to it).

-- 
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/20150411/7834e53d/attachment.html>


More information about the llvm-bugs mailing list