From 56efec8ed19c3584829feea00ce57d3ec4203e54 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 2 Jan 2023 15:59:13 -0800 Subject: [PATCH] tgt-vlog95: Don't strip null-bytes from string literals in structural elements The vlog95 backend currently strips null-bytes from strings in structural elements. E.g. `assign y = "a\000b"` gets translated to `assign y = "ab"`. This changes the behavior of the generated output compared to the input. Don't ignore the null-bytes to make sure the behavior stays the same. Signed-off-by: Lars-Peter Clausen --- tgt-vlog95/misc.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/tgt-vlog95/misc.c b/tgt-vlog95/misc.c index 8c2b8c2c83..248dfeb3b9 100644 --- a/tgt-vlog95/misc.c +++ b/tgt-vlog95/misc.c @@ -512,8 +512,6 @@ static void emit_number_as_string(ivl_net_const_t net_const) val |= (bits[idx-bit] == '1') ? 1 << (7-bit) : 0x00; } - /* Skip any NULL bytes. */ - if (val == 0) continue; /* Print some values that can be escaped. */ if (val == '"') fprintf(vlog_out, "\\\""); else if (val == '\\') fprintf(vlog_out, "\\\\");