Project

General

Profile

[logo] 
 
Home
News
Activity
About/Contact
Major Tools
  Dinotrace
  Verilator
  Verilog-mode
  Verilog-Perl
Other Tools
  BugVise
  CovVise
  Force-Gate-Sim
  Gspice
  IPC::Locker
  Rsvn
  SVN::S4
  Voneline
  WFH
General Info
  Papers

Issue #1385

Uninitialized data written to dependency file, if executable is found from PATH

Added by Al Grant 3 months ago. Updated about 2 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
TranslationError
% Done:

0%


Description

The Perl script (i.e. "verilator") tries various ways to find the executable ("verilator_bin") one of which is to fall back to PATH:
$bin = $basename;  # Find in PATH
When this happens, verilator_bin is called with argv0 set to just "verilator_bin". This adds "verilator_bin" as a dependency and then when V3FileDependImp::writeTimes() is called, loadStats() will try to stat("verilator_bin") and fail (stat doesn't search PATH), but this failure isn't checked and writeTimes() will write data from uninitialized memory to the dependency file.

It's simple enough to check for failure but it would be good to write the correct dependency. One way would be to do the PATH lookup explicitly, either in the Perl wrapper or in the executable, but a neater solution under Linux might be to ignore argv0 and use readlink("/proc/self/exe") to get the actual executable name.

History

#1 Updated by Al Grant 3 months ago

Also the same thing happens if you bypass the Perl script and use
verilator_bin --cc mytop.v
Everything seems to work except it puts some uninitialized data in Vmytop__verFiles.dat.

#2 Updated by Wilson Snyder 3 months ago

  • Category set to TranslationError
  • Status changed from New to Resolved
  • Assignee set to Wilson Snyder

Uninit problem fixed in git towards 4.010.

I tried a patch using the exe name, but this causes a problem in that generated makefiles use the whole pathname which breaks some distributed build systems with differing paths. It's also not easily portable to windows.

#3 Updated by Wilson Snyder about 2 months ago

  • Status changed from Resolved to Closed

In 4.010.

Also available in: Atom