|
From: <sv...@va...> - 2013-01-21 01:27:32
|
florian 2013-01-21 01:27:22 +0000 (Mon, 21 Jan 2013)
New Revision: 13250
Log:
In mc_translate a NULL guard expression is sometimes passed around
functions to indicate a "true" expression. That caused some confusion
and led people to believe believe, that IRDirty::guard could be NULL.
It cannot.
This confusion was indirectly spotted by coverity's checker who figured
out that IRDirty::guard was sometimes unconditionally dereferenced
and sometimes compared against NULL.
Cleaning this up...
Modified files:
trunk/memcheck/mc_translate.c
Modified: trunk/memcheck/mc_translate.c (+16 -17)
===================================================================
--- trunk/memcheck/mc_translate.c 2013-01-21 01:01:13 +00:00 (rev 13249)
+++ trunk/memcheck/mc_translate.c 2013-01-21 01:27:22 +00:00 (rev 13250)
@@ -5542,7 +5542,7 @@
for (i = 0; d->args[i]; i++)
if (isBogusAtom(d->args[i]))
return True;
- if (d->guard && isBogusAtom(d->guard))
+ if (isBogusAtom(d->guard))
return True;
if (d->mAddr && isBogusAtom(d->mAddr))
return True;
@@ -6029,8 +6029,7 @@
continue;
di = st->Ist.Dirty.details;
guard = di->guard;
- if (!guard)
- continue;
+ tl_assert(guard);
if (0) { ppIRExpr(guard); VG_(printf)("\n"); }
cee = di->cee;
if (!is_helperc_value_checkN_fail( cee->name ))
@@ -6567,22 +6566,22 @@
/* Write 'curr' to the state slice gOff .. gOff+n-1 */
b_offset = MC_(get_otrack_shadow_offset)(gOff, 4);
if (b_offset != -1) {
- if (d->guard) {
- /* If the guard expression evaluates to false we simply Put
- the value that is already stored in the guest state slot */
- IRAtom *cond, *iffalse;
- cond = assignNew('B', mce, Ity_I8,
- unop(Iop_1Uto8, d->guard));
- iffalse = assignNew('B', mce, Ity_I32,
- IRExpr_Get(b_offset +
- 2*mce->layout->total_sizeB,
- Ity_I32));
- curr = assignNew('V', mce, Ity_I32,
- IRExpr_Mux0X(cond, iffalse, curr));
- }
+ /* If the guard expression evaluates to false we simply Put
+ the value that is already stored in the guest state slot */
+ IRAtom *cond, *iffalse;
+
+ cond = assignNew('B', mce, Ity_I8,
+ unop(Iop_1Uto8, d->guard));
+ iffalse = assignNew('B', mce, Ity_I32,
+ IRExpr_Get(b_offset +
+ 2*mce->layout->total_sizeB,
+ Ity_I32));
+ curr = assignNew('V', mce, Ity_I32,
+ IRExpr_Mux0X(cond, iffalse, curr));
+
stmt( 'B', mce, IRStmt_Put(b_offset
- + 2*mce->layout->total_sizeB,
+ + 2*mce->layout->total_sizeB,
curr ));
}
gSz -= n;
|