diff options
author | Björn Gustavsson <[email protected]> | 2012-01-04 16:40:31 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2012-01-11 08:39:57 +0100 |
commit | 823f47c8cf3c7a4f32401cae5a2e47916d3593e4 (patch) | |
tree | 91a22170ccbb6c50d23e20f0ff35fafda8004bcf /lib/compiler/test/core_SUITE_data | |
parent | 1955804aaf831f943941555ab6f46ee22e5a0dac (diff) | |
download | otp-823f47c8cf3c7a4f32401cae5a2e47916d3593e4.tar.gz otp-823f47c8cf3c7a4f32401cae5a2e47916d3593e4.tar.bz2 otp-823f47c8cf3c7a4f32401cae5a2e47916d3593e4.zip |
v3_kernel: Handle sequences in guards
A guard with a sequence will cause a crash in v3_codegen. Currently,
it seems that a sequence in a guard will never happen when compiling
from Erlang code, but there are several reasons to fix this problem
anyway:
* There are other compilers that generate Core Erlang code.
* Changes to sys_core_fold (perhaps additional optimizations) may
cause sequences to be generated in guards.
* A previously uncovered line in sys_core_fold:opt_guard_try/1 will
now be covered.
Diffstat (limited to 'lib/compiler/test/core_SUITE_data')
-rw-r--r-- | lib/compiler/test/core_SUITE_data/seq_in_guard.core | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/lib/compiler/test/core_SUITE_data/seq_in_guard.core b/lib/compiler/test/core_SUITE_data/seq_in_guard.core new file mode 100644 index 0000000000..44686a7187 --- /dev/null +++ b/lib/compiler/test/core_SUITE_data/seq_in_guard.core @@ -0,0 +1,66 @@ +module 'seq_in_guard' ['seq_in_guard'/0, + 't'/1] + attributes [] +'seq_in_guard'/0 = + %% Line 4 + fun () -> + case <> of + <> when 'true' -> + let <_cor0> = + catch + %% Line 5 + apply 't'/1 + ({}) + in %% Line 5 + case _cor0 of + <{'EXIT',{'function_clause',_cor4}}> when 'true' -> + let <_cor2> = + catch + %% Line 6 + apply 't'/1 + ('atom') + in %% Line 6 + case _cor2 of + <{'EXIT',{'function_clause',_cor5}}> when 'true' -> + %% Line 7 + apply 't'/1 + ({'a','b'}) + ( <_cor3> when 'true' -> + primop 'match_fail' + ({'badmatch',_cor3}) + -| ['compiler_generated'] ) + end + ( <_cor1> when 'true' -> + primop 'match_fail' + ({'badmatch',_cor1}) + -| ['compiler_generated'] ) + end + ( <> when 'true' -> + ( primop 'match_fail' + ({'function_clause'}) + -| [{'function_name',{'seq_in_guard',0}}] ) + -| ['compiler_generated'] ) + end +'t'/1 = + %% Line 9 + fun (_cor0) -> + case _cor0 of + <X> + when try + do + call 'erlang':'element' + (2, X) + 'true' + of <Try> -> + Try + catch <T,R> -> + 'false' -> + %% Line 10 + 'ok' + ( <_cor3> when 'true' -> + ( primop 'match_fail' + ({'function_clause',_cor3}) + -| [{'function_name',{'t',1}}] ) + -| ['compiler_generated'] ) + end +end |