diff --git a/docs/CONTRIBUTORS b/docs/CONTRIBUTORS index f20d2519b..9b75ecf02 100644 --- a/docs/CONTRIBUTORS +++ b/docs/CONTRIBUTORS @@ -206,6 +206,7 @@ Richard Myers Risto Pejašinović Robert Balas Robin Heinemann +Rodrigo Batista de Moraes Rupert Swarbrick Ryan Ziegler Ryszard Rozak diff --git a/src/V3Number.cpp b/src/V3Number.cpp index d483c0cf3..ea9be8a29 100644 --- a/src/V3Number.cpp +++ b/src/V3Number.cpp @@ -746,10 +746,7 @@ string V3Number::displayed(FileLine* fl, const string& vformat) const VL_MT_STAB if (width() > 8) fl->v3warn(WIDTHTRUNC, "$display-like format of %c format of > 8 bit value"); const unsigned int v = bitsValue(0, 8); - char strc[2]; - strc[0] = v & 0xff; - strc[1] = '\0'; - str = strc; + str.push_back(static_cast(v)); return str; } case 's': { diff --git a/test_regress/t/t_sys_file_null.py b/test_regress/t/t_sys_file_null.py index 29e82f03c..6f9225ca3 100755 --- a/test_regress/t/t_sys_file_null.py +++ b/test_regress/t/t_sys_file_null.py @@ -16,7 +16,7 @@ test.compile() test.execute() filename = test.obj_dir + "/zeros.log" -if os.path.getsize(filename) != 16: +if os.path.getsize(filename) != 20: test.error(filename + ": Wrong file size") test.passes() diff --git a/test_regress/t/t_sys_file_null.v b/test_regress/t/t_sys_file_null.v index 32b2ef685..de152ce3a 100644 --- a/test_regress/t/t_sys_file_null.v +++ b/test_regress/t/t_sys_file_null.v @@ -10,6 +10,8 @@ module t; integer fd, cnt; initial begin fd = $fopen({`STRINGIFY(`TEST_OBJ_DIR),"/zeros.log"}, "w"); + for (cnt = 0; cnt < 4; cnt = cnt + 1) + $fwrite(fd, "%c", 8'd0); for (cnt = 0; cnt < 16; cnt = cnt + 4) $fwrite(fd, "%u", 32'd0); $fclose(fd);