From patchwork Tue Nov 14 17:51:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 837955 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-87089-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="PreY/tkv"; dkim-atps=neutral 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 3ybw7Q1xR8z9s3T for ; Wed, 15 Nov 2017 04:52:02 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:cc:subject:message-id :mime-version:content-type; q=dns; s=default; b=K+snrSkV2x6sj/hX 51H6kV4QYDRcaziJHugYT1JVpABa+30/a3Xb/tvuiwK7clgJNGJZL1WvBu3XowcZ Gqqx+eVhjfKhg8nNdU8vRyYFoNz1VOnBnMMVhjWabZTFvJbSutw7raYaelMj+N5m kzWlM14ZJRt2K/zeinFJZ6aWo34= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:cc:subject:message-id :mime-version:content-type; s=default; bh=QwXlfBoWryOrS35rHzW2vU kxigQ=; b=PreY/tkvlOKZhEd1CUVjP/T/hHfIP8HnGyMqDpuDvo2FwUuOsHqjD4 YprkABmMzClcOSP2YttPA8R9WThQkRZAImSzzMWHJssCODK0MnUkIrxHjmrZeHAw 18C9OEEcnNhOKruXKlJQWsttF75r5M8HlFDUNRhEutkDh2bE1Fm7o= Received: (qmail 116769 invoked by alias); 14 Nov 2017 17:51:40 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 116712 invoked by uid 89); 14 Nov 2017 17:51:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KB_WAM_FROM_NAME_SINGLEWORD, RCVD_IN_DNSWL_NONE, SPF_PASS, URIBL_RED autolearn=ham version=3.3.2 spammy= X-HELO: relay1.mentorg.com Date: Tue, 14 Nov 2017 17:51:32 +0000 From: Joseph Myers To: CC: Subject: Fix string/bug-strncat1.c build with GCC 8 [committed] Message-ID: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 X-ClientProxiedBy: svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) To SVR-IES-MBX-03.mgc.mentorg.com (139.181.222.3) GCC 8 warns about strncat calls with truncated output. string/bug-strncat1.c tests such a call; this patch disables the warning for it. Tested (compilation) with GCC 8 for x86_64-linux-gnu with build-many-glibcs.py (in conjunction with Martin's patch to allow glibc to build). Committed. 2017-11-14 Joseph Myers * string/bug-strncat1.c: Include . (main): Disable -Wstringop-truncation for strncat call for GCC 8. diff --git a/string/bug-strncat1.c b/string/bug-strncat1.c index f1b5c37..b22beba 100644 --- a/string/bug-strncat1.c +++ b/string/bug-strncat1.c @@ -4,13 +4,21 @@ #include #include #include +#include char d[3] = "\0\1\2"; int main (void) { + DIAG_PUSH_NEEDS_COMMENT; +#if __GNUC_PREREQ (8, 0) + /* GCC 8 warns about strncat truncating output; this is deliberately + tested here. */ + DIAG_IGNORE_NEEDS_COMMENT (8, "-Wstringop-truncation"); +#endif strncat (d, "\5\6", 1); + DIAG_POP_NEEDS_COMMENT; if (d[0] != '\5') { puts ("d[0] != '\\5'");