MikePopoloski / slang

SystemVerilog compiler and language services

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Linter crashes when encountering circular parameter definition

Mikkhael opened this issue · comments

Describe the bug
If a parameter is defined in terms of itself, using its hierarchical name, running Slang results in a crash, without outputting any linting results.

To Reproduce
Minimal example:

module M ();
	parameter P = M.P;
endmodule

Running on my Windows machine:

> slang .\slang_circular.sv --lint-only
> echo $LASTEXITCODE
-1073741571

Enabling --allow-hierarchical-const doesn't change anything.

Additional context
Interestingly, Questa and VCS by default allow hierarchical names in const context, also allowing for this circular definition, but it seems more like undefined behaviour than a feature.
Example code:

module M ();
	parameter P0  = M.P1 + 1;
	parameter P1  = M.P1 + 1;
	parameter P2  = M.P1 + 1;
	parameter P3  = M.P1 + 1;
	initial $display(P0, P1, P2, P3);
endmodule

In Questa, simulation prints 1 1 2 2, in VCS - 2 1 2 2