diff options
author | Kostis Sagonas <[email protected]> | 2018-06-11 17:47:37 +0200 |
---|---|---|
committer | Kostis Sagonas <[email protected]> | 2018-06-11 17:47:37 +0200 |
commit | 992a1f18934f071858b5e87f32bda5b49bed637d (patch) | |
tree | 8c80b41f4c6ea7b0066a4d6af94ef16cb0a99d15 /lib/hipe/test/basic_SUITE_data | |
parent | cf2ad431487cb533aac2854843aa61b8e1e5af62 (diff) | |
download | otp-992a1f18934f071858b5e87f32bda5b49bed637d.tar.gz otp-992a1f18934f071858b5e87f32bda5b49bed637d.tar.bz2 otp-992a1f18934f071858b5e87f32bda5b49bed637d.zip |
Fix a crash ih HoPE's lazy code motion pass
Some change in the BEAM compiler resulted in the creation of basic
blocks that differed from those previously created by the compiler.
As a result, the lazy code motion pass of RTL crashed when compiling
some of the new code.
Crashes were privately reported by @richcarl.
Diffstat (limited to 'lib/hipe/test/basic_SUITE_data')
-rw-r--r-- | lib/hipe/test/basic_SUITE_data/basic_issues_hipe.erl | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/lib/hipe/test/basic_SUITE_data/basic_issues_hipe.erl b/lib/hipe/test/basic_SUITE_data/basic_issues_hipe.erl index e71045bfe2..860d882632 100644 --- a/lib/hipe/test/basic_SUITE_data/basic_issues_hipe.erl +++ b/lib/hipe/test/basic_SUITE_data/basic_issues_hipe.erl @@ -8,8 +8,9 @@ -export([test/0]). -%% functions that need to be exported so that they are retained. --export([auth/4]). +%% functions that need to be exported so that they are retained and/or +%% not specialized away by the compiler. +-export([auth/4, wxSizer_replace/2, parent_class/1]). test() -> ok = test_dominance_trees(), @@ -18,6 +19,7 @@ test() -> ok = test_bif_fails(), ok = test_find_catches(), ok = test_heap_allocate_trim(), + ok = wxSizer_replace(), ok. %%-------------------------------------------------------------------- @@ -151,3 +153,25 @@ get_next_retry(Error, Count) -> end. pair(A, B) -> {A, B}. + +%%-------------------------------------------------------------------- +%% Date: June 11, 2018 +%% +%% Stripped down test case (from `wxSizer') that crashed the lazy code +%% motion pass of the HiPE compiler in a pre-release of Erlang/OTP 21. +%% A similar crash existed in `ssl_correction'. +%%-------------------------------------------------------------------- + +wxSizer_replace() -> + wxSizer_replace(wxSizer, wxSizer). + +-define(CLASS(Type, Class), ((Type) =:= Class) orelse (Type):parent_class(Class)). + +wxSizer_replace(OldwinT, NewwinT) -> % this function was the culprit + ?CLASS(OldwinT, wxSizer), + ?CLASS(NewwinT, wxSizer), + ok. + +parent_class(wxWindow) -> true; +parent_class(wxEvtHandler) -> true; +parent_class(_Class) -> erlang:error({badtype, ?MODULE}). |