[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Assignments into FUNCTAB resulting either strange output or hanging
From: |
Andrew J. Schorr |
Subject: |
Re: Assignments into FUNCTAB resulting either strange output or hanging |
Date: |
Wed, 8 Sep 2021 11:55:18 -0400 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Interesting. The docs say:
"Any attempt to assign to an element of 'FUNCTAB' also causes a fatal error."
So the main question in my mind is why these programs don't throw a fatal
error.
bash-4.2$ ./gawk 'BEGIN {print FUNCTAB[0] = 1}'
gawk: cmd. line:1: fatal: cannot assign to elements of FUNCTAB
bash-4.2$ ./gawk 'BEGIN {print FUNCTAB[0]}'
0
So it looks like implicit assignments are not being caught properly.
Regards,
Andy
On Wed, Sep 08, 2021 at 03:47:48AM +0000, Jason C. Kwan via Bug reports only
for gawk. wrote:
> Dear GNU,
> I've noticed a rather strange bug about FUNCTAB. Hope the attached outputs
> suffice to reproduce the bug on your end. Thanks
> Jason
> On my version
> gawk -VGNU Awk 5.1.0, API: 3.0 (GNU MPFR 4.1.0, GNU MP 6.2.1)Copyright (C)
> 1989, 1991-2020 Free Software Foundation.
> running on this machine
> Summary======= System Version: 20G95 Hardware Model:
> MacBookPro15,2 Board ID: Mac-827FB448E656EC26 Installed
> Memory Size: 16GB (17179869184) Page Size: 4096 Root
> Volume Type:
> SSD:1,HDD:0,FUSION:0,FDE:1,RAID:0,TINYSSD:0,IN:1,EX:0,INEX:0,APFS
> Root Volume Size: 931GB (1000240963584) SSD Name: APPLE SSD
> AP1024M SSD Revision: 1161.100 Discrete GPU Present: 0
> Total Time: 147:40:15 Dashboard Start: 2021-09-01 19:41:37
> Dashboard End: 2021-09-07 23:21:44
> Trying to do certain kinds of math operations on it feels like hanging (the
> final one involving multiplying b with negative infinity :
> gawk -e 'BEGIN{ a="0xFE"; print b= FUNCTAB[+a]; print a;
> c=sprintf("%400g",b); print sprintf(" b : \f [%s]\n c :
> \f[%x]\n",b^(log(0)*b),b-c) }'
> when the output field is wide enough, i get back plenty of numbers
> $ date | gawk -e '{ a="0xFE"; print b= FUNCTAB[+a]; print a;
> printf("%5.310e\n",b)
> }'6.9479e-3100xFE??877557937723776738480915850953617326454614839557284805662916966568868877681050291539531252788984962450113740560184771666730980762794177452495253156543738376885465183160063273903627419386098876475375492703298816675604655744333154725916842600693687989465574994335971031957663156586178727763726702e-310
...