bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Assertion failed


From: arnold
Subject: Re: Assertion failed
Date: Thu, 09 Jan 2020 01:15:42 -0700
User-agent: Heirloom mailx 12.5 7/5/10

Hi.

Thanks for sending a program. That makes it possible to find
the problem. The fix is below.

Arnold

Denis Shirokov <address@hidden> wrote:

> hello
>
> this is reproducing script for the issue:
>
> # gawk.exe -b -s -f ./bug_assertion.gwk ./bug_assertion.gwk
>
> BEGIN{
>       
>       abc( "varname" )
>
>       varname
>
> }
>
> func  abc( n ) {
>       
>       if ( n in SYMTAB ) {
>               
>               print "before"
>               
>               is = SYMTAB[ n ]
>               
>               print "after" } }
>
> # before
> # Assertion failed: n->type == Node_val, file node.c, line 304
>
> # GNU Awk 5.0.1, API: 2.0 (GNU MPFR 3.1.5, GNU MP 6.1.2)
>
>
> reproduce file attached
>
>
> best regards
> Denis Shirokov

-----------------------------------------------------
diff --git a/interpret.h b/interpret.h
index 4a7979b..d157b5b 100644
--- a/interpret.h
+++ b/interpret.h
@@ -288,6 +288,11 @@ uninitialized_scalar:
                                }
                                if (r->type == Node_var)
                                        r = r->var_value;
+                               else if (r->type == Node_var_new) {
+                                       // variable may exist but have never 
been set.
+                                       r->var_value = dupnode(Nnull_string);
+                                       r = r->var_value;
+                               }
                        }
 
                        if (r->type == Node_val)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]