i downloaded gnat 14.1.1 and it does indeed crash with the code on Rosetta Code, but not with the changes i made. can you update to 14.1.1 and see if that fixes your problem? i’ll also fix the entry in Rosetta Code.
Note, added later: Is this a bug? Please answer here.