Closed
Description
Describe the bug
Running the following code:
f(_V0) when (not (not is_float(_V0))) =/= ((ok and ok) or true) ->
ok.
wrapper0() ->
io:write(catch f(ok)).
with the following commands:
erlc -W0 ~/minimized/test812871.erl
erl -pa . -noshell -s test812871 wrapper0 -s init stop
results in ok
being printed.
Expected behavior
I would expect to see the guard fail because of an exception being thrown by ok and ok
.
Affected versions
- master
- master + Fix
bad_typed_register
failure #7355 + beam_ssa_throw: Exceptions may escape modules through funs #7357
Additional context
Adding +no_bool_opt
to erlc
makes this bug disappear: the output becomes
{'EXIT',{function_clause,[{test812871,f,[ok],[{file,[47,104,111,109,101,47,114,109,111,114,105,115,115,101,116,47,109,105,110,105,109,105,122,101,100,47,116,101,115,116,56,49,50,56,55,49,46,101,114,108]},{line,7}]},{test812871,wrapper0,0,[{file,[47,104,111,109,101,47,114,109,111,114,105,115,115,101,116,47,109,105,110,105,109,105,122,101,100,47,116,101,115,116,56,49,50,56,55,49,46,101,114,108]},{line,11}]},{init,start_em,1,[]},{init,do_boot,3,[]}]}}
Which is what I expect to see even with the bool_opt optimisation pass.