-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
bugIssue is reported as a bugIssue is reported as a bugteam:VMAssigned to OTP team VMAssigned to OTP team VM
Description
Describe the bug
Running the following code:
f(_V0) when (ok /= _V0) or is_float(is_list(_V0) orelse (ok andalso ok)) ->
ok.
wrapper0() ->
io:format("~kp", [catch f(<<>>)]).by doing
erlc -W0 ~/minimized/test990917.erl
erl -noshell -pa . -s test990917 wrapper0 -s init stop
results in ok being output.
But passing +no_copt to erlc makes it output the following instead:
{'EXIT',
{function_clause,
[{test990917,f,
[<<>>],
[{file,"/home/rmorisset/minimized/test990917.erl"},{line,7}]},
{test990917,wrapper0,0,
[{file,"/home/rmorisset/minimized/test990917.erl"},{line,11}]},
{init,start_em,1,[]},
{init,do_boot,3,[]}]}}
Expected behavior
I believe that the behavior with +no_copt is the correct one:
is_list(_V0)is false- so
(ok andalso ok)should execute (since theoris not supposed to short-circuit) okis not a boolean, so this should throw- and an exception in the guard should make the function clause be skipped
Affected versions
Additional context
This looks kind of similar to #7494, but the testcase is sufficiently different that I am unsure of whether they are duplicates, hence this issue being filed.
Metadata
Metadata
Assignees
Labels
bugIssue is reported as a bugIssue is reported as a bugteam:VMAssigned to OTP team VMAssigned to OTP team VM