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 #1386

Reading free memory after unrolling a gen loop

Added by Al Grant 9 months ago. Updated 8 months ago.

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

0%


Description

module top(output [1:0] o);
  for (genvar i = 0; i < 4; i++) begin: B
    reg [1:0] r;
    always begin
      r = 2'(i);
    end
  end
  assign o = B[0].r;
endmodule
valgrind memcheck shows a use-after-free issue.

As far as I can tell from the memcheck report and the debug trace, it looks like the unroller, when finished, deletes the 'for' node, but a later traversal then reaches something that was deleted.

This also shows up with verilator_bin_dbg, with better quality source info, but it needs --no-debug-leak.

History

#1 Updated by Wilson Snyder 9 months ago

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

This is caused by the B0 reference, but that's supported the code valgrind sees is actually looking for interfaces so the mis-reference is unlikely to cause real problems. Fix is non-trivial but will get to it shortly.

#2 Updated by Wilson Snyder 9 months ago

  • Status changed from Confirmed to Resolved

Fixed in git towards 4.010.

#3 Updated by Wilson Snyder 8 months ago

  • Status changed from Resolved to Closed

In 4.010.

Also available in: Atom