* [Ada] Fix stack usage increase for renaming of indexed component
@ 2015-11-18 18:20 Eric Botcazou
0 siblings, 0 replies; only message in thread
From: Eric Botcazou @ 2015-11-18 18:20 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 527 bytes --]
This fixes an oversight in the new fold_constant_decl_in_expr function, which
causes the code generated by the compiler for the renaming of an indexed
component whose prefix is a constant object and whose index is not to use
significantly more stack than needed.
Tested on x86_64-suse-linux, applied on the mainline and 5.x branch.
2015-11-18 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/trans.c (fold_constant_decl_in_expr) <ARRAY_REF>: If
the index is not itself constant then bail out.
--
Eric Botcazou
[-- Attachment #2: p.diff --]
[-- Type: text/x-patch, Size: 554 bytes --]
Index: gcc-interface/trans.c
===================================================================
--- gcc-interface/trans.c (revision 230542)
+++ gcc-interface/trans.c (working copy)
@@ -975,6 +975,9 @@ fold_constant_decl_in_expr (tree exp)
case ARRAY_REF:
case ARRAY_RANGE_REF:
+ /* If the index is not itself constant, then nothing can be folded. */
+ if (!TREE_CONSTANT (TREE_OPERAND (exp, 1)))
+ return exp;
op0 = fold_constant_decl_in_expr (TREE_OPERAND (exp, 0));
if (op0 == TREE_OPERAND (exp, 0))
return exp;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-11-18 18:20 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-18 18:20 [Ada] Fix stack usage increase for renaming of indexed component Eric Botcazou
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).