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 PR32522 -- alpha bootstrap failure


Alpha is broken since pointer-plus merge.
The following patch, based on Andrew's from
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32522#c2 fixes it.

This patch is obvious in the spirit of all pointer-plus backend fixes,
and I added just three lines to Andrew's patch, so it should go in
without waiting for me to get an assignement.

Bootstrapped all languages excluding java on alphaev56-unknown-linux-gnu,
regtest in progress. Please apply.


2007-07-27  Andrew Pinski  <andrew_pinski@playstation.sony.com>
            Serge Belyshev  <belyshev@depni.sinp.msu.ru>

        PR target/32522
        * config/alpha/alpha.c (va_list_skip_additions): Check for
        POINTER_PLUS_EXPR in addition to PLUS_EXPR.
        (alpha_stdarg_optimize_hook): Look for POINTER_PLUS_EXPR instead of
        PLUS_EXPR when checking ap.__base.
        (alpha_va_start): Create POINTER_PLUS_EXPR instead of PLUS_EXPR
        when doing addition on pointer types.  Use size_int instead of
        build_int_cst.
        (alpha_gimplify_va_arg_1): Likewise, but use sizetype instead of
        ptr_type in the second operand.


Index: gcc/config/alpha/alpha.c
===================================================================
--- gcc/config/alpha/alpha.c	(revision 126969)
+++ gcc/config/alpha/alpha.c	(working copy)
@@ -5835,7 +5835,8 @@ va_list_skip_additions (tree lhs)
 
       if ((TREE_CODE (rhs) != NOP_EXPR
 	   && TREE_CODE (rhs) != CONVERT_EXPR
-	   && (TREE_CODE (rhs) != PLUS_EXPR
+	   && ((TREE_CODE (rhs) != PLUS_EXPR
+		&& TREE_CODE (rhs) != POINTER_PLUS_EXPR)
 	       || TREE_CODE (TREE_OPERAND (rhs, 1)) != INTEGER_CST
 	       || !host_integerp (TREE_OPERAND (rhs, 1), 1)))
 	  || TREE_CODE (TREE_OPERAND (rhs, 0)) != SSA_NAME)
@@ -5877,7 +5878,7 @@ alpha_stdarg_optimize_hook (struct stdar
 
   lhs = va_list_skip_additions (TREE_OPERAND (rhs, 0));
   if (lhs == NULL_TREE
-      || TREE_CODE (lhs) != PLUS_EXPR)
+      || TREE_CODE (lhs) != POINTER_PLUS_EXPR)
     return false;
 
   base = TREE_OPERAND (lhs, 0);
@@ -6111,8 +6112,8 @@ alpha_va_start (tree valist, rtx nextarg
 			     valist, offset_field, NULL_TREE);
 
       t = make_tree (ptr_type_node, virtual_incoming_args_rtx);
-      t = build2 (PLUS_EXPR, ptr_type_node, t,
-		  build_int_cst (NULL_TREE, offset));
+      t = build2 (POINTER_PLUS_EXPR, ptr_type_node, t,
+		  size_int (offset));
       t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (base_field), base_field, t);
       TREE_SIDE_EFFECTS (t) = 1;
       expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
@@ -6172,8 +6173,8 @@ alpha_gimplify_va_arg_1 (tree type, tree
     }
 
   /* Build the final address and force that value into a temporary.  */
-  addr = build2 (PLUS_EXPR, ptr_type, fold_convert (ptr_type, base),
-	         fold_convert (ptr_type, addend));
+  addr = build2 (POINTER_PLUS_EXPR, ptr_type, fold_convert (ptr_type, base),
+	         fold_convert (sizetype, addend));
   internal_post = NULL;
   gimplify_expr (&addr, pre_p, &internal_post, is_gimple_val, fb_rvalue);
   append_to_statement_list (internal_post, pre_p);


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