Interestingly, when I try the example code I get a STORAGE_ERROR at the tree iterator loop.
I'm running Debian under the Windows Subsystem for Linux. WSL1 does not allow you to adjust the stack size via ulimit.
The fix appears to be to turn on the compiler optimisation:
ebolar@Beowulf:~/Build/Ada/src$ gnatmake -s -g simpletree
gcc-6 -c -g simpletree.adb
simpletree.adb:3:11: warning: file name does not match unit name, should be "mway.adb"
gnatbind-6 -x simpletree.ali
gnatlink-6 simpletree.ali -g
ebolar@Beowulf:~/Build/Ada/src$ ./simpletree
Load up the tree
Check out the contents
raised STORAGE_ERROR : stack overflow or erroneous memory access
ebolar@Beowulf:~/Build/Ada/src$ gnatmake -s -g -O simpletree
gcc-6 -c -g -O simpletree.adb
simpletree.adb:3:11: warning: file name does not match unit name, should be "mway.adb"
gnatbind-6 -x simpletree.ali
gnatlink-6 simpletree.ali -g -O
ebolar@Beowulf:~/Build/Ada/src$ ./simpletree
Load up the tree
Check out the contents
1
2