aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/test/compilation_SUITE.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2010-11-26 09:22:44 +0100
committerBjörn Gustavsson <[email protected]>2010-11-26 10:25:07 +0100
commit8836ebccae92886decf5645944ae4ce8a2f99947 (patch)
tree797dfafe3ca5173d9ffb5bfba68bb2fe7959062a /lib/compiler/test/compilation_SUITE.erl
parent99a28d961d2d760e98353b55991f1fc51dee06b0 (diff)
downloadotp-8836ebccae92886decf5645944ae4ce8a2f99947.tar.gz
otp-8836ebccae92886decf5645944ae4ce8a2f99947.tar.bz2
otp-8836ebccae92886decf5645944ae4ce8a2f99947.zip
beam_utils: Fix liveness analysis for gc_bif instructions
When gc_bif instructions occurred outside of a block, beam_utils:check_liveness/3 did not take into account that the instruction could do a garbage collection, and could falsely report that an x register would be killed. That could cause the beam_dead pass to make the code unsafe by removing the assignment to an x register that would subsequently be referenced by the garbage collector. Reported-by: Christopher Williams
Diffstat (limited to 'lib/compiler/test/compilation_SUITE.erl')
-rw-r--r--lib/compiler/test/compilation_SUITE.erl26
1 files changed, 24 insertions, 2 deletions
diff --git a/lib/compiler/test/compilation_SUITE.erl b/lib/compiler/test/compilation_SUITE.erl
index 9c06740816..7b6975f912 100644
--- a/lib/compiler/test/compilation_SUITE.erl
+++ b/lib/compiler/test/compilation_SUITE.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1997-2009. All Rights Reserved.
+%% Copyright Ericsson AB 1997-2010. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -46,7 +46,7 @@ all(suite) ->
trycatch_4, opt_crash,
otp_5404,otp_5436,otp_5481,otp_5553,otp_5632,
otp_5714,otp_5872,otp_6121,otp_6121a,otp_6121b,
- otp_7202,otp_7345,on_load,string_table
+ otp_7202,otp_7345,on_load,string_table,otp_8949_a
].
-define(comp(N),
@@ -606,5 +606,27 @@ string_table(Config) when is_list(Config) ->
?line {"StrT", <<"stringabletringtable">>} = StringTableChunk,
ok.
+otp_8949_a(Config) when is_list(Config) ->
+ value = otp_8949_a(),
+ ok.
+
+-record(cs, {exs,keys = [],flags = 1}).
+-record(exs, {children = []}).
+
+otp_8949_a() ->
+ case id([#cs{}]) of
+ [#cs{}=Cs] ->
+ SomeVar = id(value),
+ if
+ Cs#cs.flags band 1 =/= 0 ->
+ id(SomeVar);
+ (((Cs#cs.exs)#exs.children /= [])
+ and
+ (Cs#cs.flags band (1 bsl 0 bor (1 bsl 22)) == 0));
+ Cs#cs.flags band (1 bsl 22) =/= 0 ->
+ ok
+ end
+ end.
+
id(I) -> I.