Menu

#1289 Parser: foreach and for loop needs to pop current_block_stack

closed-accepted
nobody
None
5
2016-10-27
2016-10-23
Henry Wong
No

Segfault if a for loop (with variable declaration) or a foreach loop is used inside a named block or a block that declares variables.

Root cause seems to be parser forgetting to pop the current_block_stack after processing one of these two statements, which ends up creating a loop in the Statement tree. The segfault happens later during PBlock::elaborate_scope when it hits infinite recursion.

1 Attachments

Discussion

  • Henry Wong

    Henry Wong - 2016-10-23

    Some test cases: The first three will trigger the bug, but the last doesn't.
    1: Inside a block that declares a variable (reg a)
    2: Inside a named block
    3: The same thing with foreach
    4: This passes because the initial block isn't named, and no variables are declared.

    I tested with iverilog -g2012 to enable SystemVerilog features.

     
  • Stephen Williams

    Applied to git mater.

     
  • Stephen Williams

    • status: open --> closed-accepted
     

Log in to post a comment.