aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/vhdl/errorout.ads5
-rw-r--r--src/vhdl/sem_expr.adb12
-rw-r--r--src/vhdl/sem_expr.ads3
-rw-r--r--src/vhdl/translate/trans-chap7.adb6
4 files changed, 22 insertions, 4 deletions
diff --git a/src/vhdl/errorout.ads b/src/vhdl/errorout.ads
index 4a3b6fdf7..f512b0624 100644
--- a/src/vhdl/errorout.ads
+++ b/src/vhdl/errorout.ads
@@ -113,6 +113,9 @@ package Errorout is
-- Violation of pure rules.
Warnid_Pure,
+ -- Violation of staticness rules
+ Warnid_Static,
+
-- Any error
Msgid_Error,
@@ -121,7 +124,7 @@ package Errorout is
-- All specific warning messages.
subtype Msgid_Warnings is Msgid_Type
- range Warnid_Library .. Warnid_Pure;
+ range Warnid_Library .. Warnid_Static;
-- Get the image of a warning. This correspond the the identifier of ID,
-- in lower case, without the Msgid_Warn_ prefix and with '_' replaced
diff --git a/src/vhdl/sem_expr.adb b/src/vhdl/sem_expr.adb
index 1fc98c592..605530067 100644
--- a/src/vhdl/sem_expr.adb
+++ b/src/vhdl/sem_expr.adb
@@ -2597,6 +2597,18 @@ package body Sem_Expr is
end if;
end;
+ -- LRM93 7.3.2.2 Array aggregates
+ -- An others choice is locally static if the applicable index constraint
+ -- if locally static.
+ if Info.Nbr_Choices > 0
+ and then Info.Others_Choice /= Null_Iir
+ and then Get_Type_Staticness (Choice_Type) /= Locally
+ then
+ Warning_Msg_Sem
+ (Warnid_Static, +Info.Others_Choice,
+ "'others' choice allowed only if the index constraint is static");
+ end if;
+
if Reorder_Choices then
declare
Ngroups : Int32;
diff --git a/src/vhdl/sem_expr.ads b/src/vhdl/sem_expr.ads
index 5c976ac72..15ae1da39 100644
--- a/src/vhdl/sem_expr.ads
+++ b/src/vhdl/sem_expr.ads
@@ -156,7 +156,8 @@ package Sem_Expr is
Annex_Arr : Annex_Array_Acc;
end record;
- -- Compute the number of locally static choices and set Has_Others.
+ -- Compute the number of locally static choices (excluding others) and
+ -- set Has_Others.
procedure Count_Choices (Info : out Choice_Info_Type; Choice_Chain : Iir);
-- Allocate and fill INFO.ARR.
diff --git a/src/vhdl/translate/trans-chap7.adb b/src/vhdl/translate/trans-chap7.adb
index 2351f77bf..582b3be68 100644
--- a/src/vhdl/translate/trans-chap7.adb
+++ b/src/vhdl/translate/trans-chap7.adb
@@ -2929,6 +2929,8 @@ package body Trans.Chap7 is
Expr_Type : Iir;
Final : Boolean;
+ -- Assign EXPR to current position (defined by index VAR_INDEX), and
+ -- update VAR_INDEX. Handles sub-aggregates.
procedure Do_Assign (Expr : Iir) is
begin
if Final then
@@ -3013,8 +3015,8 @@ package body Trans.Chap7 is
-- There is only one choice
case Get_Kind (El) is
when Iir_Kind_Choice_By_Others =>
- -- falltrough...
- null;
+ -- Handled by positional.
+ raise Internal_Error;
when Iir_Kind_Choice_By_Expression =>
Do_Assign (Get_Associated_Expr (El));
return;