[LLVMbugs] [Bug 5099] New: RewriteRope strictly undefined behavior, null 'this'

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Tue Sep 29 13:17:15 PDT 2009


http://llvm.org/bugs/show_bug.cgi?id=5099

           Summary: RewriteRope strictly undefined behavior, null 'this'
           Product: clang
           Version: unspecified
          Platform: All
               URL: http://clang.llvm.org/doxygen/RewriteRope_8h-source.html
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Basic
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: agrant at arm.com
                CC: llvmbugs at cs.uiuc.edu


RewriteRope and RopeRefCountString rely on being able to call a
non-virtual member function on a null pointer and then test 'this'
in the member function implementation; see RopeRefCountString::addRef
and dropRef.  This is undefined behavior in standard C++ and implementations
exist that will produce unexpected behavior (e.g. optimize away the test
on 'this' because it's flagged as a non-null argument).  The fix is to
guard each call to addRef and dropRef with a test on the object pointer,
so that it is no longer necessary to test 'this' - there is no net
change in the number of runtime tests.


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list