This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[4.1 PATCH] Do not automatically enable Tree-SRA for Ada
- From: Eric Botcazou <ebotcazou at adacore dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 13 Dec 2005 12:34:21 +0100
- Subject: [4.1 PATCH] Do not automatically enable Tree-SRA for Ada
The problems that prompted the 4.0 patch
http://gcc.gnu.org/ml/gcc-patches/2005-04/msg00646.html
are still present AFAICS as of today.
Bootstrapped/regtested on i586-suse-linux, 0 ACATS failures. OK for 4.1
branch?
2005-12-13 Eric Botcazou <ebotcazou@adacore.com>
PR ada/18659
PR ada/18819
ada/
* misc.c (tree_sra_requested): New global.
(gnat_init_options): Detect -ftree-sra.
(gnat_post_options): Enable Tree-SRA only if specifically requested.
gcc/
* doc/invoke.texi (Optimize Options): Document that
-ftree-sra is not automatically enabled for the Ada compiler.
--
Eric Botcazou
Index: ada/misc.c
===================================================================
--- ada/misc.c (revision 107650)
+++ ada/misc.c (working copy)
@@ -323,11 +323,15 @@ gnat_handle_option (size_t scode, const
return 1;
}
+static bool tree_sra_requested = false;
+
/* Initialize for option processing. */
static unsigned int
gnat_init_options (unsigned int argc, const char **argv)
{
+ int i;
+
/* Initialize gnat_argv with save_argv size. */
gnat_argv = (char **) xmalloc ((argc + 1) * sizeof (argv[0]));
gnat_argv[0] = xstrdup (argv[0]); /* name of the command */
@@ -339,6 +343,16 @@ gnat_init_options (unsigned int argc, co
/* Uninitialized really means uninitialized in Ada. */
flag_zero_initialized_in_bss = 0;
+ /* Find last option mentioning Tree-SRA. */
+ for (i = argc - 1; i > 0; i--)
+ if (strcmp(argv[i], "-ftree-sra") == 0)
+ {
+ tree_sra_requested = true;
+ break;
+ }
+ else if (strcmp(argv[i], "-fno-tree-sra") == 0)
+ break;
+
return CL_Ada;
}
@@ -356,6 +370,11 @@ gnat_post_options (const char **pfilenam
flag_tree_salias = 0;
+ /* Do not enable Tree-SRA unless specifically requested as it
+ is known to badly interact with some Ada constructs. */
+ if (!tree_sra_requested)
+ flag_tree_sra = 0;
+
return false;
}
Index: doc/invoke.texi
===================================================================
--- doc/invoke.texi (revision 107650)
+++ doc/invoke.texi (working copy)
@@ -4363,6 +4363,10 @@ compilation time.
@option{-O} also turns on @option{-fomit-frame-pointer} on machines
where doing so does not interfere with debugging.
+@option{-O} doesn't turn on @option{-ftree-sra} for the Ada compiler.
+This option must be explicitly specified on the command line to be
+enabled for the Ada compiler.
+
@item -O2
@opindex O2
Optimize even more. GCC performs nearly all supported optimizations