From 1f576163e1fb20887557f1a20b444a558a3c0239 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Thu, 19 Mar 2020 08:54:42 +0100 Subject: 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). --- src/vhdl/vhdl-sem_expr.adb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/vhdl/vhdl-sem_expr.adb') 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 -- cgit v1.2.3