public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, MIPS]: Fix internal compiler error: in check_bool_attrs, at recog.c:2218 for micromips attribute
@ 2015-05-14 14:51 Robert Suchanek
  2015-05-18 11:15 ` Matthew Fortune
  0 siblings, 1 reply; 7+ messages in thread
From: Robert Suchanek @ 2015-05-14 14:51 UTC (permalink / raw)
  To: Matthew Fortune, Catherine_Moore; +Cc: gcc-patches

Hi,

This patch fixes an internal compiler error when micromips/nomicromips
attributes are used.

The problem here was that the cached boolean attributes for the current
target did not agree with the uncached attributes throwing an assertion error.

It appears that saving and restoring the state for micromips was missing,
just like there is for mips16. OK to apply?

Regards,
Robert

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

gcc/testsuite
	* gcc.target/mips/umips-attr.c: New test.
---
 gcc/config/mips/mips.c                     | 10 ++++++++++
 gcc/testsuite/gcc.target/mips/umips-attr.c | 13 +++++++++++++
 2 files changed, 23 insertions(+)
 create mode 100644 gcc/testsuite/gcc.target/mips/umips-attr.c

diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index bf69850..959a672 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -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;
@@ -17182,6 +17185,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);
 
diff --git a/gcc/testsuite/gcc.target/mips/umips-attr.c b/gcc/testsuite/gcc.target/mips/umips-attr.c
new file mode 100644
index 0000000..f8c4517
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/umips-attr.c
@@ -0,0 +1,13 @@
+/* { dg-options "(-mmicromips)" } */
+
+int MICROMIPS
+foo (int a)
+{
+  return a;
+}
+
+int NOMICROMIPS
+foo2 (int a)
+{
+  return a;
+}
-- 
2.2.2


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-05-20 10:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-14 14:51 [PATCH, MIPS]: Fix internal compiler error: in check_bool_attrs, at recog.c:2218 for micromips attribute Robert Suchanek
2015-05-18 11:15 ` Matthew Fortune
2015-05-18 14:42   ` Robert Suchanek
2015-05-18 14:57     ` Maciej W. Rozycki
2015-05-19 18:59       ` Robert Suchanek
2015-05-20 10:17         ` Matthew Fortune
2015-05-20 10:42           ` Robert Suchanek

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).