diff options
author | Anthony Ramine <[email protected]> | 2014-03-01 17:26:56 +0100 |
---|---|---|
committer | Anthony Ramine <[email protected]> | 2014-03-05 10:18:15 +0100 |
commit | 926be4d0a3a75f48bc280a7aa2f97fc4adbef189 (patch) | |
tree | ce0074eeaffcfd38187cb9609471deb4242a0b44 /lib/compiler/test/core_SUITE_data | |
parent | c199bd2923e7d733e60beb9bd27b3852cbb2e699 (diff) | |
download | otp-926be4d0a3a75f48bc280a7aa2f97fc4adbef189.tar.gz otp-926be4d0a3a75f48bc280a7aa2f97fc4adbef189.tar.bz2 otp-926be4d0a3a75f48bc280a7aa2f97fc4adbef189.zip |
Do not try to optimize non-boolean guards
Expressions such as erlang:'or'(bar, true) can make beam_bool crash if it tries
to optimize them, as this code is not quite really written by users, no attempt
to rewrite them more efficiently should be done, for simplicity's sake.
Reported-by: Ulf Norell
Diffstat (limited to 'lib/compiler/test/core_SUITE_data')
-rw-r--r-- | lib/compiler/test/core_SUITE_data/bad_boolean_guard.core | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/compiler/test/core_SUITE_data/bad_boolean_guard.core b/lib/compiler/test/core_SUITE_data/bad_boolean_guard.core new file mode 100644 index 0000000000..318f8e3dc7 --- /dev/null +++ b/lib/compiler/test/core_SUITE_data/bad_boolean_guard.core @@ -0,0 +1,32 @@ +module 'bad_boolean_guard' ['bad_boolean_guard'/0, + 'module_info'/0, + 'module_info'/1] + attributes [] +'bad_boolean_guard'/0 = + fun () -> + apply 'f'/1 + ('true') +'f'/1 = + fun (_X_cor0) -> + case _X_cor0 of + <X> + when try + call 'erlang':'and' + ('bad', _X_cor0) + of <Try> -> + Try + catch <T,R> -> + 'false' -> + 'not_ok' + <_X_cor3> when 'true' -> + 'ok' + end +'module_info'/0 = + fun () -> + call 'erlang':'get_module_info' + ('bad_boolean_guard') +'module_info'/1 = + fun (_X_cor0) -> + call 'erlang':'get_module_info' + ('bad_boolean_guard', _X_cor0) +end
\ No newline at end of file |