From patchwork Fri Mar 22 10:06:53 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 229958 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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 545042C00AF for ; Fri, 22 Mar 2013 21:07:47 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=KyUOKOn9gzZ+1idVDl5bsxAnV23GhWWSTa130n9cBwSZia9q1XGDw YPeOtpAQz65XSudUjoRjz80vGh5MrDNz8mqYNCYVTkU96fAAAfVzKJ3yXfQw0e2h t1ZzmyetsKbjGrzXnQ0hDc6tXYo/YYvG0Ie0/wtDc1LiUsc0K5Q1F8= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=j3FciKxzsxCB4NYRwgp8aE2DOlg=; b=XLkN9/1Eaz9H5GUQx8oF +lVv0/vZ0xtRX6riDS33s0+6AkdzRXgzn/XLL5Y96mbR/M7W1VfOGe9rziTolIo7 brjPyV5QcyM/EVBHfPNmWcvwRMwuohFGOEoIjRLycDbvHzcXw6AtgKgCvOJwridB 3dVbnA9aSExJNwEmcGEqrEQ= Received: (qmail 19760 invoked by alias); 22 Mar 2013 10:07:41 -0000 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 Received: (qmail 18389 invoked by uid 89); 22 Mar 2013 10:06:58 -0000 X-Spam-SWARE-Status: No, score=-7.2 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, TW_AV autolearn=ham version=3.3.1 Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Fri, 22 Mar 2013 10:06:56 +0000 Received: from relay1.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 025ABA4386 for ; Fri, 22 Mar 2013 11:06:53 +0100 (CET) Date: Fri, 22 Mar 2013 11:06:53 +0100 (CET) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix PR56434 Message-ID: User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 This fixes PR56434 - the use of BIGGEST_ALIGNMENT to annotate the pointer returned by malloc is wrong - BIGGEST_ALIGNMENT has nothing to do with the alignment guaranteed by the ABI for allocated memory. For example on x86_64 it depends on -mavx and thus can result in wrong code being generated. The following patch fixes it to use what we use on the GIMPLE level - MALLOC_ABI_ALIGNMENT. Ok for trunk? Thanks, Richard. 2013-03-22 Richard Biener PR middle-end/56434 * calls.c (expand_call): Use MALLOC_ABI_ALIGNMENT to annotate the pointer returned by calls with ECF_MALLOC set. Index: gcc/calls.c =================================================================== --- gcc/calls.c (revision 196899) +++ gcc/calls.c (working copy) @@ -3186,7 +3186,7 @@ expand_call (tree exp, rtx target, int i /* The return value from a malloc-like function is a pointer. */ if (TREE_CODE (rettype) == POINTER_TYPE) - mark_reg_pointer (temp, BIGGEST_ALIGNMENT); + mark_reg_pointer (temp, MALLOC_ABI_ALIGNMENT); emit_move_insn (temp, valreg);