From: Robert Suchanek <Robert.Suchanek@imgtec.com>
To: Matthew Fortune <Matthew.Fortune@imgtec.com>,
"Catherine_Moore@mentor.com" <Catherine_Moore@mentor.com>
Cc: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: [PATCH, MIPS]: Fix internal compiler error: in check_bool_attrs, at recog.c:2218 for micromips attribute
Date: Thu, 14 May 2015 14:51:00 -0000 [thread overview]
Message-ID: <B5E67142681B53468FAF6B7C31356562441410AD@hhmail02.hh.imgtec.org> (raw)
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
next reply other threads:[~2015-05-14 14:47 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-14 14:51 Robert Suchanek [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=B5E67142681B53468FAF6B7C31356562441410AD@hhmail02.hh.imgtec.org \
--to=robert.suchanek@imgtec.com \
--cc=Catherine_Moore@mentor.com \
--cc=Matthew.Fortune@imgtec.com \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).