[llvm-commits] [128838] Don't assume &P[0] is nonnull in LLVM.

johannes at apple.com johannes at apple.com
Tue Jun 26 09:45:24 PDT 2007


Revision: 128838
Author:   johannes
Date:     2007-06-26 09:45:24 -0700 (Tue, 26 Jun 2007)

Log Message:
-----------
Don't assume &P[0] is nonnull in LLVM.

Modified Paths:
--------------
    apple-local/branches/llvm/gcc/c-common.c

Modified: apple-local/branches/llvm/gcc/c-common.c
===================================================================
--- apple-local/branches/llvm/gcc/c-common.c	2007-06-26 15:41:13 UTC (rev 128837)
+++ apple-local/branches/llvm/gcc/c-common.c	2007-06-26 16:45:24 UTC (rev 128838)
@@ -2636,6 +2636,18 @@
 	    && DECL_EXTERNAL (TREE_OPERAND (expr, 0)))
 	  break;
 
+/* APPLE LOCAL begin llvm */
+#if ENABLE_LLVM
+        /* LLVM extends ARRAY_REF to allow pointers to be the base value.  It is not
+           valid to assume ADDR of this is nonzero, because it could be derived from
+           original (P+constant).  Radar 5286401.  */
+        if (TREE_CODE (TREE_OPERAND (expr, 0)) == ARRAY_REF 
+            && TREE_CODE (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (expr, 0), 0))) 
+                != ARRAY_TYPE)
+          break;
+#endif
+/* APPLE LOCAL end llvm */
+
 	if (TREE_SIDE_EFFECTS (TREE_OPERAND (expr, 0)))
 	  return build2 (COMPOUND_EXPR, truthvalue_type_node,
 			 TREE_OPERAND (expr, 0), truthvalue_true_node);





More information about the llvm-commits mailing list