aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2022-11-02 18:43:40 +0100
committerTristan Gingold <tgingold@free.fr>2022-11-02 20:58:22 +0100
commitbf5c6cda62ba36320ac2b9f133757ed9c6b8e5a6 (patch)
treefe8a0025dcf7da8085a6886e2bcee4dc7eb572f9 /src
parent0d61fecf1249a5c2ae83d933274ee9a638f6ec69 (diff)
downloadghdl-bf5c6cda62ba36320ac2b9f133757ed9c6b8e5a6.tar.gz
ghdl-bf5c6cda62ba36320ac2b9f133757ed9c6b8e5a6.tar.bz2
ghdl-bf5c6cda62ba36320ac2b9f133757ed9c6b8e5a6.zip
vhdl-sem_expr(sem_qualified_expression): relax staticness rules.
Fix #2238
Diffstat (limited to 'src')
-rw-r--r--src/vhdl/vhdl-sem_expr.adb12
1 files changed, 11 insertions, 1 deletions
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