From patchwork Thu Jul 8 20:03:10 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 58290 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 6655DB6F07 for ; Fri, 9 Jul 2010 06:03:24 +1000 (EST) Received: (qmail 8652 invoked by alias); 8 Jul 2010 20:03:23 -0000 Received: (qmail 8479 invoked by uid 22791); 8 Jul 2010 20:03:22 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (212.99.106.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 08 Jul 2010 20:03:17 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 23083CB029B for ; Thu, 8 Jul 2010 22:03:14 +0200 (CEST) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 71-yoHMKjrWv for ; Thu, 8 Jul 2010 22:03:14 +0200 (CEST) Received: from adijon-256-1-1-190.w81-51.abo.wanadoo.fr (ADijon-256-1-1-190.w81-51.abo.wanadoo.fr [81.51.8.190]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id E8AFACB01D8 for ; Thu, 8 Jul 2010 22:03:13 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: Fix PR middle-end/44843 Date: Thu, 8 Jul 2010 22:03:10 +0200 User-Agent: KMail/1.9.9 MIME-Version: 1.0 Message-Id: <201007082203.10603.ebotcazou@adacore.com> 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 As diagnosed by Richard G, there is a wrong assumption in the code handling MEM_REF in set_mem_attributes_minus_bitpos. This replaces it with a much less wrong assumption, as suggested by Richard. Tested on SPARC/Solaris and SPARC64/Solaris, applied on the mainline. 2010-07-08 Eric Botcazou PR middle-end/44843 * emit-rtl.c (set_mem_attributes_minus_bitpos): Do not rely on the pointed-to type of the offset in a MEM_REF to compute the alignment. 2010-07-08 Mikael Pettersson * gcc.c-torture/execute/20100708-1.c: New test. Index: emit-rtl.c =================================================================== --- emit-rtl.c (revision 161961) +++ emit-rtl.c (working copy) @@ -1634,10 +1634,9 @@ set_mem_attributes_minus_bitpos (rtx ref #endif } else - /* This technically isn't correct. We can't really derive - alignment information from types. */ - align = MAX (align, - TYPE_ALIGN (TREE_TYPE (TREE_TYPE (TREE_OPERAND (t, 1))))); + /* ??? This isn't fully correct, we can't set the alignment from the + type in all cases. */ + align = MAX (align, TYPE_ALIGN (type)); if (!integer_zerop (TREE_OPERAND (t, 1)) && aoff < align) align = aoff;