bug-gawk
[Top][All Lists]
Advanced

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

Re: fatal: typeof: unknown argument type `Node_param_list'


From: mekanofox
Subject: Re: fatal: typeof: unknown argument type `Node_param_list'
Date: Mon, 06 Jan 2025 13:18:51 +0000
User-agent: Purely Mail via Roundcube/1.6.8

... and in that case ...

function f(y, ifc) { y[3]=14; ifc="isarray"; return @ifc(y) } BEGIN { print f(z) } 0 # incorrect, because similarly do_isarray receives a Node_param_list ...

... should behave like:

  function f(y) { y[3]=14; return isarray(y) } BEGIN { print f(z) }
  1 # correct

... which means "do_isarray" needs the same treatment:

diff --git a/builtin.c b/builtin.c
index 382922dbc..17ee2c0ab 100644
--- a/builtin.c
+++ b/builtin.c
@@ -559,6 +559,10 @@ do_isarray(int nargs)
        check_exact_args(nargs, "isarray", 1);

        tmp = POP();
+
+       if (tmp->type == Node_param_list)
+               tmp = GET_PARAM(tmp->param_cnt);
+
        if (tmp->type != Node_var_array) {
                ret = 0;
                // could be Node_var_new




On 2025-01-06 12:47, arnold@skeeve.com wrote:

Hello.

Thanks for the report. The fix is below.

Arnold

Denis Shirokov <cosmogen@gmail.com> wrote:

Hello

found an issue while experimenting with indirect function calls:

func  _typeof( p ,f ) {
f = "awk::typeof"
return @f( p ) }

BEGIN{

f = "awk::typeof"
print "typeof: " @f( p )

print "_typeof: " _typeof( p )
}

outputs:

typeof: untyped'
gawk: ./bug.gwk:3: fatal: typeof: unknown argument type
`Node_param_list'

gawk:

GNU Awk 5.3.1, API 4.0, (GNU MPFR 4.0.2, GNU MP 6.1.2)

OS:

Windows 10 Pro (x64)
downloaded from: https://sourceforge.net/projects/ezwinports/files/

Best Regards
Denis Shirokov

-------------------------------------
diff --git a/builtin.c b/builtin.c
index f03ba701..e3beff7c 100644
--- a/builtin.c
+++ b/builtin.c
@@ -3113,6 +3113,10 @@ do_typeof(int nargs)
else
dbg = NULL;
arg = POP();
+
+    if (arg->type == Node_param_list)
+        arg = GET_PARAM(arg->param_cnt);
+
switch (arg->type) {
case Node_var_array:
/* Node_var_array is never UPREF'ed */



reply via email to

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