Found a crash during elaboration when using nested generic packages and trying to access their fields
OS: Ubuntu 22.04
NVC version: latest stable release (1.20.0)
Minimal code to reproduce it (test.vhdl):
package pkg1 is
generic (a: natural);
end package;
package pkg1_inst is new work.pkg1 generic map (a => 2);
package pkg2 is
generic (
package pkg1_inst_sub is new work.pkg1 generic map (<>);
-- If this is removed, nvc appears to get stuck and never exit
-- (killed it after >1 min of no output)
constant b: natural
);
end package;
package pkg2_inst is new work.pkg2 generic map (
pkg1_inst_sub => work.pkg1_inst,
b => 0
);
entity Sub is
generic (
package pkg2_inst_sub is new work.pkg2 generic map (<>)
);
end;
architecture rtl of Sub is
package foo is new work.pkg1 generic map (
a => pkg2_inst_sub.pkg1_inst_sub.a
);
begin
end;
entity Top is
end;
architecture rtl of Top is
begin
sub: entity work.Sub generic map (work.pkg2_inst);
end;
Running nvc -a test.vhdl -e top-rtl produces the following output:
Name WORK.TOP.SUB.FOO
Kind package
Context WORK.TOP.SUB
Blocks 1
Registers 1
Types 2
Stamps 1
Variables 1
A // -2^31..2^31-1 => 0..2^31-1, constant
Begin
0: r0 := package init STD.STANDARD // P<STD.STANDARD>
** Fatal: (init): missing variable for generic A in WORK.TOP-RTL.elab
> test.vhdl:39
|
39 | sub: entity work.Sub generic map (work.pkg2_inst);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ while elaborating instance SUB
|
= Note: generic PKG2_INST_SUB => WORK.PKG2_INST
[0x55c47131a1e2]
[0x55c471329b79]
[0x55c4713ec54d]
[0x55c4713ec930]
[0x55c4713dc89d]
[0x55c4713e9a94]
[0x55c47141fd78]
[0x55c471438171]
[0x55c4714396e4]
[0x55c47144311e]
[0x55c47141f535]
[0x55c4714d7955]
[0x55c47146d690]
[0x55c47139cbdb]
[0x55c4713a5c18]
[0x55c4713a4c3f]
[0x55c4713a5c24]
[0x55c47134530c]
[0x55c471342157]
[0x55c471344063]
[0x55c471339cc3]
[0x76a45f029d8f] (/usr/lib/x86_64-linux-gnu/libc.so.6) ../sysdeps/nptl/libc_start_call_main.h:58 __libc_start_call_main
[0x76a45f029e3f] (/usr/lib/x86_64-linux-gnu/libc.so.6) ../csu/libc-start.c:392 __libc_start_main@@GLIBC_2.34
[0x55c47133b1d4]
nvc 1.20.0 (258d1f2) (Using LLVM 14.0.0) [x86_64-pc-linux-gnu]
Please report this bug at https://github.com/nickg/nvc/issues
Found a crash during elaboration when using nested generic packages and trying to access their fields
OS: Ubuntu 22.04
NVC version: latest stable release (1.20.0)
Minimal code to reproduce it (
test.vhdl):Running
nvc -a test.vhdl -e top-rtlproduces the following output: