MikePopoloski / slang

SystemVerilog compiler and language services
MIT License
558 stars 122 forks source link

[slang-tidy] Fix NoOldAlwaysSyntax checker segmentation fault #882

Closed likeamahoney closed 4 months ago

likeamahoney commented 4 months ago

By default LHSSymbol collector from ASTHelpers may store nullptr value when - assignment lhs is not lvalue directy (for example - {x} = 1;) and at another cases. Then it leads to segmentation fault at NoOldAlwaysSyntax checker when stored lhs value is dereferenced.

How to reproduce:

  1. Create an bug.sv file:
module top();
    logic n;
    always @(*) begin
        {n} = 1;
    end
endmodule
  1. Run NoOldAlwaysSyntax checker on it at any build. For example:
./build/gcc-11-release/bin/slang-tidy --config-file="Checks:-*, style-no-old-always-syntax"  bug.sv
MikePopoloski commented 4 months ago

Thanks for the PR!