MikePopoloski / slang

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

-Wint-bool-conv does not flag in all cases #905

Closed jrudess closed 3 months ago

jrudess commented 3 months ago

Noticed some behavior I'm unsure about with -Wint-bool-conv. In this example, the first conditional is flagged, but not the 2nd.

slangtest153.sv:6:13: warning: implicit conversion from 'int' to boolean value [-Wint-bool-conv]
        if (v1.size()) begin
            ^~~~~~~~~
class C;
    int v1[$];
    int v2[$];

    function f();
        if (v1.size()) begin
        end
        if (v1.size() && v2.size()) begin
        end
    endfunction
endclass
MikePopoloski commented 3 months ago

Fixed in 5159c1791d34a36148e19a48f00790f68cc3d3ec

jrudess commented 3 months ago

Thanks a bunch for this fix -- just finished warning review and found some real bugs exposed by the warning.

MikePopoloski commented 3 months ago

Nice, glad to hear it.