Skip to content

Internal assertion when using conditional operator with strings inside a task #1459

Closed

Description

@Pidbip

Version

Icarus Verilog version 13.0 (stable) (v13_0)

Command

iverilog -g2012 test.sv

Test case

module test;

string a = "A";
string b = "B";

task t(input int verbosity);

    string color;
    color = (verbosity >= 3) ? a : b;

endtask

endmodule

Actual result

Assertion failed: ivl_expr_value(expr) == IVL_VT_BOOL ||
ivl_expr_value(expr) == IVL_VT_VECTOR,
file ../../iverilog-13_0/tgt-vvp/eval_vec4.c, line 1359

Expected result

The code should either compile successfully or produce a normal diagnostic if the construct is unsupported. It should not terminate with an internal assertion.

Workaround

Replacing the conditional operator with if/else avoids the assertion:

if (verbosity >= 3)
    color = a;
else
    color = b;

Activity

  1. caryr commented on Aug 4, 2026

    @caryr
    Collaborator

    This is an issue with the ternary operator. It may be related to #1298

  2. added a commit that references this issue on Sep 27, 2026
  3. caryr commented on Sep 27, 2026

    @caryr
    Collaborator

    This is fixed along with #1298 in the repo HEAD.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions