diff options
author | Mikael Pettersson <[email protected]> | 2010-08-27 22:00:53 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2010-08-30 15:43:27 +0200 |
commit | 499295576712b14314ebc8f9753af7f0e1198080 (patch) | |
tree | 6eeef10dbb6ac0aca89768bb38355ddf7ea7d673 /lib | |
parent | 2b2b92774d47c8b51cc25bb8bc1d7b4e356936d7 (diff) | |
download | otp-499295576712b14314ebc8f9753af7f0e1198080.tar.gz otp-499295576712b14314ebc8f9753af7f0e1198080.tar.bz2 otp-499295576712b14314ebc8f9753af7f0e1198080.zip |
fix crash in hipe_icode_exceptions
This fixes a problem in the HiPE compiler's BEAM-to-Icode
pass where it can crash due to the BEAM compiler's merging
of identical basic blocks with different exception handling
contexts. This bug has been latent, but is now exposed by
what appears to be more aggressive optimizations in BEAM.
The added comment explains things in more detail.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/hipe/icode/hipe_icode_exceptions.erl | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/hipe/icode/hipe_icode_exceptions.erl b/lib/hipe/icode/hipe_icode_exceptions.erl index 787fb05415..3c8f7b5712 100644 --- a/lib/hipe/icode/hipe_icode_exceptions.erl +++ b/lib/hipe/icode/hipe_icode_exceptions.erl @@ -344,6 +344,16 @@ pop_catch(Cs) -> pop_catch_1([[_|C] | Cs]) -> [C | pop_catch_1(Cs)]; +pop_catch_1([[] | Cs]) -> + %% The elements in the list represent different possible incoming + %% stacks of catch handlers to this BB. Before the fixpoint has + %% been found these elements are underapproximations of the true + %% stacks, therefore it's possible for these elements to be too + %% short for the number of pops implied by the code in the BB. + %% We must not fail in that case, so we set pop([]) = []. + %% This fixes find_catches_crash.erl and compiler_tests in the + %% HiPE test suite. + [[] | pop_catch_1(Cs)]; pop_catch_1([]) -> []. |