bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] `exit' statement issue


From: Aharon Robbins
Subject: Re: [bug-gawk] `exit' statement issue
Date: Mon, 03 Jun 2013 19:42:45 +0300
User-agent: Heirloom mailx 12.5 6/20/10

Hello all.

> From: address@hidden
> Date: Mon, 03 Jun 2013 05:55:40 -0600
> To: address@hidden, address@hidden
> Subject: Re: [bug-gawk] `exit' statement issue
> Cc: address@hidden, address@hidden
>
> Denis Shirokov <address@hidden> wrote:
>
> > So, is this also reproducible on Linux?
>
> Yes.  The short program
>
>       function fn() { exit }
>       BEGIN { A[fn()] }
>
> causes the error. I have a fix, which I will post, eventually. I am
> busy at the moment with things that are higher priority than gawk,
> or catching up on my emails.

Here is the fix.

Arnold
----------------------------------------
diff --git a/eval.c b/eval.c
index 4965988..cf2264b 100644
--- a/eval.c
+++ b/eval.c
@@ -1462,7 +1462,13 @@ unwind_stack(long n)
                        freenode(r);
                        break;
                default:
-                       if (in_main_context())
+                       /*
+                        * Check `exiting' and don't produce an error for
+                        * cases like:
+                        *      func     _fn0() { exit }
+                        *      BEGIN { ARRAY[_fn0()] }
+                        */
+                       if (in_main_context() && ! exiting)
                                fatal(_("unwind_stack: unexpected type `%s'"),
                                                nodetype2str(r->type));
                        /* else 



reply via email to

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