Fix ICE when both micromips and nomicromips attributes are used.
authorRobert Suchanek <robert.suchanek@imgtec.com>
Mon, 18 May 2015 14:32:19 +0000 (14:32 +0000)
committerRobert Suchanek <rts@gcc.gnu.org>
Mon, 18 May 2015 14:32:19 +0000 (14:32 +0000)
gcc/ChangeLog:

2015-05-18  Robert Suchanek  <robert.suchanek@imgtec.com>

* config/mips/mips.c (micromips_globals): New variable.
(mips_set_compression_mode): Save and reinitialize target-dependent
state for microMIPS.

gcc/testsuite/ChangeLog:

2015-05-18  Robert Suchanek  <robert.suchanek@imgtec.com>

* gcc.target/mips/umips-attr.c: New test.

From-SVN: r223294

gcc/ChangeLog
gcc/config/mips/mips.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/mips/umips-attr.c [new file with mode: 0644]

index bebe44c5257bd7b85206a6489335ba3424fd5ba8..27b4d266d2060783223dc6797822ad26328f6431 100644 (file)
@@ -1,3 +1,9 @@
+2015-05-18  Robert Suchanek  <robert.suchanek@imgtec.com>
+
+       * config/mips/mips.c (micromips_globals): New variable.
+       (mips_set_compression_mode): Save and reinitialize target-dependent
+       state for microMIPS.
+
 2015-05-18  Martin Liska  <mliska@suse.cz>
 
        * dbgcnt.def: Add new counter.
index 8c66cbd89c8f46b84b5559c7ac7dc3899a7ad95b..e619baadae880348210b8404ea2ab63d91cac159 100644 (file)
@@ -676,6 +676,9 @@ const char *mips_hi_relocs[NUM_SYMBOL_TYPES];
 /* Target state for MIPS16.  */
 struct target_globals *mips16_globals;
 
+/* Target state for MICROMIPS.  */
+struct target_globals *micromips_globals;
+
 /* Cached value of can_issue_more. This is cached in mips_variable_issue hook
    and returned from mips_sched_reorder2.  */
 static int cached_can_issue_more;
@@ -17162,6 +17165,13 @@ mips_set_compression_mode (unsigned int compression_mode)
       else
        restore_target_globals (mips16_globals);
     }
+  else if (compression_mode & MASK_MICROMIPS)
+    {
+      if (!micromips_globals)
+       micromips_globals = save_target_globals_default_opts ();
+      else
+       restore_target_globals (micromips_globals);
+    }
   else
     restore_target_globals (&default_target_globals);
 
index 985478e6b44176953a1de9bf1238d958434787f5..5206d883a153a3376b3fc6f5e26b41d33544deb8 100644 (file)
@@ -1,3 +1,7 @@
+2015-05-18  Robert Suchanek  <robert.suchanek@imgtec.com>
+
+       * gcc.target/mips/umips-attr.c: New test.
+
 2015-05-17  Uros Bizjak  <ubizjak@gmail.com>
 
        * gcc.dg/20150120-1.c (dg-final): Cleanup original tree dump.
diff --git a/gcc/testsuite/gcc.target/mips/umips-attr.c b/gcc/testsuite/gcc.target/mips/umips-attr.c
new file mode 100644 (file)
index 0000000..f8c4517
--- /dev/null
@@ -0,0 +1,13 @@
+/* { dg-options "(-mmicromips)" } */
+
+int MICROMIPS
+foo (int a)
+{
+  return a;
+}
+
+int NOMICROMIPS
+foo2 (int a)
+{
+  return a;
+}