From patchwork Fri Sep 23 15:42:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Preudhomme X-Patchwork-Id: 674142 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 3sgd0T4cbGz9t1F for ; Sat, 24 Sep 2016 01:42:33 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=eucTCcJv; 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 :subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type; q=dns; s=default; b=cnptWfSdUSy50Yb1F /859eBnuNMAyeQAZgt8HY7kc7DFuyQkAY0sOJB2IN6Mb8JoobxmEbZhwkUBt3f16 eQItbwOIVOYMcw0soiAizwZLNEei6OgB+8IDXfzgsyYByS+vE1NjV20CTLjF65Jb +Hw5ve5Rjim4QZSgeedOHAt5mw= 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 :subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type; s=default; bh=N8vSApWG9PnwJ8RR63tk6KC 4YMM=; b=eucTCcJve0S0pdNoUSWZy21g/CK0KeRQbKh31hH6B1dnuWuhZib6EOr Dft7FdUeLV8KzKP/Jkq+yo75D9t2138YDX0+KaLBeYc8Ua3+RsU/kQtxftqCAcZd PJvzhTDULrplDcuxuIhkD3hOAZngqRvRPUfNWnMRH8kjpiU+exnM= Received: (qmail 79257 invoked by alias); 23 Sep 2016 15:42:23 -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 77867 invoked by uid 89); 23 Sep 2016 15:42:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.0 required=5.0 tests=BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=exceed, unspecified, 989, 7713 X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 23 Sep 2016 15:42:12 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1515BC1D; Fri, 23 Sep 2016 08:42:11 -0700 (PDT) Received: from [10.2.206.52] (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 549ED3F251; Fri, 23 Sep 2016 08:42:10 -0700 (PDT) Subject: Re: [PATCH, GCC] Deal with singular sentences in builtin-sprintf-warn-1.c regex To: "gcc-patches@gcc.gnu.org" , msebor@gmail.com, Richard Biener , Jakub Jelinek References: <4aa6c210-b81a-9edb-f6bd-bad95fcb1f12@foss.arm.com> From: Thomas Preudhomme Message-ID: <1a92da59-caba-3d2b-4f76-daadff2226e9@foss.arm.com> Date: Fri, 23 Sep 2016 16:42:09 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <4aa6c210-b81a-9edb-f6bd-bad95fcb1f12@foss.arm.com> X-IsSubscribed: yes Sorry, forgot the patch. Please find it attached. Best regards, Thomas On 23/09/16 16:40, Thomas Preudhomme wrote: > Hi, > > New builtin-sprintf-warn-1.c testcase contains a few regex of the form "\[0-9\]+ > bytes" or ". bytes". This does not account for the case where the number of byte > is 0 in which case byte would be in the singular form. This caused a FAIL on > arm-none-eabi targets. This patch makes the s optional in all cases where the > number of bytes is unknown. > > I did not commit this fix as obvious as people might want to only do the changes > for lines where the number of bytes *could* be 0 so I prefer to get review. > > ChangeLog entry is as follows: > > *** gcc/testsuite/ChangeLog *** > > 2016-09-23 Thomas Preud'homme > > * gcc.dg/tree-ssa/builtin-sprintf-warn-1.c: Adjust regex to accept > singular form of byte when quantity is unknown. > > > Is this ok for trunk? > > Best regards, > > Thomas diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-1.c b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-1.c index e098be92bb0377414b1f9cacf5e4d2a3398e74ec..85dbcd9d6d3a5b1ad810037f03451207284a25b1 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-1.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-1.c @@ -77,13 +77,13 @@ void test_sprintf_c_const (void) T (-1, "%*c", INT_MAX - 1, '1'); T (-1, "%*c", INT_MAX, '1'); T (-1, "X%*c", INT_MAX - 1, '1'); - T (-1, "X%*c", INT_MAX, '1'); /* { dg-warning "directive output of \[0-9\]+ bytes causes result to exceed .INT_MAX." } */ + T (-1, "X%*c", INT_MAX, '1'); /* { dg-warning "directive output of \[0-9\]+ bytes? causes result to exceed .INT_MAX." } */ - T (-1, "%*c%*c", INT_MAX - 1, '1', INT_MAX - 1, '2'); /* { dg-warning "directive output of \[0-9\]+ bytes causes result to exceed .INT_MAX." } */ + T (-1, "%*c%*c", INT_MAX - 1, '1', INT_MAX - 1, '2'); /* { dg-warning "directive output of \[0-9\]+ bytes? causes result to exceed .INT_MAX." } */ T (-1, "%*cX", INT_MAX - 2, '1'); T (-1, "%*cX", INT_MAX - 1, '1'); - T (-1, "%*cX", INT_MAX, '1'); /* { dg-warning "output of \[0-9\]+ bytes causes result to exceed .INT_MAX." } */ + T (-1, "%*cX", INT_MAX, '1'); /* { dg-warning "output of \[0-9\]+ bytes? causes result to exceed .INT_MAX." } */ } /* Exercise the "%p" directive with constant arguments. */ @@ -98,9 +98,9 @@ void test_sprintf_p_const (void) /* The exact output for %p is unspecified by C. Two formats are known: same as %tx (for example AIX) and same as %#tx (for example Solaris). */ - T (0, "%p", (void*)0x1); /* { dg-warning ".%p. directive writing . bytes into a region of size 0" } */ - T (1, "%p", (void*)0x12); /* { dg-warning ".%p. directive writing . bytes into a region of size 1" } */ - T (2, "%p", (void*)0x123); /* { dg-warning ".%p. directive writing . bytes into a region of size 2" } */ + T (0, "%p", (void*)0x1); /* { dg-warning ".%p. directive writing . bytes? into a region of size 0" } */ + T (1, "%p", (void*)0x12); /* { dg-warning ".%p. directive writing . bytes? into a region of size 1" } */ + T (2, "%p", (void*)0x123); /* { dg-warning ".%p. directive writing . bytes? into a region of size 2" } */ /* GLIBC and uClibc treat the ' ' flag with the "%p" directive the same as with signed integer conversions (i.e., it prepends a space). Other @@ -299,7 +299,7 @@ void test_sprintf_chk_s_const (void) when the size of the destination object is unknown. */ T (-1, "%*s", INT_MAX - 1, ""); T (-1, "%*s", INT_MAX, ""); - T (-1, "X%*s", INT_MAX, ""); /* { dg-warning "directive output of \[0-9\]+ bytes causes result to exceed .INT_MAX." } */ + T (-1, "X%*s", INT_MAX, ""); /* { dg-warning "directive output of \[0-9\]+ bytes? causes result to exceed .INT_MAX." } */ /* Multiple directives. */