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

Calling $display with real %t argument causes segfault in _vl_vsformat #1443

Closed
veripoolbot opened this issue May 16, 2019 · 5 comments
Closed
Assignees
Labels
resolution: fixed Closed; fixed

Comments

@veripoolbot
Copy link
Contributor


Author Name: Julien Margetts
Original Redmine Issue: 1443 from https://www.veripool.org

Original Assignee: Wilson Snyder (@wsnyder)


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 ()

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Julien Margetts
Original Date: 2019-05-16T15:44:12Z


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 ...

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2019-05-16T23:39:04Z


Thanks for the test case.

Basically %t didn't support real numbers ($realtime).

Fixed in git towards 4.015.

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Julien Margetts
Original Date: 2019-05-21T14:14:24Z


Great, fix confirmed, thanks.

One very minor observation. For consistency with other simulators, could we suffix %t output with "ns/us" to distinguish the value as a time?

Suggested patch attached

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2019-05-22T02:02:36Z


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

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2019-06-16T13:58:43Z


In 4.016.

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

No branches or pull requests

2 participants