[MLton] bug in ssaToRssa

Matthew Fluet fluet@cs.cornell.edu
Sun, 26 Sep 2004 14:52:42 -0400 (EDT)


I just checked in a revised remove-unused2.fun.  It's not completely
tested, and I'm not quite happy with it yet.  But, it seems to tickle a
bug in the ssaToRssa pass.  Trying to compile mlyacc.mlb with the
following command line:

../build/bin/mlton \
	-drop-pass "removeUnused4" \
	-ssa2-passes "removeUnused:deepFlatten:refFlatten:removeUnused:zone" \
	-type-check true \
	-keep-pass ssaToRssa -show-types true \
	-verbose 2 mlyacc.mlb

produces:

	 toSsa2 starting
	 toSsa2 finished in 0.00 + 0.00 (0% GC)
	 typeCheck starting
	    checkScopes starting
	    checkScopes finished in 0.00 + 0.00 (0% GC)
	 typeCheck finished in 0.00 + 0.00 (0% GC)
	 toSsa2Simplify starting
	    checkScopes starting
	    checkScopes finished in 0.00 + 0.00 (0% GC)
	    removeUnused#1 starting
	    removeUnused#1 finished in 0.00 + 0.00 (0% GC)
	    typeCheck starting
	       checkScopes starting
	       checkScopes finished in 0.00 + 0.00 (0% GC)
	    typeCheck finished in 0.00 + 0.00 (0% GC)
	    deepFlatten#1 starting
	    deepFlatten#1 finished in 0.00 + 0.00 (0% GC)
	    typeCheck starting
	       checkScopes starting
	       checkScopes finished in 0.00 + 0.00 (0% GC)
	    typeCheck finished in 0.00 + 0.00 (0% GC)
	    refFlatten#1 starting
	    refFlatten#1 finished in 0.00 + 0.00 (0% GC)
	    typeCheck starting
	       checkScopes starting
	       checkScopes finished in 0.00 + 0.00 (0% GC)
	    typeCheck finished in 0.00 + 0.00 (0% GC)
	    removeUnused#2 starting
	    removeUnused#2 finished in 0.00 + 0.00 (0% GC)
	    typeCheck starting
	       checkScopes starting
	       checkScopes finished in 0.00 + 0.00 (0% GC)
	    typeCheck finished in 0.00 + 0.00 (0% GC)
	    zone#1 starting
	    zone#1 finished in 0.00 + 0.00 (0% GC)
	    typeCheck starting
	       checkScopes starting
	       checkScopes finished in 0.00 + 0.00 (0% GC)
	    typeCheck finished in 0.00 + 0.00 (0% GC)
	    checkScopes starting
	    checkScopes finished in 0.00 + 0.00 (0% GC)
	 toSsa2Simplify finished in 0.00 + 0.00 (0% GC)
	 typeCheck starting
	    checkScopes starting
	    checkScopes finished in 0.00 + 0.00 (0% GC)
	 typeCheck finished in 0.00 + 0.00 (0% GC)
	 backend starting
	    ssaToRssa starting
	    ssaToRssa finished in 0.00 + 0.00 (0% GC)
	    display starting
	    display finished in 0.00 + 0.00 (0% GC)
	    typeCheck starting
invalid transfer: L_16 (Cast (Cast (x_1851: Pointers (pt_149, pt_148, pt_147),
				    Pointers (pt_149, pt_148, pt_147)),
			      Pointers (pt_147)))
invalid block: L_15 () Jump =
		 L_16 (Cast (Cast (x_1851: Pointers (pt_149, pt_148, pt_147),
				   Pointers (pt_149, pt_148, pt_147)),
			     Pointers (pt_147)))
	    typeCheck raised in 0.00 + 0.00 (0% GC)
	 backend raised in 0.00 + 0.00 (0% GC)
      pre codegen raised in 0.00 + 0.00 (0% GC)
   Compile SML raised in 0.00 + 0.00 (0% GC)
MLton raised in 0.00 + 0.00 (0% GC)
Rssa type error


At the very least, all of the SSA2 passes pass the type-checker, so either
there is a bug in ssaToRssa or there is an invariant that isn't being
checked by the type-checker.