aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgingold <gingold@b72b5c32-5f01-0410-b925-b5c7b92870f7>2008-06-02 04:37:43 +0000
committergingold <gingold@b72b5c32-5f01-0410-b925-b5c7b92870f7>2008-06-02 04:37:43 +0000
commit1a936bad663149eeb814bbef68a08d297314fb50 (patch)
tree2e98342afb64b3afbdd51b3c7d11aec967002760
parentcdaab3a58cf9cf8951e4bc02e321e5b2d3b3fbfe (diff)
downloadghdl-1a936bad663149eeb814bbef68a08d297314fb50.tar.gz
ghdl-1a936bad663149eeb814bbef68a08d297314fb50.tar.bz2
ghdl-1a936bad663149eeb814bbef68a08d297314fb50.zip
Avoid error propagation when aggregate choice is invalid.
-rw-r--r--sem_expr.adb23
1 files changed, 15 insertions, 8 deletions
diff --git a/sem_expr.adb b/sem_expr.adb
index a0d88eebd..820d727ff 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