This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[PATCH] Subreg-byte recog fix


Hi!

The testcase below ICEs in gcc-2.96-RH and gcc-subreg-byte branch. I have
not tried gcc head with latest SUBREG_BYTE patch, but the code in question
is still there.
The thing is that it is not impossible to validate replacement of e.g.
(subreg:SF (reg:DI )) with say (const_int 0) as does GCSE in the example
below. validate_replace_rtx_1 should either handle this case (by creating
const_double from the selected bits) or simply not allow it to be replaced
(the latter is done in this patch). gcc without SUBREG_BYTE does not replace
it either.
Ok to commit? testcase and as soon as SUBREG_BYTE patch is commited, the
recog.c patch as well or just the testcase?

2001-03-26  Jakub Jelinek  <jakub@redhat.com>

	* recog.c (validate_replace_rtx_1): Instead of aborting just make
	sure the change won't be validated.

	* gcc.c-torture/compile/20010326-1.c: New test.

--- gcc/recog.c.jj	Mon Mar 26 16:32:11 2001
+++ gcc/recog.c	Mon Mar 26 18:34:32 2001
@@ -558,7 +558,13 @@ validate_replace_rtx_1 (loc, from, to, o
 		enum machine_mode inner_mode = GET_MODE (from);
 
 		if (GET_MODE_CLASS (mode) != MODE_INT)
-		  abort ();
+		  {
+		    /* Substitute in something that we know won't be
+		       recognized.  */
+		    to = gen_rtx_CLOBBER (GET_MODE (x), const0_rtx);
+		    validate_change (object, loc, to, 1);
+		    return;
+		  }
 
 		if (BYTES_BIG_ENDIAN || WORDS_BIG_ENDIAN)
 		  {
--- gcc/testsuite/gcc.c-torture/compile/20010326-1.c.jj	Mon Mar 26 18:35:16 2001
+++ gcc/testsuite/gcc.c-torture/compile/20010326-1.c	Mon Mar 26 18:36:51 2001
@@ -0,0 +1,16 @@
+float d;
+int e, f;
+
+void foo (void)
+{
+  struct { float u, v; } a = {0.0, 0.0};
+  float b;
+  int c;
+
+  c = e;
+  if (c == 0)
+    c = f;
+  b = d;
+  if (a.v < b)
+    a.v = b;
+}

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]