aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2022-07-02 07:38:50 +0200
committerTristan Gingold <tgingold@free.fr>2022-07-02 07:38:50 +0200
commit48105de5752700a8625a89027d3617907bb503a8 (patch)
treebc36f4540aceb35e8036f1b476e8988a306b98a8 /src
parent718f9549bba57d358fc9e06d18f7ca6385266df6 (diff)
downloadghdl-48105de5752700a8625a89027d3617907bb503a8.tar.gz
ghdl-48105de5752700a8625a89027d3617907bb503a8.tar.bz2
ghdl-48105de5752700a8625a89027d3617907bb503a8.zip
vhdl-sem_decls: avoid crash on self use of a generic package.
For #2116
Diffstat (limited to 'src')
-rw-r--r--src/vhdl/vhdl-sem_decls.adb10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/vhdl/vhdl-sem_decls.adb b/src/vhdl/vhdl-sem_decls.adb
index 282137e90..843b24123 100644
--- a/src/vhdl/vhdl-sem_decls.adb
+++ b/src/vhdl/vhdl-sem_decls.adb
@@ -505,6 +505,16 @@ package body Vhdl.Sem_Decls is
return;
end if;
+ if Get_Is_Within_Flag (Pkg) then
+ -- Looks obvious, but there is apparently no such rule in the LRM.
+ -- Catch error like:
+ -- package gen is
+ -- generic(package g2 is new gen generic map(<>));
+ -- end;
+ Error_Msg_Sem (+Inter, "generic package formal cannot be itself");
+ return;
+ end if;
+
if Get_Generic_Map_Aspect_Chain (Inter) /= Null_Iir then
Sem_Generic_Association_Chain (Get_Package_Header (Pkg), Inter);
-- Not yet fully supported - need to check the instance.