diff options
author | Tristan Gingold | 2015-05-27 20:26:19 +0200 |
---|---|---|
committer | Tristan Gingold | 2015-05-27 20:26:19 +0200 |
commit | e6e48d8d7b38e991d6e79c1dc897277582de2fd0 (patch) | |
tree | 15c21eb1c5499a04bd69d76950442be3500c67f7 /src/vhdl/sem_expr.adb | |
parent | 047b277b31f1d830f3fc72933d9fbb388f8cbdd0 (diff) | |
download | ghdl-e6e48d8d7b38e991d6e79c1dc897277582de2fd0.tar.gz ghdl-e6e48d8d7b38e991d6e79c1dc897277582de2fd0.tar.bz2 ghdl-e6e48d8d7b38e991d6e79c1dc897277582de2fd0.zip |
Avoid a crash for out of range choice in aggregate.
Fix ticket 83.
Diffstat (limited to 'src/vhdl/sem_expr.adb')
-rw-r--r-- | src/vhdl/sem_expr.adb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/vhdl/sem_expr.adb b/src/vhdl/sem_expr.adb index 474980c..bef2c73 100644 --- a/src/vhdl/sem_expr.adb +++ b/src/vhdl/sem_expr.adb @@ -2725,9 +2725,8 @@ package body Sem_Expr is Pos_Max : Iir_Int64; E_Pos : Iir_Int64; - Bt : Iir; + Bt : constant Iir := Get_Base_Type (Sub_Type); begin - Bt := Get_Base_Type (Sub_Type); if not Is_Sub_Range and then Get_Type_Staticness (Sub_Type) = Locally and then Type_Has_Bounds @@ -2737,6 +2736,11 @@ package body Sem_Expr is Lb := Low; Hb := High; end if; + if Lb = Null_Iir or else Hb = Null_Iir then + -- Return now in case of error. + Free (Arr); + return; + end if; -- Checks all values between POS and POS_MAX are handled. Pos := Eval_Pos (Lb); Pos_Max := Eval_Pos (Hb); |