diff options
author | Björn Gustavsson <[email protected]> | 2016-10-02 14:21:13 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2016-10-27 08:14:08 +0200 |
commit | 89bf3f5bef9d9f5fb4a0003d6da028900d0f32fc (patch) | |
tree | f57230b970f903a7490c79bf9729c1483cb06300 /lib/compiler/src | |
parent | 9be10412e1837aac339a284f2b01cfc112778180 (diff) | |
download | otp-89bf3f5bef9d9f5fb4a0003d6da028900d0f32fc.tar.gz otp-89bf3f5bef9d9f5fb4a0003d6da028900d0f32fc.tar.bz2 otp-89bf3f5bef9d9f5fb4a0003d6da028900d0f32fc.zip |
Don't copy funs into guards
Funs must not be created in guards. The instruction for creating
a fun clobbers all X registers, which is a bad thing to do in
a guard.
Diffstat (limited to 'lib/compiler/src')
-rw-r--r-- | lib/compiler/src/sys_core_fold.erl | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/compiler/src/sys_core_fold.erl b/lib/compiler/src/sys_core_fold.erl index 5e1602cb5b..4922953407 100644 --- a/lib/compiler/src/sys_core_fold.erl +++ b/lib/compiler/src/sys_core_fold.erl @@ -1130,7 +1130,13 @@ clause_1(#c_clause{guard=G0,body=B0}=Cl, Ps1, Cexpr, Ctxt, Sub1) -> %% %% case A of NewVar when true -> ... %% - sub_set_var(Var, Cexpr, Sub2); + case cerl:is_c_fname(Cexpr) of + false -> + sub_set_var(Var, Cexpr, Sub2); + true -> + %% We must not copy funs, and especially not into guards. + Sub2 + end; _ -> Sub2 end, |