From patchwork Tue Mar 8 09:43:57 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikael Pettersson X-Patchwork-Id: 85946 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 790A5B6EF1 for ; Tue, 8 Mar 2011 20:44:16 +1100 (EST) Received: (qmail 14740 invoked by alias); 8 Mar 2011 09:44:14 -0000 Received: (qmail 14729 invoked by uid 22791); 8 Mar 2011 09:44:11 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from fanny.its.uu.se (HELO fanny.its.uu.se) (130.238.4.241) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 08 Mar 2011 09:44:04 +0000 Received: from fanny.its.uu.se (localhost [127.0.0.1]) by fanny.its.uu.se (Postfix) with ESMTP id BC5A2627B for ; Tue, 8 Mar 2011 10:44:01 +0100 (MEZ) Received: from pilspetsen.it.uu.se (pilspetsen.it.uu.se [130.238.18.39]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by fanny.its.uu.se (Postfix) with ESMTP id 890E662B2 for ; Tue, 8 Mar 2011 10:44:01 +0100 (MEZ) Received: (from mikpe@localhost) by pilspetsen.it.uu.se (8.14.4+Sun/8.14.4) id p289hvTR023319; Tue, 8 Mar 2011 10:43:57 +0100 (MET) MIME-Version: 1.0 Message-ID: <19829.64093.712016.937815@pilspetsen.it.uu.se> Date: Tue, 8 Mar 2011 10:43:57 +0100 From: Mikael Pettersson To: gcc-patches@gcc.gnu.org Subject: [PATCH] unbreak gcc.dg/tree-ssa/ssa-ccp-33.c on m68k (PR testsuite/47954) 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 gcc.dg/tree-ssa/ssa-ccp-33.c fails with gcc trunk on m68k-linux: ssa-ccp-33.c:(.text+0x2a): undefined reference to `link_error' ssa-ccp-33.c:(.text+0x2a): undefined reference to `link_error' FAIL: gcc.dg/tree-ssa/ssa-ccp-33.c (test for excess errors) ssa-ccp-33.c:(.text+0x2a): undefined reference to `link_error' The test case checks that the compiler is able to eliminate a runtime check that an aligned pointer-to-int remains aligned after a loop of increments. It uses sizeof to compute the alignment of int, but on m68k (and possibly others) the alignment of int is less than its size. The compiler is then unable to eliminate the broken alignment check, and the call to link_error () is not removed. Fixed by using __alignof__ instead. Regression tested on m68k-linux where it eliminated the FAIL for gcc.dg/tree-ssa/ssa-ccp-33.c. Also tested on i686-linux, no changes there. Ok for trunk? (Richard G. pre-approved this change on the PR entry, however I cannot commit it myself.) gcc/testsuite/ 2011-03-08 Mikael Pettersson PR testsuite/47954 * gcc.dg/tree-ssa/ssa-ccp-33.c: Use __alignof__ not sizeof to compute alignment. --- gcc-4.6-20110305/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-33.c.~1~ 2010-08-06 13:47:31.000000000 +0200 +++ gcc-4.6-20110305/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-33.c 2011-03-08 10:34:13.000000000 +0100 @@ -8,7 +8,7 @@ void foo(int n) int *p; for (p = a; n != 0; --n, ++p) ; - if ((__SIZE_TYPE__)p & (sizeof (int) - 1)) + if ((__SIZE_TYPE__)p & (__alignof__ (int) - 1)) link_error (); } int main()