diff options
author | Alon Zakai <alonzakai@gmail.com> | 2017-08-28 20:12:48 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-28 20:12:48 -0700 |
commit | d621116cada789d15c569385ea79a57ba534c08f (patch) | |
tree | 6f9c922c5a0c2f5c8791636a156c8694d4be1d4d /src/tools/translate-to-fuzz.h | |
parent | 5c2f4ab22367d04753678fbd12d67b4dc2a29010 (diff) | |
parent | 2d9e5a1c60a41e747956880ab199955b8f12d53c (diff) | |
download | binaryen-d621116cada789d15c569385ea79a57ba534c08f.tar.gz binaryen-d621116cada789d15c569385ea79a57ba534c08f.tar.bz2 binaryen-d621116cada789d15c569385ea79a57ba534c08f.zip |
Merge pull request #1154 from WebAssembly/fuzz
Fuzz fixes
Diffstat (limited to 'src/tools/translate-to-fuzz.h')
-rw-r--r-- | src/tools/translate-to-fuzz.h | 14 |
1 files changed, 7 insertions, 7 deletions
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( |