From patchwork Fri Jul 2 20:58:10 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John David Anglin X-Patchwork-Id: 57776 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 26E391007D5 for ; Sat, 3 Jul 2010 06:58:22 +1000 (EST) Received: (qmail 24345 invoked by alias); 2 Jul 2010 20:58:21 -0000 Received: (qmail 24337 invoked by uid 22791); 2 Jul 2010 20:58:20 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from hiauly1.hia.nrc.ca (HELO hiauly1.hia.nrc.ca) (132.246.100.193) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 02 Jul 2010 20:58:14 +0000 Received: by hiauly1.hia.nrc.ca (Postfix, from userid 1000) id 822084E77; Fri, 2 Jul 2010 16:58:10 -0400 (EDT) Subject: [committed] Fix PR target/43958 To: gcc-patches@gcc.gnu.org Date: Fri, 2 Jul 2010 16:58:10 -0400 (EDT) From: "John David Anglin" MIME-Version: 1.0 Message-Id: <20100702205811.822084E77@hiauly1.hia.nrc.ca> Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org The attached patch changes hppa_gimplify_va_arg_expr to use pointer arithmetic instead of integer arithmetic. This fixes the pointer escape and failure of gcc.dg/ipa/ipa-pta-10.c. Tested on hppa2.0w-hp-hpux11.11. Committed to trunk. Dave Index: config/pa/pa.c =================================================================== --- config/pa/pa.c (revision 161653) +++ config/pa/pa.c (working copy) @@ -6040,11 +6040,10 @@ u = fold_build1 (NEGATE_EXPR, sizetype, u); t = build2 (POINTER_PLUS_EXPR, valist_type, valist, u); - /* Copied from va-pa.h, but we probably don't need to align to - word size, since we generate and preserve that invariant. */ - u = size_int (size > 4 ? -8 : -4); - t = fold_convert (sizetype, t); - t = build2 (BIT_AND_EXPR, sizetype, t, u); + /* Align to 4 or 8 byte boundary depending on argument size. */ + + u = build_int_cst (TREE_TYPE (t), (HOST_WIDE_INT)(size > 4 ? -8 : -4)); + t = build2 (BIT_AND_EXPR, TREE_TYPE (t), t, u); t = fold_convert (valist_type, t); t = build2 (MODIFY_EXPR, valist_type, valist, t);