bug-gawk
[Top][All Lists]
Advanced

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

SYMTAB array does not work properly. It is semi-read-only.


From: Евгений
Subject: SYMTAB array does not work properly. It is semi-read-only.
Date: Tue, 4 Apr 2023 22:22:24 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.1

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -g -ffile-prefix-map=/build/gawk/src=/usr/src/debug/gawk -flto=auto -DNDEBUG uname output: Linux ideapad 6.1.21-1-MANJARO #1 SMP PREEMPT_DYNAMIC Wed Mar 22 21:14:13 UTC 2023 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

Gawk Version: 5.2.1

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:
SYMTAB array does not work properly. It is semi-read-only.
I thought it's like an 'eval' function in JavaScript, or a read-only array. It is open for writing, but it can't be written without immediately calling the variable just placed in it. This bug has been around for a long time.
Also sometimes SYMTAB lacks variables that were recently assigned.

Repeat-By:
$ gawk 'BEGIN{SYMTAB["foo"]="bar"}'
gawk: cmd. line:1: fatal: cannot assign to arbitrary elements of SYMTAB
$ gawk 'BEGIN{SYMTAB["foo"]="bar";print SYMTAB["foo"]}'
gawk: cmd. line:1: fatal: cannot assign to arbitrary elements of SYMTAB
$ gawk 'BEGIN{SYMTAB["foo"]="bar";print foo;print SYMTAB["foo"]}'
bar
bar



reply via email to

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