This is the mail archive of the gcc@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] Re: [tree-ssa] build failure on powerpc-aix in libobjc


On Apr 15, 2004, at 21:12, David Edelsohn wrote:

Andrew Pinski writes:

Andrew> On powerpc-aix (this was reported to me from David Edelsohn), Andrew> isdigit is not a macro so fold_builtin is folding isdigit and Andrew> it causes an ICE. Since the folding of isdigit is new, it Andrew> looks like it does check if we are able to create non Andrew> gimple which it happens here.

The specific ICE is:

error: Invalid operand to binary operator
(unsigned int<D3>)T.217<D4528> - 48;
internal compiler error: verify_stmts failed.


This patch should fix it by just making sure that we do not
return non-gimple from the folding of the builtins.  I saw
it also happens with isascii too so I fixed that testcase
also.

OK?

Thanks,
Andrew Pinski


testcases: int isdigit (int); int f (const char *type) { return isdigit ((unsigned char) *type++); }

-------------------------------------------

int isascii (int);

int f1 (const char *type)
{
  return isascii ((unsigned char) *type++);
}


ChangeLog:


	* builtins.c (fold_builtin_isascii): Do not return non-gimple
	code when we are in gimple form.
	(fold_builtin_isdigit): Do not return non-gimple
	code when we are in gimple form.


Index: builtins.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/builtins.c,v retrieving revision 1.152.2.60 diff -u -p -r1.152.2.60 builtins.c --- builtins.c 15 Apr 2004 19:55:07 -0000 1.152.2.60 +++ builtins.c 16 Apr 2004 01:37:37 -0000 @@ -6995,11 +6995,16 @@ fold_builtin_isascii (tree arglist) /* Transform isascii(c) -> ((c & ~0x7f) == 0). */ tree arg = TREE_VALUE (arglist);

-      return fold (build (EQ_EXPR, integer_type_node,
-			  build (BIT_AND_EXPR, integer_type_node, arg,
-				 build_int_2 (~ (unsigned HOST_WIDE_INT) 0x7f,
-					      ~ (HOST_WIDE_INT) 0)),
-			  integer_zero_node));
+      arg = fold (build (EQ_EXPR, integer_type_node,
+			 build (BIT_AND_EXPR, integer_type_node, arg,
+				build_int_2 (~ (unsigned HOST_WIDE_INT) 0x7f,
+					     ~ (HOST_WIDE_INT) 0)),
+			 integer_zero_node));
+
+      if (in_gimple_form && !TREE_CONSTANT (arg))
+        return NULL_TREE;
+      else
+        return arg;
     }
 }

@@ -7039,7 +7044,11 @@ fold_builtin_isdigit (tree arglist)
       arg = build (LE_EXPR, integer_type_node, arg,
 		   fold (build1 (NOP_EXPR, unsigned_type_node,
 				 build_int_2 (9, 0))));
-      return fold (arg);
+      arg = fold (arg);
+      if (in_gimple_form && !TREE_CONSTANT (arg))
+        return NULL_TREE;
+      else
+        return arg;
     }
 }



Attachment: fixlibobjc.txt
Description: Text document


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