From patchwork Fri Dec 18 17:07:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Clifton X-Patchwork-Id: 559001 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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 486061401AD for ; Sat, 19 Dec 2015 04:08:01 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=j6khpWab; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; q=dns; s= default; b=n3HbwQEEZYeRoP+zH9XXmzFsBpCU1vRYPirCgCJXXPt02K4NYuD1A RQ/2u/M7Af7hm276YSYeuF+VnY0ngF3IXfHJhB64RQNosJPgXSCX1wB6uxF1ohCS qZr7UUNGSp9NeiwZBdgYZ/f/RV5hGpX+R/3jjq6zT2T1T90Wga6Cbw= 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:from :to:subject:date:message-id:mime-version:content-type; s= default; bh=1AWrH6jF30Fm1br6jSnnIbI/qSw=; b=j6khpWabTeCz4cuJ2DbF EwxGPHVob2T6YrUdCdtao2VG1L9r4TkaPQYR3dpmvCsD0z4OnjzC8eWU9E0j+Ac5 qzMt1w+4RvzrudqxH8CRgG7xoAp4hNFf30Gy997x7YgNzTPMO1S1N22H6R3qzeWK Qgxfr2Y3yiYgxPSB3BmA4yM= Received: (qmail 17284 invoked by alias); 18 Dec 2015 17:07:53 -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 17269 invoked by uid 89); 18 Dec 2015 17:07:52 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, SPF_HELO_PASS, T_RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=Hence, our X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 18 Dec 2015 17:07:52 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id CB5DCA3B60 for ; Fri, 18 Dec 2015 17:07:50 +0000 (UTC) Received: from littlehelper.redhat.com (vpn1-6-231.ams2.redhat.com [10.36.6.231]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tBIH7mhC003677 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Fri, 18 Dec 2015 12:07:50 -0500 From: Nick Clifton To: gcc-patches@gcc.gnu.org Subject: RFA: PR 68913: Provide weak version of __fread_chk for PR61886 test Date: Fri, 18 Dec 2015 17:07:48 +0000 Message-ID: <87egejk7mj.fsf@redhat.com> MIME-Version: 1.0 X-IsSubscribed: yes Hi Guys, PR 68913 notes that the test gcc.dg/lto/pr61886_0.c test fails on targets whose C library does not provide a __fread_chk function. Since the purpose of the test is to show that GCC will correctly discard the invocation of __fread_chk_warn, we do not need to actually link against a real __fread_chk function. A dummy will do. Hence I would like to apply the patch below. This patch resolves unexpected failures of the pr61886_0.c test on targets like spu-elf and sparc64-elf. Cheers Nick gcc/testsuite/ChangeLog 2015-12-18 Nick Clifton PR 68913 * gcc.dg/lto/pr61886_0.c (__fread_chk): Provide a weak definition of this function. Index: gcc/testsuite/gcc.dg/lto/pr61886_0.c =================================================================== --- gcc/testsuite/gcc.dg/lto/pr61886_0.c (revision 231805) +++ gcc/testsuite/gcc.dg/lto/pr61886_0.c (working copy) @@ -4,7 +4,21 @@ typedef __SIZE_TYPE__ size_t; typedef struct _IO_FILE FILE; -extern size_t __fread_chk (void *__restrict __ptr, size_t __ptrlen, size_t __size, size_t __n, FILE *__restrict __stream) __asm__ ("" "__fread_chk") __attribute__ ((__warn_unused_result__)); +/* PR 68913: Not all targets have __fread_chk available, + so we provide our own version for this function here. */ + +size_t __fread_chk (void *__restrict, size_t, size_t, size_t, FILE *__restrict) __attribute__ ((__warn_unused_result__,weak)); +size_t +__fread_chk (void *__restrict __ptr __attribute__((unused)), + size_t __ptrlen __attribute__((unused)), + size_t __size __attribute__((unused)), + size_t __n __attribute__((unused)), + FILE *__restrict __stream __attribute__((unused))) +{ + return 0; +} + + extern size_t __fread_chk_warn (void *__restrict __ptr, size_t __ptrlen, size_t __size, size_t __n, FILE *__restrict __stream) __asm__ ("" "__fread_chk") __attribute__ ((__warn_unused_result__)) __attribute__((__warning__ ("fread called with bigger size * nmemb than length " "of destination buffer"))); extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__gnu_inline__)) __attribute__ ((__artificial__)) __attribute__ ((__warn_unused_result__))