diff options
author | John Högberg <[email protected]> | 2019-07-05 11:30:16 +0200 |
---|---|---|
committer | John Högberg <[email protected]> | 2019-07-05 11:33:38 +0200 |
commit | db2ab3f206934926123c3d3acd33dd7b4c6e84db (patch) | |
tree | f55950d4321e795ea6ef2082e59758156e13303c /lib/compiler | |
parent | f753a18b12051a7f7d9198a29c61a210332150c4 (diff) | |
download | otp-db2ab3f206934926123c3d3acd33dd7b4c6e84db.tar.gz otp-db2ab3f206934926123c3d3acd33dd7b4c6e84db.tar.bz2 otp-db2ab3f206934926123c3d3acd33dd7b4c6e84db.zip |
beam_call_types: Index must be >= 1 in setelement/2
Diffstat (limited to 'lib/compiler')
-rw-r--r-- | lib/compiler/src/beam_call_types.erl | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/compiler/src/beam_call_types.erl b/lib/compiler/src/beam_call_types.erl index d091b7866d..e72250ab37 100644 --- a/lib/compiler/src/beam_call_types.erl +++ b/lib/compiler/src/beam_call_types.erl @@ -198,7 +198,7 @@ types(erlang, element, [PosType, TupleType]) -> types(erlang, setelement, [PosType, TupleType, ArgType]) -> RetType = case {PosType,TupleType} of {#t_integer{elements={Index,Index}}, - #t_tuple{elements=Es0,size=Size}=T} -> + #t_tuple{elements=Es0,size=Size}=T} when Index >= 1 -> %% This is an exact index, update the type of said %% element or return 'none' if it's known to be out of %% bounds. @@ -212,7 +212,7 @@ types(erlang, setelement, [PosType, TupleType, ArgType]) -> none end; {#t_integer{elements={Min,Max}}, - #t_tuple{elements=Es0,size=Size}=T} -> + #t_tuple{elements=Es0,size=Size}=T} when Min >= 1 -> %% We know this will land between Min and Max, so kill %% the types for those indexes. Es = discard_tuple_element_info(Min, Max, Es0), |