Menu

#1016 vvp incorrectly exits on termination of a begin/end

v10
closed-fixed
nobody
None
5
2017-09-17
2017-07-22
No

git, v10-branch

The attached zip is compiler-generated V95 output, apart from the indenting and the comments. The expected output is:

Incr/decr operators...      
line 91, CHECK_RES
line 91-1, CHECK_RES
line 91-2B, CHECK_RES
line 91-B, cleared _$ID111
line 91-C, done
line 91: completed

However, vvp/a.out exits in between the final two $write calls (in other words, 'line 91: completed' does not appear).

1 Attachments

Discussion

  • Evan Lavelle

    Evan Lavelle - 2017-07-22

    Note that this worked in earlier versions of iverilog.

     
  • Cary R.

    Cary R. - 2017-07-27
    • Group: devel --> v10
     
  • Cary R.

    Cary R. - 2017-07-27

    I can confirm V10 produces different results then devel which produced the following:

    Incr/decr operators...
    line 91, CHECK_RES
    line 91-1, CHECK_RES
    line 91-2B, CHECK_RES
    line 91-B, cleared $ID111
    line 91-C, done
    line 91: completed
    line 92, CHECK_RES
    line 93, CHECK_RES
    line 94, CHECK_RES
    line 100, arithmetic
    line 103, CHECK_RES
    in
    $L59...
    incr passcount...
    done
    test complete: 30 passes, 0 fails

    Which is more than you indicated above.

     
  • Martin Whitaker

    Martin Whitaker - 2017-07-27

    The commit that results in this passing in devel is 2fedb4942ec7537b26a4d9ac26e4e8606fda019b. And indeed, applying that change to v10 appears to fix the problem. But I suspect that is just masking the real problem, which is likely a buffer overrun or rogue pointer. I can also get the test to pass in v10 by:

    --- a/vvp/vpi_scope.cc
    +++ b/vvp/vpi_scope.cc
    @@ -428,7 +428,7 @@ void vpip_attach_to_scope(struct __vpiScope*scope, vpiHandle obj)
    
           if (scope->intern == 0)
                scope->intern = (vpiHandle*)
    -                 malloc(sizeof(vpiHandle));
    +                 malloc(10*sizeof(vpiHandle));
           else
                scope->intern = (vpiHandle*)
                      realloc(scope->intern, sizeof(vpiHandle)*scope->nintern);
    

    but fail again if I increase the initial allocation to 100*sizeof(vpiHandle). I can't spot any problem with that section of code.

    I guess it's time to run with valgrind...

     
  • Martin Whitaker

    Martin Whitaker - 2017-07-27

    Forgot to say: if I comment out the two disable statements in task _$ID32, that also causes the test to pass.

     
  • Martin Whitaker

    Martin Whitaker - 2017-09-17
    • status: open --> closed-fixed
     
  • Martin Whitaker

    Martin Whitaker - 2017-09-17

    This should now be fixed in both the master and v10 branches. Please reopen this bug if you find otherwise.

     

Log in to post a comment.