From: Joern Rennecke <amylaar@spamcop.net>
To: gcc-patches@gcc.gnu.org
Subject: RFA: Fix bug in optimize_mode_switching
Date: Mon, 11 Jul 2011 09:36:00 -0000 [thread overview]
Message-ID: <20110711050825.zohqma67z4kso844-nzlynne@webmail.spamcop.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 380 bytes --]
I work on target with complex mode switching needs, so it can happen that
in some block, for an entity a mode is provided without the need for a set.
This causes the current optimize_mode_switching to crash when it later
dereferences a NULL seginfo pointer.
Fixed by using an actual flag to keep track if we have allocated any seginfo.
Bootstrappded on x86_64-unknown-linux-gnu.
[-- Attachment #2: mode-switch-fix --]
[-- Type: text/plain, Size: 1350 bytes --]
2011-07-08 Joern Rennecke <joern.rennecke@embecosm.com>
* mode-switching.c (optimize_mode_switching): Fix bug in MODE_AFTER
handling.
Index: mode-switching.c
===================================================================
--- mode-switching.c (revision 1670)
+++ mode-switching.c (revision 1671)
@@ -499,6 +499,7 @@ optimize_mode_switching (void)
{
struct seginfo *ptr;
int last_mode = no_mode;
+ bool any_set_required = false;
HARD_REG_SET live_now;
REG_SET_TO_HARD_REG_SET (live_now, df_get_live_in (bb));
@@ -527,6 +528,7 @@ optimize_mode_switching (void)
if (mode != no_mode && mode != last_mode)
{
+ any_set_required = true;
last_mode = mode;
ptr = new_seginfo (mode, insn, bb->index, live_now);
add_seginfo (info + bb->index, ptr);
@@ -548,8 +550,10 @@ optimize_mode_switching (void)
}
info[bb->index].computing = last_mode;
- /* Check for blocks without ANY mode requirements. */
- if (last_mode == no_mode)
+ /* Check for blocks without ANY mode requirements.
+ N.B. because of MODE_AFTER, last_mode might still be different
+ from no_mode. */
+ if (!any_set_required)
{
ptr = new_seginfo (no_mode, BB_END (bb), bb->index, live_now);
add_seginfo (info + bb->index, ptr);
reply other threads:[~2011-07-11 9:08 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20110711050825.zohqma67z4kso844-nzlynne@webmail.spamcop.net \
--to=amylaar@spamcop.net \
--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).