]> git.ipfire.org Git - thirdparty/gcc.git/commit
atree.ads, atree.adb (Traverse_Func): Walk Field2 last, and eliminate the resulting...
authorBob Duff <duff@adacore.com>
Wed, 19 Dec 2007 16:22:40 +0000 (17:22 +0100)
committerArnaud Charlet <charlet@gcc.gnu.org>
Wed, 19 Dec 2007 16:22:40 +0000 (17:22 +0100)
commit10303118b35501a5e2f26fdaf91a3732e10cd9d7
tree332b098dbd6b86d59d72a861304c31b6b5b32d63
parent160df9790776eba4c811b18c96c8e7e83d02835e
atree.ads, atree.adb (Traverse_Func): Walk Field2 last, and eliminate the resulting tail recursion by hand.

2007-12-19  Bob Duff  <duff@adacore.com>

* atree.ads, atree.adb (Traverse_Func): Walk Field2 last, and eliminate
the resulting tail recursion by hand. This prevents running out of
memory on deeply nested concatenations, since Field2 is where the left
operand of concatenations is stored.
Fix bug (was returning OK_Orig in some cases). Fix return subtype to
clarify that it can only return OK or Abandon.

* sem_res.adb (Resolve_Op_Concat): Replace the recursion on the left
operand by iteration, in order to avoid running out of memory on
deeply-nested concatenations. Use the Parent pointer to get back up the
tree.
(Resolve_Op_Concat_Arg, Resolve_Op_Concat_First,
 Resolve_Op_Concat_Rest): New procedures split out of
Resolve_Op_Concat, so the iterative algorithm in Resolve_Op_Concat is
clearer.

* checks.adb (Remove_Checks): Use Traverse_Proc instead of
Traverse_Func, because the former already takes care of discarding the
result.

* errout.adb (First_Node): Use Traverse_Proc instead of Traverse_Func,
because the former already takes care of discarding the result.
(Remove_Warning_Messages): Use appropriate subtype for Status and
Discard

From-SVN: r131070
gcc/ada/atree.adb
gcc/ada/atree.ads
gcc/ada/checks.adb
gcc/ada/errout.adb
gcc/ada/sem_res.adb