Merge pull request #786 from Forty-Bot/ivlpp_segfault_fix

ivlpp: Fix segfault in macro_start_args
This commit is contained in:
Stephen Williams 2022-10-30 16:00:49 -07:00 committed by GitHub
commit 74c52d6fa1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 2 deletions

View File

@ -1485,8 +1485,10 @@ static void macro_start_args(void)
* entry for arg 0. This will be used by macro_finish_arg() to * entry for arg 0. This will be used by macro_finish_arg() to
* calculate the buffer location for arg 1. * calculate the buffer location for arg 1.
*/ */
if (def_buf) {
def_buf_free = def_buf_size - 1; def_buf_free = def_buf_size - 1;
def_buf[0] = 0; def_buf[0] = 0;
}
def_argo[0] = 0; def_argo[0] = 0;
def_argl[0] = 0; def_argl[0] = 0;
def_argc = 1; def_argc = 1;

View File

@ -0,0 +1,8 @@
`ifndef FOO
`define FOO
`define BAR(x)
`endif
module macro_args();
macro_args_sub sub();
endmodule

View File

@ -0,0 +1,3 @@
module macro_args_sub();
`BAR(0)
endmodule

View File

@ -628,6 +628,7 @@ lh_varindx5 normal ivltests
localparam_type normal ivltests gold=parameter_type.gold localparam_type normal ivltests gold=parameter_type.gold
long_div normal ivltests gold=long_div.gold long_div normal ivltests gold=long_div.gold
macro2 normal ivltests macro2 normal ivltests
macro_args CO,-yivltests ivltests
macro_redefinition normal,-Wmacro-redefinition ivltests gold=macro_redefinition.gold macro_redefinition normal,-Wmacro-redefinition ivltests gold=macro_redefinition.gold
macro_replacement normal,-Wmacro-replacement ivltests gold=macro_replacement.gold macro_replacement normal,-Wmacro-replacement ivltests gold=macro_replacement.gold
macsub normal ivltests macsub normal ivltests