Skip to content

invalid-system-task-function not checked if multiple ifdefs are present in file #2256

Open
@matlupi

Description

@matlupi

Describe the bug

The rule [invalid-system-task-function] is not reported if the file contains multiple ifdefs

Test case (preferably reduced)

module test;
  logic a;
  logic clk;

`ifdef A
  c
  `ifndef B
    #(.A(1))
  `endif
  dut(
  .clk(clk)
      );
`endif

  `ifdef C
  initial
    a = $random();
  `endif
endmodule

Actual vs. expected behavior

False-positive? False-negative? Crash? Wrong diagnostic location?

False negative

What should have happened?

test.sv:17:9-15: $random is a forbidden system function or task, please use $urandom instead [Style: forbidden-system-functions] [invalid-system-task-function]

What happens

Error not reported for line 17.

Tested on versions

  • v0.0-3798-ga602f072
  • v0.0-3428-gcfcbb82b

NOTE:
If the ifndef B is removed (lines 7 and 9) the error is correctly flagged.

Metadata

Metadata

Assignees

No one assigned

    Labels

    style-linterVerilog style-linter issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions