Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-Wconversion Flag Does Not Warn on Ternary Expression #1151

Open
hankhsu1996 opened this issue Oct 10, 2024 · 0 comments
Open

-Wconversion Flag Does Not Warn on Ternary Expression #1151

hankhsu1996 opened this issue Oct 10, 2024 · 0 comments

Comments

@hankhsu1996
Copy link

Describe the bug

When using a ternary expression in SystemVerilog code, slang does not issue a width mismatch warning when the -Wconversion flag is enabled. This behavior is inconsistent with direct assignments where the warning is correctly triggered.

To Reproduce

Run the following code with slang and the -Wconversion flag:

module test;
  initial begin
    static int a = 3;
    static int b = 5;
    static bit cond = 1;
    static longint result = 7;
    result = cond ? a : b;
  end
endmodule

When the assignment uses a ternary expression (result = cond ? a : b;), there is no warning, despite the width mismatch. However, when assigning directly without the ternary (result = a;), slang correctly triggers a warning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant