summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sem_expr.adb23
1 files changed, 15 insertions, 8 deletions
diff --git a/sem_expr.adb b/sem_expr.adb
index a0d88ee..820d727 100644
--- a/sem_expr.adb
+++ b/sem_expr.adb
@@ -2827,14 +2827,21 @@ package body Sem_Expr is
-- index subtype of the aggregate and the smallest and largest
-- choice given.
if Choice_Staticness = Locally then
- case Get_Direction (Index_Constraint) is
- when Iir_To =>
- Set_Left_Limit (Index_Subtype_Constraint, Low);
- Set_Right_Limit (Index_Subtype_Constraint, High);
- when Iir_Downto =>
- Set_Left_Limit (Index_Subtype_Constraint, High);
- Set_Right_Limit (Index_Subtype_Constraint, Low);
- end case;
+ if Low = Null_Iir or High = Null_Iir then
+ -- Avoid error propagation.
+ Set_Range_Constraint (Info.Index_Subtype,
+ Get_Range_Constraint (Index_Type));
+ Free_Iir (Index_Subtype_Constraint);
+ else
+ case Get_Direction (Index_Constraint) is
+ when Iir_To =>
+ Set_Left_Limit (Index_Subtype_Constraint, Low);
+ Set_Right_Limit (Index_Subtype_Constraint, High);
+ when Iir_Downto =>
+ Set_Left_Limit (Index_Subtype_Constraint, High);
+ Set_Right_Limit (Index_Subtype_Constraint, Low);
+ end case;
+ end if;
else
-- Dynamic aggregate.
declare