bug-gawk
[Top][All Lists]
Advanced

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

is my loop issue a data conversion bug?


From: Peter Lindgren
Subject: is my loop issue a data conversion bug?
Date: Mon, 13 Jul 2020 18:11:37 +0000 (UTC)

I hesitate to report this as a bug - maybe it's just some expected behavior I 
don't understand ("That's not a bug, its a feature!"). But here goes anyway...

The gist is that I have two nested loops, each of which - only under very 
particular circumstances - roams beyond its bounds. The attached awk programs 
are hacked down to just the necessary skeletons, from a real program of mine, 
actually the one that I was profiling recently and which ran so long on large 
inputs that I had to ask for 64-bit profiling counts. 

One called "lendemobad.awk" gives the bad or unexpected results , one called 
"lendemo.awk" gives the expected results. You can diff them to see how minimal 
the changes are - simply forcing the variable being used as the loop limit to 
numeric seems to fix things.

Run them both on the supplied test data file "lendemo.dat" and observe the 
differences in the outputs. There are comments in the programs highlighting the 
interesting bits.

Note: if you have any other email addresses for me, please reply only to this 
one starting "og..."

Regards,
Peter

Attachment: lendemobad.awk
Description: application/awk

Attachment: lendemo.dat
Description: Binary data

Attachment: lendemo.awk
Description: application/awk


reply via email to

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