From patchwork Wed Jan 9 11:58:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 210703 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 869372C00D0 for ; Wed, 9 Jan 2013 23:00:32 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1358337632; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Date: From:To:Cc:Subject:Message-ID:User-Agent:MIME-Version: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=VpkBeoT i3+vMrERVmxNTacbxVpY=; b=xKemVCp2FtGjmkUtO3H3nKF5lc9TzziX62K+RSc r6C0S9TtcqAaYp2po6atj11Z+yGl7Bpe0OiCrdfkkRYIKzy9PHEalFlSH1jxFQj3 7qs7TCCpq0zHrCTMtVcMV4rerhXBy71ZySNA/wP2VC1pB9wackrnwucRSkW+4rip VIbE= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Date:From:To:Cc:Subject:Message-ID:User-Agent:MIME-Version:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=OWg35jh0XA2KnURkTp3UVsr+3JN70AhSQSqt3sfJXO3VPP8X1Iibo5X/SklAC0 BVWKSi1wcxI7nY1BjLOjsckFvbC1nLwejnkk3E0K95zPwCnk94SZ0SIiUMM6bKTP mCZXUIYHGR9KoMTPh9ufcQ580Pkhw6BqY8XnehKgJSjwk=; Received: (qmail 17614 invoked by alias); 9 Jan 2013 12:00:21 -0000 Received: (qmail 17587 invoked by uid 22791); 9 Jan 2013 12:00:19 -0000 X-SWARE-Spam-Status: No, hits=-5.4 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 09 Jan 2013 12:00:12 +0000 Received: from relay1.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id E08AFA398D; Wed, 9 Jan 2013 13:00:11 +0100 (CET) Date: Wed, 9 Jan 2013 12:58:43 +0100 (CET) From: Richard Biener To: gcc-patches@gcc.gnu.org Cc: ebotcazou@adacore.com Subject: [PATCH] Fix PR55882 Message-ID: User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 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 This fixes PR55882 - set_mem_attributes_minus_bitpos misses to account for the to-be applied bitpos when computing MEM_ALIGN. It extracts alignment from 't' instead of &t - bitpos. Bootstrapped and tested on x86_64-unknown-linux-gnu, bootstrap and regtest running on mips. Does this look sensible? Thanks, Richard. 2013-01-09 Richard Biener PR middle-end/55882 * emit-rtl.c (set_mem_attributes_minus_bitpos): Correctly account for the to-be applied bitpos when computing alignment. Index: gcc/emit-rtl.c =================================================================== --- gcc/emit-rtl.c (revision 195014) +++ gcc/emit-rtl.c (working copy) @@ -1839,7 +1839,12 @@ set_mem_attributes_minus_bitpos (rtx ref if (!align_computed) { - unsigned int obj_align = get_object_alignment (t); + unsigned int obj_align; + unsigned HOST_WIDE_INT obj_bitpos; + get_object_alignment_1 (t, &obj_align, &obj_bitpos); + obj_bitpos = (obj_bitpos - apply_bitpos) & (obj_align - 1); + if (obj_bitpos != 0) + obj_align = (obj_bitpos & -obj_bitpos); attrs.align = MAX (attrs.align, obj_align); } }