aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl/vhdl-sem_expr.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2020-03-19 08:54:42 +0100
committerTristan Gingold <tgingold@free.fr>2020-03-19 08:54:42 +0100
commit1f576163e1fb20887557f1a20b444a558a3c0239 (patch)
tree2845afbe9d9d736360ecb1369a2f8596311e42f0 /src/vhdl/vhdl-sem_expr.adb
parent3f84b2b046a375520a0d83b8b58ae42991915112 (diff)
downloadghdl-1f576163e1fb20887557f1a20b444a558a3c0239.tar.gz
ghdl-1f576163e1fb20887557f1a20b444a558a3c0239.tar.bz2
ghdl-1f576163e1fb20887557f1a20b444a558a3c0239.zip
vhdl-sem_expr: fix a wrong check in choices. For #1161
The number of positional associations can be less than the length of the array (as an expression can be a vector).
Diffstat (limited to 'src/vhdl/vhdl-sem_expr.adb')
-rw-r--r--src/vhdl/vhdl-sem_expr.adb5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/vhdl/vhdl-sem_expr.adb b/src/vhdl/vhdl-sem_expr.adb
index f990d02ff..8ca0503fe 100644
--- a/src/vhdl/vhdl-sem_expr.adb
+++ b/src/vhdl/vhdl-sem_expr.adb
@@ -2735,6 +2735,9 @@ package body Vhdl.Sem_Expr is
-- Staticness of all the choices.
Staticness : Iir_Staticness;
+ -- The choice was parsed as a choice by expression, but in fact the
+ -- expression is a range (eg: a subtype name). Change the choice by
+ -- a range choice.
function Replace_By_Range_Choice (Name : Iir; Range_Type : Iir)
return Boolean
is
@@ -2916,6 +2919,8 @@ package body Vhdl.Sem_Expr is
Pos_Max := Eval_Discrete_Type_Length (Choice_Type);
if (not Has_Others and not Is_Sub_Range)
and then Nbr_Pos < Pos_Max
+ -- For aggregates, a positional association can be a vector.
+ and then (Vhdl_Std < Vhdl_08 or Is_Case_Stmt)
then
Error_Msg_Sem (+Loc, "not enough elements associated");
elsif Nbr_Pos > Pos_Max then