Dear Maintainer,
The gvpr(1) graphviz scripting language treats arrays as a key-value
data structure. The for loop iterates over an array's indices in
numeric order, while the forr loop iterates in lexicographic order.
The man page says "This can be used for sorting."
When iterating through an array with double indices, Debian trixie's
gvpr can skip entries and pair mismatched keys and values.
This script should print the first five US presidents in order:
#!/usr/bin/env -S gvpr -f
BEGIN {
string presidents[double];
presidents[1.1] = "Washington";
presidents[2.1] = "Adams";
presidents[3.1] = "Jefferson";
presidents[4.1] = "Madison";
presidents[5.1] = "Monroe";
double i;
for (presidents[i]) {
printf("President %f was %s\n", i, presidents[i]);
}
}
Instead, it prints only three keys, out of order. Further, it prints
key 4.1 with the fifth value (Monroe instead of Madison) and key 2.1
with the third value (Jefferson instead of Adams):
President 4.100000 was Monroe
President 1.100000 was Washington
President 2.100000 was Jefferson
If the keys are changed to 1.0, 2.0, 3.0, 4.0, and 5.0 then it only
prints one row, with the wrong key-value pair:
President 1.000000 was Monroe
The output is the same if the variables are declared "float" rather than
"double". It's possible this is related to incorrect handling of 64-bit
integers in bug #1152240.
The program produces the expected output in Ubuntu 24.04 grapvis version
2.42.2-9ubuntu0.1. I didn't run this program before upgrading from
bookworm, but I do have a program which now gets incorrect array
iteration for double indexes:
https://github.com/flwyd/adventofcode/blob/main/2025/day8/day8.gv
Run as 2025/day8/day8.gv -v 2025/day8/input.example.txt