diff options
Diffstat (limited to 'lib/compiler/test/beam_ssa_check_SUITE_data')
-rw-r--r-- | lib/compiler/test/beam_ssa_check_SUITE_data/private_append.erl | 27 | ||||
-rw-r--r-- | lib/compiler/test/beam_ssa_check_SUITE_data/sanity_checks.erl | 16 |
2 files changed, 41 insertions, 2 deletions
diff --git a/lib/compiler/test/beam_ssa_check_SUITE_data/private_append.erl b/lib/compiler/test/beam_ssa_check_SUITE_data/private_append.erl index 4d4b0f1bbd..c1edc54460 100644 --- a/lib/compiler/test/beam_ssa_check_SUITE_data/private_append.erl +++ b/lib/compiler/test/beam_ssa_check_SUITE_data/private_append.erl @@ -22,6 +22,8 @@ %% -module(private_append). +-feature(maybe_expr, enable). + -export([transformable0/1, transformable1/1, transformable1b/1, @@ -76,7 +78,9 @@ not_transformable14/0, not_transformable15/2, - id/1]). + id/1, + + bs_create_bin_on_literal/0]). %% Trivial smoke test transformable0(L) -> @@ -977,3 +981,24 @@ not_transformable15(_, V) -> id(I) -> I. + +%% Check that we don't try to private_append to something created by +%% bs_create_bin `append`, _, `<<>>`, ... +bs_create_bin_on_literal() -> +%ssa% () when post_ssa_opt -> +%ssa% X = bs_init_writable(_), +%ssa% Y = bs_create_bin(private_append, _, X, ...), +%ssa% Z = bs_create_bin(private_append, _, Y, ...), +%ssa% ret(Z). + << + << + (maybe + 2147483647 ?= ok + else + <<_>> -> + ok; + _ -> + <<>> + end)/bytes + >>/binary + >>. diff --git a/lib/compiler/test/beam_ssa_check_SUITE_data/sanity_checks.erl b/lib/compiler/test/beam_ssa_check_SUITE_data/sanity_checks.erl index ae4bb28eea..47c60fd8d6 100644 --- a/lib/compiler/test/beam_ssa_check_SUITE_data/sanity_checks.erl +++ b/lib/compiler/test/beam_ssa_check_SUITE_data/sanity_checks.erl @@ -18,6 +18,8 @@ -module(sanity_checks). +-compile(no_ssa_opt_private_append). + -export([check_fail/0, check_wrong_pass/0, check_xfail/0, @@ -33,7 +35,9 @@ t25/0, t26/0, t27/0, t28/0, t29/0, t30/0, t31/0, t32/1, t33/1, t34/1, t35/1, t36/0, t37/0, t38/0, t39/1, - t40/0, t41/0, t42/0, t43/0, t44/0]). + t40/0, t41/0, t42/0, t43/0, t44/0, + + check_env/0]). %% Check that we do not trigger on the wrong pass check_wrong_pass() -> @@ -325,3 +329,13 @@ t44() -> %ssa% () when post_ssa_opt -> %ssa% _ = call(fun e:f0/1, {...}). e:f0({}). + +%% Ensure bug which trashed the environment after matching a literal +%% bitstring stays fixed. +check_env() -> +%ssa% () when post_ssa_opt -> +%ssa% X = bs_create_bin(append, _, <<>>, ...), +%ssa% ret(X). + A = <<>>, + B = ex:f(), + <<A/binary, B/binary>>. |