bug-gawk
[Top][All Lists]
Advanced

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

gawk-5.2.2: fatal: attempt to use scalar parameter `a' as an array


From: Rajeev V. Pillai
Subject: gawk-5.2.2: fatal: attempt to use scalar parameter `a' as an array
Date: Sun, 4 Jun 2023 09:13:30 +0000 (UTC)

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: freebsd13.2
Compiler: clang
Compilation CFLAGS: -Wall -O2 -flto -fpie -fstack-protector-all 
-fomit-frame-pointer -march=native -pipe -DNDEBUG
uname output: FreeBSD x202e 13.2-RELEASE FreeBSD 13.2-RELEASE MYKERNEL amd64
Machine Type: x86_64-unknown-freebsd13.2

Gawk Version: 5.2.2

Attestation 1:
    I have read https://www.gnu.org/software/gawk/manual/html_node/Bugs.html.
    Yes

Attestation 2:
    I have not modified the sources before building gawk.
    True

Description:
    Given this program:

```
function add(a, s,    n) {
    n = length(a)
    a[++n] = s
    return n
}

BEGIN {
    # delete A    # turn scalar -> array (for gawk & mawk)
    add(A, "aaa")
    add(A, "b")
    print length(A)
}
```

    gawk-5.2.2 says:

```
$ gawk -f array.awk
gawk: array.awk:3: fatal: attempt to use scalar parameter `a' as an array
$
```

    Uncommenting the `delete A` fixes the issue.

Repeat-By:
    As above.


reply via email to

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