From bf5c6cda62ba36320ac2b9f133757ed9c6b8e5a6 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Wed, 2 Nov 2022 18:43:40 +0100 Subject: vhdl-sem_expr(sem_qualified_expression): relax staticness rules. Fix #2238 --- src/vhdl/vhdl-sem_expr.adb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/vhdl/vhdl-sem_expr.adb b/src/vhdl/vhdl-sem_expr.adb index 3f4d7890b..5b5010319 100644 --- a/src/vhdl/vhdl-sem_expr.adb +++ b/src/vhdl/vhdl-sem_expr.adb @@ -4668,11 +4668,21 @@ package body Vhdl.Sem_Expr is -- i) A qualified expression whose type mark denotes a locally static -- subtype and whose operand is a locally static expression. -- - -- We always use the vhdl08, because it is weird to have locally + -- We use the vhdl08 definition, because it is weird to have locally -- static expression with a non-locally static subtype. Set_Expr_Staticness (Expr, Min (Get_Expr_Staticness (Res), Get_Type_Staticness (N_Type))); + -- But be nice with vhdl93 if the type mark is an array type definition. + -- In that case copy the type from the expression. + if Flags.Vhdl_Std < Vhdl_08 + and then Get_Kind (N_Type) = Iir_Kind_Array_Type_Definition + and then Get_Expr_Staticness (Res) >= Globally + then + Set_Expr_Staticness (Expr, Get_Expr_Staticness (Res)); + Set_Type (Expr, Get_Type (Res)); + end if; + -- When possible, use the type of the expression as the type of the -- qualified expression. -- TODO: also handle unbounded subtypes, but only if this is a proper -- cgit v1.2.3