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]
Other format: [Raw text]

[PATCH] Fix gimple_check_failed with non-GCC compilers (PR bootstrap/38100)


Hi!

GCC failed to build with gimple checking enabled when using non-gcc
bootstrap compiler.  The problem is that GIMPLE_CHECK macro
non-empty defintion was guarded just by #ifdef ENABLE_GIMPLE_CHECKING,
but gimple_check_failed function definition with additional
GCC_VERSION >= 2007.  I guess that this is copy&paste from tree.c
where e.g. tree_check_failed is guarded by that.  The difference
is that GIMPLE_CHECK macro doesn't return value and so doesn't need
a statement expression GCC extension.

The following patch fixes that and additionally removes an unused
gimple_range_check_failed - there are far fewer GIMPLE codes than
tree codes and I think it is not very likely we'll need a range
checking for them any time soon.

Bootstrapped/regtested on x86_64-linux, committed to trunk.

2008-11-13  Jakub Jelinek  <jakub@redhat.com>

	PR bootstrap/38100
	* gimple.h (gimple_range_check_failed): Remove prototype.
	* gimple.c (gimple_check_failed): Don't check GCC_VERSION
	in guarding #if.
	(gimple_range_check_failed): Removed.

--- gcc/gimple.c.jj	2008-10-23 13:21:41.000000000 +0200
+++ gcc/gimple.c	2008-11-13 09:45:45.000000000 +0100
@@ -1100,7 +1100,7 @@ gimple_statement_structure (gimple gs)
   return gss_for_code (gimple_code (gs));
 }
 
-#if defined ENABLE_GIMPLE_CHECKING && (GCC_VERSION >= 2007)
+#if defined ENABLE_GIMPLE_CHECKING
 /* Complain of a gimple type mismatch and die.  */
 
 void
@@ -1117,41 +1117,6 @@ gimple_check_failed (const_gimple gs, co
 		    : "",
 		  function, trim_filename (file), line);
 }
-
-
-/* Similar to gimple_check_failed, except that instead of specifying a
-   dozen codes, use the knowledge that they're all sequential.  */
-
-void
-gimple_range_check_failed (const_gimple gs, const char *file, int line,
-		           const char *function, enum gimple_code c1,
-		           enum gimple_code c2)
-{
-  char *buffer;
-  unsigned length = 0;
-  enum gimple_code c;
-
-  for (c = c1; c <= c2; ++c)
-    length += 4 + strlen (gimple_code_name[c]);
-
-  length += strlen ("expected ");
-  buffer = XALLOCAVAR (char, length);
-  length = 0;
-
-  for (c = c1; c <= c2; ++c)
-    {
-      const char *prefix = length ? " or " : "expected ";
-
-      strcpy (buffer + length, prefix);
-      length += strlen (prefix);
-      strcpy (buffer + length, gimple_code_name[c]);
-      length += strlen (gimple_code_name[c]);
-    }
-
-  internal_error ("gimple check: %s, have %s in %s, at %s:%d",
-		  buffer, gimple_code_name[gimple_code (gs)],
-		  function, trim_filename (file), line);
-}
 #endif /* ENABLE_GIMPLE_CHECKING */
 
 
--- gcc/gimple.h.jj	2008-10-23 13:21:41.000000000 +0200
+++ gcc/gimple.h	2008-11-13 09:45:54.000000000 +0100
@@ -59,9 +59,6 @@ extern const unsigned char gimple_rhs_cl
 extern void gimple_check_failed (const_gimple, const char *, int,          \
                                  const char *, enum gimple_code,           \
 				 enum tree_code) ATTRIBUTE_NORETURN;
-extern void gimple_range_check_failed (const_gimple, const char *, int,    \
-                                       const char *, enum gimple_code,     \
-				       enum gimple_code) ATTRIBUTE_NORETURN;
 
 #define GIMPLE_CHECK(GS, CODE)						\
   do {									\

	Jakub


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