Calling $display with real %t argument causes segfault in _vl_vsformat
Standalone minimal test case attached
Output running executable under GDB:
TestCase at 1 this is fine TestCase at 1 this is fine TestCase at 1 this is fine TestCase at 1 this is fine
Program received signal SIGSEGV, Segmentation fault. 0x000000000040510c in _vl_vsformat(std::string&, char const*, __va_list_tag*) () Missing separate debuginfos, use: debuginfo-install glibc-2.17-157.el7_3.1.x86_64 libgcc-4.8.5-11.el7.x86_64 libstdc++-4.8.5-11.el7.x86_64 (gdb) bt #0 0x000000000040510c in _vl_vsformat(std::string&, char const*, __va_list_tag*) () #1 0x0000000000407b2f in VL_WRITEF(char const*, ...) () #2 0x0000000000414254 in VBUG::_sequent__TOP__1(VBUG__Syms*) () #3 0x00000000004142ca in VBUG::_eval(VBUG__Syms*) () #4 0x0000000000414088 in VBUG::eval() () #5 0x000000000040226b in main ()
#1 Updated by Julien Margetts 4 months ago
The segfault seems to be dependent upon the %t time format output, and the call to $realtime also being present.
Without these, it works fine.
I was also surprised the time output by $display is always "1" in this case, even though I am incrementing time in the testbench, though I may be doing something wrong here ...
#2 Updated by Wilson Snyder 4 months ago
- Subject changed from Calling $display with run-time dependent %s arguments causes segfault in _vl_vsformat to Calling $display with real %t argument causes segfault in _vl_vsformat
- Category set to TranslationError
- Status changed from New to Resolved
- Assignee set to Wilson Snyder
Thanks for the test case.
Basically %t didn't support real numbers ($realtime).
Fixed in git towards 4.015.
#4 Updated by Wilson Snyder 4 months ago
Re time format:
IEEE does not say to print "ns" by default. I suspect what you have is a call to $timeformat specifying that string. Verilator doesn't implement $timeformat (see e.g. test_regress/t/t_display_time.v). If you want to have this supported please file a new bug, and it would be great if you would consider a patch to implement it (e.g. parse it, then pass into C file, then verilated.c saves the values to affect printing). Thanks
Also available in: Atom