From 2d9e5a1c60a41e747956880ab199955b8f12d53c Mon Sep 17 00:00:00 2001 From: "Alon Zakai (kripken)" Date: Mon, 28 Aug 2017 14:53:00 -0700 Subject: improve fuzzing of functions with unreachable body --- src/tools/translate-to-fuzz.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/tools/translate-to-fuzz.h b/src/tools/translate-to-fuzz.h index 307604af6..74a457013 100644 --- a/src/tools/translate-to-fuzz.h +++ b/src/tools/translate-to-fuzz.h @@ -259,16 +259,16 @@ private: labelIndex = 0; assert(breakableStack.empty()); assert(hangStack.empty()); + // with small chance, make the body unreachable + auto bodyType = func->result; + if (oneIn(10)) { + bodyType = unreachable; + } // with reasonable chance make the body a block if (oneIn(2)) { - func->body = makeBlock(func->result); + func->body = makeBlock(bodyType); } else { - // with very small chance, make the body unreachable - if (oneIn(20)) { - func->body = make(unreachable); - } else { - func->body = make(func->result); - } + func->body = make(bodyType); } if (HANG_LIMIT > 0) { func->body = builder.makeSequence( -- cgit v1.2.3