From patchwork Thu Feb 7 22:34:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Meissner X-Patchwork-Id: 219011 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 9B6E32C0089 for ; Fri, 8 Feb 2013 09:34:36 +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=1360881277; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Received:Received:Received:Date:From:To: Subject:Message-ID:Mail-Followup-To:MIME-Version:Content-Type: Content-Disposition:User-Agent:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=/0N3Ya+YdKZvBE785YTCnpYlwfg=; b=r2fsqVHeWIpJLrC nsMP0sodBXDJmcR5TsxXYGBG0qOLmqoWpUhCctcmfAeH7twN1AeH8zUcyV4keXN/ 8EB8c6wzDsOA9OwB277oKTsKHdqEoEzN/0qSavENEYaxdJzfkzvePEMXQhSdjyEF LQk5DWzT6jEGVlhNlf/eR8TziTSA= 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:Received:Received:Received:Received:Received:Received:Date:From:To:Subject:Message-ID:Mail-Followup-To:MIME-Version:Content-Type:Content-Disposition:User-Agent:X-Content-Scanned:x-cbid:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=HEXYVUH6nZ5wW0J83I0E4yxu4s0OAlCGa+nkRyP3LzC+FELg9Y3lv5iHFJGa0C wnQQIIjfcCGwc/uqjyX+sOY+KZQEkcHdnEDkwdYeJNlQfy8M/wonoKtIrMDI0CD2 9sxkXB4g4GPiuxIr9zq3XbIIE07UZp7yvLJpV//ZU4oTI=; Received: (qmail 31172 invoked by alias); 7 Feb 2013 22:34:26 -0000 Received: (qmail 31119 invoked by uid 22791); 7 Feb 2013 22:34:25 -0000 X-SWARE-Spam-Status: No, hits=-3.8 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, KHOP_SPAMHAUS_DROP, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, TW_CP X-Spam-Check-By: sourceware.org Received: from e8.ny.us.ibm.com (HELO e8.ny.us.ibm.com) (32.97.182.138) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 07 Feb 2013 22:34:18 +0000 Received: from /spool/local by e8.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 7 Feb 2013 17:34:17 -0500 Received: from d01dlp01.pok.ibm.com (9.56.250.166) by e8.ny.us.ibm.com (192.168.1.108) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 7 Feb 2013 17:34:15 -0500 Received: from d01relay02.pok.ibm.com (d01relay02.pok.ibm.com [9.56.227.234]) by d01dlp01.pok.ibm.com (Postfix) with ESMTP id E979838C801C for ; Thu, 7 Feb 2013 17:34:14 -0500 (EST) Received: from d01av04.pok.ibm.com (d01av04.pok.ibm.com [9.56.224.64]) by d01relay02.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r17MYE26294952 for ; Thu, 7 Feb 2013 17:34:14 -0500 Received: from d01av04.pok.ibm.com (loopback [127.0.0.1]) by d01av04.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r17MYEZw014593 for ; Thu, 7 Feb 2013 17:34:14 -0500 Received: from ibm-tiger.the-meissners.org ([9.33.37.85]) by d01av04.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id r17MYDGn014223; Thu, 7 Feb 2013 17:34:13 -0500 Received: by ibm-tiger.the-meissners.org (Postfix, from userid 500) id 53507425C2; Thu, 7 Feb 2013 17:34:09 -0500 (EST) Date: Thu, 7 Feb 2013 17:34:09 -0500 From: Michael Meissner To: gcc-patches@gcc.gnu.org, dje.gcc@gmail.com Subject: [PATCH] PR 56043, Fix segfault in 4.7/4.8 powerpc tests Message-ID: <20130207223408.GA19552@ibm-tiger.the-meissners.org> Mail-Followup-To: Michael Meissner , gcc-patches@gcc.gnu.org, dje.gcc@gmail.com MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-12-10) X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13020722-9360-0000-0000-0000104AFA74 X-IsSubscribed: yes 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 following patch fixes a segmentation fault for the powerpc-none-eabi toolchain on the vsx-mass-1.c test. Some of the builtin functions are not defined in that environment, and the compiler did not check whether a pointer was NULL before using it. I also fixed the test so that it would only run under powerpc*-*-linux*, since the text would fail on systems like eabi because some of the builtin functions would not call their vector counterparts in the MASS library. I've built both 4.8 and 4.7 with this patch, and I didn't notice any regressions. Is it ok to install in both the 4.7 tree and trunk? [gcc] 2013-02-07 Michael Meissner PR target/56043 * config/rs6000/rs6000.c (rs6000_builtin_vectorized_libmass): If there is no implicit builtin declaration, just return NULL. [gcc/testsuite] 2013-02-07 Michael Meissner PR target/56043 * gcc.target/powerpc/vsx-mass-1.c: Only run this test on powerpc*-*-linux*. Index: gcc/config/rs6000/rs6000.c =================================================================== --- gcc/config/rs6000/rs6000.c (revision 195825) +++ gcc/config/rs6000/rs6000.c (working copy) @@ -3699,7 +3699,8 @@ rs6000_builtin_vectorized_libmass (tree bdecl = builtin_decl_implicit (fn); suffix = "d2"; /* pow -> powd2 */ if (el_mode != DFmode - || n != 2) + || n != 2 + || !bdecl) return NULL_TREE; break; @@ -3736,7 +3737,8 @@ rs6000_builtin_vectorized_libmass (tree bdecl = builtin_decl_implicit (fn); suffix = "4"; /* powf -> powf4 */ if (el_mode != SFmode - || n != 4) + || n != 4 + || !bdecl) return NULL_TREE; break; @@ -3749,6 +3751,9 @@ rs6000_builtin_vectorized_libmass (tree gcc_assert (suffix != NULL); bname = IDENTIFIER_POINTER (DECL_NAME (bdecl)); + if (!bname) + return NULL_TREE; + strcpy (name, bname + sizeof ("__builtin_") - 1); strcat (name, suffix); Index: gcc/testsuite/gcc.target/powerpc/vsx-mass-1.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/vsx-mass-1.c (revision 195825) +++ gcc/testsuite/gcc.target/powerpc/vsx-mass-1.c (working copy) @@ -1,4 +1,4 @@ -/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-do compile { target { powerpc*-*-linux* } } } */ /* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ /* { dg-require-effective-target powerpc_vsx_ok } */ /* { dg-options "-O3 -ftree-vectorize -mcpu=power7 -ffast-math -mveclibabi=mass" } */