|
From: <sv...@va...> - 2012-07-05 22:05:48
|
florian 2012-07-05 23:05:42 +0100 (Thu, 05 Jul 2012)
New Revision: 2420
Log:
Make the IR sanity checker complain about dirty helpers that return
a value and are executed under a condition. That case is not handled
properly and will cause asserts down the road. As pointed out by Julian.
Modified files:
trunk/priv/ir_defs.c
Modified: trunk/priv/ir_defs.c (+8 -1)
===================================================================
--- trunk/priv/ir_defs.c 2012-06-29 17:26:17 +01:00 (rev 2419)
+++ trunk/priv/ir_defs.c 2012-07-05 23:05:42 +01:00 (rev 2420)
@@ -3672,11 +3672,18 @@
goto bad_dirty;
}
}
- /* check types, minimally */
+ /* check guard */
if (d->guard == NULL) goto bad_dirty;
tcExpr( bb, stmt, d->guard, gWordTy );
if (typeOfIRExpr(tyenv, d->guard) != Ity_I1)
sanityCheckFail(bb,stmt,"IRStmt.Dirty.guard not :: Ity_I1");
+ /* A dirty helper that is executed conditionally (or not at all)
+ AND returns a value is not handled properly. */
+ if (d->tmp != IRTemp_INVALID &&
+ (d->guard->tag != Iex_Const || d->guard->Iex.Const.con->Ico.U1 == 0))
+ sanityCheckFail(bb,stmt,"IRStmt.Dirty with a return value"
+ " is executed under a condition");
+ /* check types, minimally */
if (d->tmp != IRTemp_INVALID
&& typeOfIRTemp(tyenv, d->tmp) == Ity_I1)
sanityCheckFail(bb,stmt,"IRStmt.Dirty.dst :: Ity_I1");
|