[LLVMbugs] [Bug 1223] NEW: verifier produces bytecode that causes a bytecode reader assertion failure

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Sat Feb 24 20:16:33 PST 2007


           Summary: verifier produces bytecode that causes a bytecode reader
                    assertion failure
           Product: libraries
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core LLVM classes
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: lefever at crhc.uiuc.edu

The verifier (called by the -verify option to opt) permits bytecode to be
written that causes the bytecode reader to abort due to the following assertion

llvm::BytecodeReader::ParseConstantPoolValue(unsigned int):
Assertion `(!isa<Constant>(Result) || 
!cast<Constant>(Result)->isNullValue()) || !hasImplicitNull(TypeID) && 
"Cannot read null values from bytecode!"' failed.

The following information was obtained by running gdb on opt when reading in
faulty bytecode permitted by the verifier.

(gdb) print Result
$7 = (class llvm::Constant *) 0x96ad9d0
(gdb) call Result->dump()
  [41 x sbyte *] zeroinitializer
(gdb) print hasImplicitNull(TypeID)
$5 = true

After further investigation, the bytecode (that passed the verifier but not the
bytecode reader) was produced in the following way.  We start with a module M
that contains GlobalVariables X and Y.  In the module's original form, X is
initialized using Y.  We then apply a transform T to M that retains X but
replaces all uses of Y with a NULL value by executing the following code:


T then deletes Y by executing the following code:


T then finishes and the bytecode it produces, passes the verifier.  When opt is
called on the just written bytecode, the bytecode reader fails.  Assuming that
the bytecode reader is correct, the verifier needs to be updated to warn/abort
when such bytecode is produced.

------- 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