[LLVMbugs] [Bug 198] TypeMap accesses free'd memory

bugzilla-daemon at zion.cs.uiuc.edu bugzilla-daemon at zion.cs.uiuc.edu
Tue Dec 30 19:26:14 PST 2003


sabre at nondot.org changed:

           What    |Removed                     |Added
             Status|ASSIGNED                    |RESOLVED
           Keywords|crash-on-invalid            |compile-fail
         Resolution|                            |FIXED
            Summary|llvm-as segfaults when      |TypeMap accesses free'd
                   |parsing the attached file   |memory

------- Additional Comments From sabre at nondot.org  2003-12-30 21:26 -------
Fixed.  Testcase here: test/Regression/Assembler/2003-12-30-TypeMapInvalidMemory.llx

It turns out that this nasty bug was caused by the TypeMap class in Type.cpp. 
The problem is that there was nothing that kept abstract types around, even
though the type map still pointed to them, causing it to dereference the free'd
memory, causing all sort of problems.

The fix for this bug is to make the TypeMap class use PATypeHolder's instead of
using raw pointers:

Instead of crashing, I get a nice happy error message:
$  llvm-as test.ll
llvm-as: test.ll:5: Reference to an invalid type: 'struct.D_Scope'

I do not think that this bug was present in 1.1, because 1.1 (incorrectly)
didn't delete types aggressively enough, so it was a latent problem.  John, I
would appreciate it if you could check on this though.  If so, let me know and
I'll update the bug and the release notes for 1.1



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

More information about the llvm-bugs mailing list