aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKelvin Nilsen <kelvin@gcc.gnu.org>2016-02-16 23:12:19 +0000
committerKelvin Nilsen <kelvin@gcc.gnu.org>2016-02-16 23:12:19 +0000
commitecf835e9012955ba4a585b6084628dff9b259ee8 (patch)
treee34511db2ac74e790ae8e1c9ff5065727eae8674
parent49a1164ae39421767ad9c4e755509bc82f30be09 (diff)
downloadgcc-ecf835e9012955ba4a585b6084628dff9b259ee8.zip
gcc-ecf835e9012955ba4a585b6084628dff9b259ee8.tar.gz
gcc-ecf835e9012955ba4a585b6084628dff9b259ee8.tar.bz2
re PR target/48344 (powerpc ICE with -fstack-limit-register=r2)
[gcc] 2016-02-16 Kelvin Nilsen <kelvin@gcc.gnu.org> PR Target/48344 * opts-global.c (handle_common_deferred_options): Introduce and initialize two global variables to remember command-line options specifying a stack-limiting register. * opts.h: Add extern declarations of the two new global variables. * emit-rtl.c (init_emit_once): Initialize the stack_limit_rtx variable based on the values of the two new global variables. [gcc/testsuite] 2016-02-16 Kelvin Nilsen <kelvin@gcc.gnu.org> PR Target/48344 * gcc.target/powerpc/pr48344-1.c: New test. From-SVN: r233477
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/emit-rtl.c8
-rw-r--r--gcc/opts-global.c14
-rw-r--r--gcc/opts.h4
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr48344-1.c8
6 files changed, 47 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 29302b0..aec472c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+2016-02-16 Kelvin Nilsen <kelvin@gcc.gnu.org>
+
+ PR Target/48344
+ * opts-global.c (handle_common_deferred_options): Introduce and
+ initialize two global variables to remember command-line options
+ specifying a stack-limiting register.
+ * opts.h: Add extern declarations of the two new global variables.
+ * emit-rtl.c (init_emit_once): Initialize the stack_limit_rtx
+ variable based on the values of the two new global variables.
+
2016-02-16 Jakub Jelinek <jakub@redhat.com>
PR c/69835
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index ba99487..0fcd9d9 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -57,6 +57,7 @@ along with GCC; see the file COPYING3. If not see
#include "builtins.h"
#include "rtl-iter.h"
#include "stor-layout.h"
+#include "opts.h"
struct target_rtl default_target_rtl;
#if SWITCHABLE_TARGET
@@ -5895,6 +5896,13 @@ init_emit_once (void)
/* Create the unique rtx's for certain rtx codes and operand values. */
+ /* Process stack-limiting command-line options. */
+ if (opt_fstack_limit_symbol_arg != NULL)
+ stack_limit_rtx
+ = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (opt_fstack_limit_symbol_arg));
+ if (opt_fstack_limit_register_no >= 0)
+ stack_limit_rtx = gen_rtx_REG (Pmode, opt_fstack_limit_register_no);
+
/* Don't use gen_rtx_CONST_INT here since gen_rtx_CONST_INT in this case
tries to use these variables. */
for (i = - MAX_SAVED_CONST_INT; i <= MAX_SAVED_CONST_INT; i++)
diff --git a/gcc/opts-global.c b/gcc/opts-global.c
index 30874cd..b7e5232 100644
--- a/gcc/opts-global.c
+++ b/gcc/opts-global.c
@@ -310,6 +310,10 @@ decode_options (struct gcc_options *opts, struct gcc_options *opts_set,
finish_options (opts, opts_set, loc);
}
+/* Hold command-line options associated with stack limitation. */
+const char *opt_fstack_limit_symbol_arg = NULL;
+int opt_fstack_limit_register_no = -1;
+
/* Process common options that have been deferred until after the
handlers have been called for all options. */
@@ -417,12 +421,18 @@ handle_common_deferred_options (void)
if (reg < 0)
error ("unrecognized register name %qs", opt->arg);
else
- stack_limit_rtx = gen_rtx_REG (Pmode, reg);
+ {
+ /* Deactivate previous OPT_fstack_limit_symbol_ options. */
+ opt_fstack_limit_symbol_arg = NULL;
+ opt_fstack_limit_register_no = reg;
+ }
}
break;
case OPT_fstack_limit_symbol_:
- stack_limit_rtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (opt->arg));
+ /* Deactivate previous OPT_fstack_limit_register_ options. */
+ opt_fstack_limit_register_no = -1;
+ opt_fstack_limit_symbol_arg = opt->arg;
break;
case OPT_fasan_shadow_offset_:
diff --git a/gcc/opts.h b/gcc/opts.h
index fa479d8..1b5cf44 100644
--- a/gcc/opts.h
+++ b/gcc/opts.h
@@ -296,6 +296,10 @@ struct cl_option_handlers
struct cl_option_handler_func handlers[3];
};
+/* Hold command-line options associated with stack limitation. */
+extern const char *opt_fstack_limit_symbol_arg;
+extern int opt_fstack_limit_register_no;
+
/* Input file names. */
extern const char **in_fnames;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index a071823..df83072 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2016-02-16 Kelvin Nilsen <kelvin@gcc.gnu.org>
+
+ PR Target/48344
+ * gcc.target/powerpc/pr48344-1.c: New test.
+
2015-02-16 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/69742
diff --git a/gcc/testsuite/gcc.target/powerpc/pr48344-1.c b/gcc/testsuite/gcc.target/powerpc/pr48344-1.c
new file mode 100644
index 0000000..22f3070
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr48344-1.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-fstack-limit-register=r2" } */
+void foo ()
+{
+ int N = 2;
+ int slots[N];
+
+}