From c99e29ef74907e7758765c3ca91540f19fee276b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Pasteur?= Date: Wed, 28 Jul 2010 09:53:16 +0200 Subject: [PATCH] Make sure to unalias type when checking for arrays --- compiler/heptagon/analysis/typing.ml | 8 ++++---- compiler/minils/mls_utils.ml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/compiler/heptagon/analysis/typing.ml b/compiler/heptagon/analysis/typing.ml index 6441ceb..374de39 100644 --- a/compiler/heptagon/analysis/typing.ml +++ b/compiler/heptagon/analysis/typing.ml @@ -204,12 +204,12 @@ let get_number_of_fields ty = | _ -> assert false let element_type ty = - match ty with + match unalias_type ty with | Tarray (ty, _) -> ty | _ -> error (Esubscripted_value_not_an_array ty) let array_size ty = - match ty with + match unalias_type ty with | Tarray (_, e) -> e | _ -> error (Esubscripted_value_not_an_array ty) @@ -818,7 +818,7 @@ and typing_iterator const_env h prod result_ty_list, typed_e_list and typing_array_subscript const_env h idx_list ty = - match ty, idx_list with + match unalias_type ty, idx_list with | ty, [] -> [], ty | Tarray(ty, exp), idx::idx_list -> ignore (expect_static_exp const_env (Tid Initial.pint) exp); @@ -835,7 +835,7 @@ and typing_array_subscript const_env h idx_list ty = (* This function checks that the array dimensions matches the subscript. It returns the base type wrt the nb of indices. *) and typing_array_subscript_dyn const_env h idx_list ty = - match ty, idx_list with + match unalias_type ty, idx_list with | ty, [] -> ty, [] | Tarray(ty, exp), idx::idx_list -> let typed_idx = expect const_env h (Tid Initial.pint) idx in diff --git a/compiler/minils/mls_utils.ml b/compiler/minils/mls_utils.ml index 8d953dd..0eb3ae9 100644 --- a/compiler/minils/mls_utils.ml +++ b/compiler/minils/mls_utils.ml @@ -26,7 +26,7 @@ let rec static_exp_of_exp e = (** @return the list of bounds of an array type*) let rec bounds_list ty = - match ty with + match Modules.unalias_type ty with | Tarray(ty, n) -> n::(bounds_list ty) | _ -> []