diff options
author | Björn Gustavsson <[email protected]> | 2016-09-05 12:47:01 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2016-09-05 12:56:12 +0200 |
commit | f9d516285dfec7db4333e919ca71e7eb0e6a41ed (patch) | |
tree | 0438c888fe67b58a46b014ad0ca288da79949331 /lib/compiler/src | |
parent | 93369eec652aa136c57fecc52182fb02449d69e6 (diff) | |
download | otp-f9d516285dfec7db4333e919ca71e7eb0e6a41ed.tar.gz otp-f9d516285dfec7db4333e919ca71e7eb0e6a41ed.tar.bz2 otp-f9d516285dfec7db4333e919ca71e7eb0e6a41ed.zip |
sys_core_fold: Don't move a fun into a guard
Moving a fun into a guard may cause code that is not accepted
by beam_validator.
Diffstat (limited to 'lib/compiler/src')
-rw-r--r-- | lib/compiler/src/sys_core_fold.erl | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/compiler/src/sys_core_fold.erl b/lib/compiler/src/sys_core_fold.erl index e0de50f3ae..08b02101a6 100644 --- a/lib/compiler/src/sys_core_fold.erl +++ b/lib/compiler/src/sys_core_fold.erl @@ -468,7 +468,8 @@ bitstr(#c_bitstr{val=Val,size=Size}=BinSeg, Sub) -> %% Currently, we don't attempt to check binaries because they %% are difficult to check. -is_safe_simple(#c_var{}, _) -> true; +is_safe_simple(#c_var{}=Var, _) -> + not cerl:is_c_fname(Var); is_safe_simple(#c_cons{hd=H,tl=T}, Sub) -> is_safe_simple(H, Sub) andalso is_safe_simple(T, Sub); is_safe_simple(#c_tuple{es=Es}, Sub) -> is_safe_simple_list(Es, Sub); |