From: Florian Krohm Date: Thu, 5 Jul 2012 22:05:42 +0000 (+0000) Subject: Make the IR sanity checker complain about dirty helpers that return X-Git-Tag: svn/VALGRIND_3_8_1^2~58 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7294cb96abb8064d9cc1954e300d02084cbc3cde;p=thirdparty%2Fvalgrind.git 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. git-svn-id: svn://svn.valgrind.org/vex/trunk@2420 --- diff --git a/VEX/priv/ir_defs.c b/VEX/priv/ir_defs.c index 2b8877c246..89aec11d1c 100644 --- a/VEX/priv/ir_defs.c +++ b/VEX/priv/ir_defs.c @@ -3672,11 +3672,18 @@ void tcStmt ( IRSB* bb, IRStmt* stmt, IRType gWordTy ) 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");