aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>2014-02-10 09:25:44 -0700
committerJeff Law <law@gcc.gnu.org>2014-02-10 09:25:44 -0700
commitf27be5508a305c4e027b665157787b5ba8c99c62 (patch)
tree2b47eead162f5f28d55fcbb730993de7575ea7f2 /gcc
parent7606ae1a4b0abe87ae2fc7f33be840f2e88e1107 (diff)
downloadgcc-f27be5508a305c4e027b665157787b5ba8c99c62.zip
gcc-f27be5508a305c4e027b665157787b5ba8c99c62.tar.gz
gcc-f27be5508a305c4e027b665157787b5ba8c99c62.tar.bz2
re PR middle-end/52306 (ICE in cselib_record_set, at cselib.c:2158)
PR middle-end/52306 * reload1.c (emit_input_reload_insns): Do not create invalid RTL when changing the SET_DEST of a prior insn to avoid an input reload. PR middle-end-52306 * gcc.c-torture/compile/pr52306.c: New test. From-SVN: r207662
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/reload1.c13
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr52306.c84
4 files changed, 107 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 62d4649..5f62522 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2014-02-10 Jeff Law <law@redhat.com>
+
+ PR middle-end/52306
+ * reload1.c (emit_input_reload_insns): Do not create invalid RTL
+ when changing the SET_DEST of a prior insn to avoid an input
+ reload.
+
2014-02-10 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
* config/rs6000/sysv4.h (ENDIAN_SELECT): Do not attempt to enforce
diff --git a/gcc/reload1.c b/gcc/reload1.c
index bb761fe..b789ee8 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -7362,9 +7362,18 @@ emit_input_reload_insns (struct insn_chain *chain, struct reload *rl,
/* Store into the reload register instead of the pseudo. */
SET_DEST (PATTERN (temp)) = reloadreg;
- /* Verify that resulting insn is valid. */
+ /* Verify that resulting insn is valid.
+
+ Note that we have replaced the destination of TEMP with
+ RELOADREG. If TEMP references RELOADREG within an
+ autoincrement addressing mode, then the resulting insn
+ is ill-formed and we must reject this optimization. */
extract_insn (temp);
- if (constrain_operands (1))
+ if (constrain_operands (1)
+#ifdef AUTO_INC_DEC
+ && ! find_reg_note (temp, REG_INC, reloadreg)
+#endif
+ )
{
/* If the previous insn is an output reload, the source is
a reload register, and its spill_reg_store entry will
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index f6db2b3..56125ad 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2014-02-10 Jeff Law <law@redhat.com>
+
+ PR middle-end-52306
+ * gcc.c-torture/compile/pr52306.c: New test.
+
2014-02-10 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* g++.dg/ext/vector26.C: Use -mmmx for 32-bit x86.
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr52306.c b/gcc/testsuite/gcc.c-torture/compile/pr52306.c
new file mode 100644
index 0000000..e82cb2a
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr52306.c
@@ -0,0 +1,84 @@
+/* PR middle-end/52306 */
+
+struct xmlNs {
+ const unsigned char *prefix;
+};
+
+struct xmlNode {
+ const unsigned char *name;
+ struct xmlNs *ns;
+ struct xmlNs *nsDef;
+};
+
+struct xsltTemplate {
+ const unsigned char *name;
+ int inheritedNsNr;
+ void *inheritedNs;
+};
+
+struct xsltTemplate *xsltNewTemplate(void);
+void xsltGetQNameURI(unsigned char**);
+long xmlMalloc(unsigned long);
+void xsltGenericDebug(void);
+int xmlStrEqual(const unsigned char*, const unsigned char*);
+
+static void xsltGetInheritedNsList(
+ struct xsltTemplate *template,
+ struct xmlNode *node)
+{
+ struct xmlNs *cur;
+ struct xmlNs **ret;
+ int nbns = 0;
+ int maxns = 10;
+ int i;
+
+ if (template == 0
+ || template->inheritedNsNr != 0
+ || template->inheritedNs != 0)
+ return;
+
+ while (node != 0) {
+ cur = node->nsDef;
+ ret = (struct xmlNs**) xmlMalloc((maxns + 1) * sizeof(struct xmlNs*));
+ for (i = 0; i < nbns; i++)
+ if (cur->prefix == ret[i]->prefix
+ || xmlStrEqual(cur->prefix, 0))
+ break;
+
+ if (i >= nbns) {
+ if (nbns >= maxns)
+ return;
+ ret[nbns++] = cur;
+ }
+ }
+}
+
+static void
+xsltParseStylesheetTemplate(struct xmlNode *template)
+{
+ struct xsltTemplate *ret;
+ unsigned char *prop;
+
+ ret = xsltNewTemplate();
+ if (ret == 0)
+ return;
+ xsltGetInheritedNsList(ret, template);
+ xsltGenericDebug();
+ xsltGetQNameURI(&prop);
+ xmlStrEqual(0, ret->name);
+}
+
+void xsltParseStylesheetTop(struct xmlNode *cur)
+{
+ xmlStrEqual(0, 0);
+
+ while (cur != 0) {
+ if (xmlStrEqual(cur->name, 0))
+ ;
+ else if (xmlStrEqual(cur->name, 0))
+ ;
+ else if (xmlStrEqual(cur->name, 0))
+ xsltParseStylesheetTemplate(cur);
+ }
+}
+