diff options
author | Björn Gustavsson <[email protected]> | 2018-02-27 08:39:28 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2018-03-01 11:30:41 +0100 |
commit | e07318afab8a4e2040c3d0321afcfc9fc978db5e (patch) | |
tree | 95f553773481a07bdc21f035fd45813c4aad034b /lib/compiler/test/beam_validator_SUITE.erl | |
parent | 478b43211bbe96018b63cbf6c6d567550a6e8a2c (diff) | |
download | otp-e07318afab8a4e2040c3d0321afcfc9fc978db5e.tar.gz otp-e07318afab8a4e2040c3d0321afcfc9fc978db5e.tar.bz2 otp-e07318afab8a4e2040c3d0321afcfc9fc978db5e.zip |
Enhance beam_validator to check proper nesting of try/catch and catch
Every catch or try/catch must use a lower Y register number than any
enclosing catch or try/catch. That will ensure that when the stack
is scanned when an exception occurs, the innermost try/catch tag is
found first.
Diffstat (limited to 'lib/compiler/test/beam_validator_SUITE.erl')
-rw-r--r-- | lib/compiler/test/beam_validator_SUITE.erl | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/compiler/test/beam_validator_SUITE.erl b/lib/compiler/test/beam_validator_SUITE.erl index 63a13281a8..b8fff7b100 100644 --- a/lib/compiler/test/beam_validator_SUITE.erl +++ b/lib/compiler/test/beam_validator_SUITE.erl @@ -33,7 +33,7 @@ state_after_fault_in_catch/1,no_exception_in_catch/1, undef_label/1,illegal_instruction/1,failing_gc_guard_bif/1, map_field_lists/1,cover_bin_opt/1, - val_dsetel/1,bad_tuples/1]). + val_dsetel/1,bad_tuples/1,bad_try_catch_nesting/1]). -include_lib("common_test/include/ct.hrl"). @@ -62,7 +62,7 @@ groups() -> state_after_fault_in_catch,no_exception_in_catch, undef_label,illegal_instruction,failing_gc_guard_bif, map_field_lists,cover_bin_opt,val_dsetel, - bad_tuples]}]. + bad_tuples,bad_try_catch_nesting]}]. init_per_suite(Config) -> Config. @@ -523,6 +523,14 @@ bad_tuples(Config) -> ok. +bad_try_catch_nesting(Config) -> + Errors = do_val(bad_try_catch_nesting, Config), + [{{bad_try_catch_nesting,main,2}, + {{'try',{y,2},{f,3}}, + 7, + {bad_try_catch_nesting,{y,2},[{{y,1},{trytag,[5]}}]}}}] = Errors, + ok. + %%%------------------------------------------------------------------------- transform_remove(Remove, Module) -> |