From patchwork Fri May 5 18:10:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Sebor X-Patchwork-Id: 759130 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 3wKKgl4PwNz9s7p for ; Sat, 6 May 2017 04:10:25 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="GaHy+Xyx"; 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 :subject:to:message-id:date:mime-version:content-type; q=dns; s= default; b=V+hjTUFpOehIdhtoeIdJajEewkm0/Izsb5WIpEXt5vzM+ARXxaO3V r2OJSE7C0xdksUle9yv+XUsbPdHBDKiQTOIN8WrG9m/0GWFaVQ/VitS+QAaLO5JT MjnaF+W9fwqLFvS3V5blb55J3TnpxmBOJOUa4ADjB9caILi6je1HMg= 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 :subject:to:message-id:date:mime-version:content-type; s= default; bh=lfo3BWU2Jo98gRQTV9vKNXgOhiQ=; b=GaHy+XyxAdS4wfYvoQgE tvkePBNU9Iwc00/omaQQxwjOdC/NDkhx3/dLK6hr3awFYLZwJbDumx4vsrhD/YCe 0R2Zy2M1i1CjR3/mL9mxodtYpsemjOSyWSRY6f7bJKZ4KIQ/G1p1i73C80MnqsF1 TfabQDIMds8JcdxEJZTKOSg= Received: (qmail 113236 invoked by alias); 5 May 2017 18:10:11 -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 113217 invoked by uid 89); 5 May 2017 18:10:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.7 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy=1316, HX-Received:10.55.131.2 X-HELO: mail-qk0-f178.google.com Received: from mail-qk0-f178.google.com (HELO mail-qk0-f178.google.com) (209.85.220.178) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 05 May 2017 18:10:08 +0000 Received: by mail-qk0-f178.google.com with SMTP id u75so11882363qka.3 for ; Fri, 05 May 2017 11:10:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:message-id:date:user-agent :mime-version; bh=HSo5PmUIIV7MsWg5LVDDdVT6KenbQgz05GRt+wxk9ys=; b=oq2sZh7lFv/ms4mD57SX88g5BiCifkZPMAMcdcDwOY12qc6eLCAhRakMzFS34BP6Sa DozNe8s5L6s01ZlbBR6+mtqBGT1AmygCiLXmhpjV7yFA+IK+UMIyRXF5/siUr87J2gtX cBsXwO51i5A58uFe0pYjLApMbbNzOQesGaXer1ACpey9EtxFTkLz1IRPt6muIf8JG5L/ Z64U4c4SZ0ab2eTr8WlBj2AY9onaPdxMnICH+3Ar4cNSb5dpa98HYRJ5ewaoYzB97v84 i9UVjJPZgwQak1N3JzVGJTOcCZdyGABEa1JrO4wwafCNd93RMztKu0n5NtRZRL0KZpzn Eiqg== X-Gm-Message-State: AN3rC/5C80Wxd/j4iIp65gJM1xV94F5hj/51Q4zG/kHIKscyasWnDNXw YxkhyulKh+0MUqVf X-Received: by 10.55.131.2 with SMTP id f2mr15589601qkd.227.1494007809255; Fri, 05 May 2017 11:10:09 -0700 (PDT) Received: from localhost.localdomain (75-166-101-229.hlrn.qwest.net. [75.166.101.229]) by smtp.gmail.com with ESMTPSA id f13sm3963011qta.59.2017.05.05.11.10.08 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 May 2017 11:10:08 -0700 (PDT) From: Martin Sebor Subject: [committed] fix inconsistencies introduced during merge conflict resolution To: Gcc Patch List Message-ID: Date: Fri, 5 May 2017 12:10:07 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 X-IsSubscribed: yes r247652 fixes a number of inconsistencies between the pattern of diagnostics expected by tests and those actually issued by GCC, and introduced while resolving merge conflicts. My best guess is that I missed them by testing the wrong patch or the wrong local copy. The committed diff is attached for reference. Martin Index: gcc/builtins.c =================================================================== --- gcc/builtins.c (revision 247651) +++ gcc/builtins.c (revision 247652) @@ -3147,12 +3147,12 @@ check_sizes (int opt, tree exp, tree size, tree ma if (range[0] == range[1]) warning_at (loc, opt, - "%K%qD: specified size %E " + "%K%qD specified size %E " "exceeds maximum object size %E", exp, get_callee_fndecl (exp), range[0], maxobjsize); else warning_at (loc, opt, - "%K%qD: specified size between %E and %E " + "%K%qD specified size between %E and %E " "exceeds maximum object size %E", exp, get_callee_fndecl (exp), range[0], range[1], maxobjsize); @@ -3178,7 +3178,7 @@ check_sizes (int opt, tree exp, tree size, tree ma and a source of unknown length. The call will write at least one byte past the end of the destination. */ warning_at (loc, opt, - "%K%qD: writing %E or more bytes into a region " + "%K%qD writing %E or more bytes into a region " "of size %E overflows the destination", exp, get_callee_fndecl (exp), range[0], objsize); } @@ -3185,7 +3185,7 @@ check_sizes (int opt, tree exp, tree size, tree ma else if (tree_int_cst_equal (range[0], range[1])) warning_at (loc, opt, (integer_onep (range[0]) - ? G_("%K%qD: writing %E byte into a region " + ? G_("%K%qD writing %E byte into a region " "of size %E overflows the destination") : G_("%K%qD writing %E bytes into a region " "of size %E overflows the destination")), @@ -3194,13 +3194,13 @@ check_sizes (int opt, tree exp, tree size, tree ma { /* Avoid printing the upper bound if it's invalid. */ warning_at (loc, opt, - "%K%qD: writing %E or more bytes into a region " + "%K%qD writing %E or more bytes into a region " "of size %E overflows the destination", exp, get_callee_fndecl (exp), range[0], objsize); } else warning_at (loc, opt, - "%K%qD: writing between %E and %E bytes into " + "%K%qD writing between %E and %E bytes into " "a region of size %E overflows the destination", exp, get_callee_fndecl (exp), range[0], range[1], objsize); @@ -3229,13 +3229,13 @@ check_sizes (int opt, tree exp, tree size, tree ma is greater than the object size if both are big. */ if (range[0] == range[1]) warning_at (loc, opt, - "%K%qD: specified bound %E " + "%K%qD specified bound %E " "exceeds maximum object size %E", exp, get_callee_fndecl (exp), range[0], maxobjsize); else warning_at (loc, opt, - "%K%qD: specified bound between %E and %E " + "%K%qD specified bound between %E and %E " "exceeds maximum object size %E", exp, get_callee_fndecl (exp), range[0], range[1], maxobjsize); @@ -3247,13 +3247,13 @@ check_sizes (int opt, tree exp, tree size, tree ma { if (tree_int_cst_equal (range[0], range[1])) warning_at (loc, opt, - "%K%qD: specified bound %E " + "%K%qD specified bound %E " "exceeds destination size %E", exp, get_callee_fndecl (exp), range[0], objsize); else warning_at (loc, opt, - "%K%qD: specified bound between %E and %E " + "%K%qD specified bound between %E and %E " "exceeds destination size %E", exp, get_callee_fndecl (exp), range[0], range[1], objsize); @@ -3272,7 +3272,7 @@ check_sizes (int opt, tree exp, tree size, tree ma if (tree_int_cst_equal (range[0], range[1])) warning_at (loc, opt, (tree_int_cst_equal (range[0], integer_one_node) - ? G_("%K%qD: reading %E byte from a region of size %E") + ? G_("%K%qD reading %E byte from a region of size %E") : G_("%K%qD reading %E bytes from a region of size %E")), exp, get_callee_fndecl (exp), range[0], slen); else if (tree_int_cst_sign_bit (range[1])) @@ -3279,13 +3279,13 @@ check_sizes (int opt, tree exp, tree size, tree ma { /* Avoid printing the upper bound if it's invalid. */ warning_at (loc, opt, - "%K%qD: reading %E or more bytes from a region " + "%K%qD reading %E or more bytes from a region " "of size %E", exp, get_callee_fndecl (exp), range[0], slen); } else warning_at (loc, opt, - "%K%qD: reading between %E and %E bytes from a region " + "%K%qD reading between %E and %E bytes from a region " "of size %E", exp, get_callee_fndecl (exp), range[0], range[1], slen); return false; @@ -3876,7 +3876,7 @@ check_strncat_sizes (tree exp, tree objsize) loc = expansion_point_location_if_in_system_header (loc); warning_at (loc, OPT_Wstringop_overflow_, - "%K%qD: specified bound %E equals destination size", + "%K%qD specified bound %E equals destination size", exp, get_callee_fndecl (exp), maxlen); return false; @@ -3942,7 +3942,7 @@ expand_builtin_strncat (tree exp, rtx) loc = expansion_point_location_if_in_system_header (loc); warning_at (loc, OPT_Wstringop_overflow_, - "%K%qD: specified bound %E equals destination size", + "%K%qD specified bound %E equals destination size", exp, get_callee_fndecl (exp), maxlen); return NULL_RTX; Index: gcc/testsuite/gcc.dg/pr79214.c =================================================================== --- gcc/testsuite/gcc.dg/pr79214.c (revision 247651) +++ gcc/testsuite/gcc.dg/pr79214.c (revision 247652) @@ -22,27 +22,27 @@ size_t range (void) void test_bzero (void) { - bzero (d, range ()); /* { dg-warning ".__builtin_bzero. writing between 4 and \[0-9\]+ bytes into a region of size 3 overflows the destination" } */ + bzero (d, range ()); /* { dg-warning ".__builtin_bzero. writing 4 or more bytes into a region of size 3 overflows the destination" } */ } void test_memcpy (void) { - memcpy (d, s, range ()); /* { dg-warning ".__builtin_memcpy. writing between 4 and \[0-9\]+ bytes into a region of size 3 overflows the destination" } */ + memcpy (d, s, range ()); /* { dg-warning ".__builtin_memcpy. writing 4 or more bytes into a region of size 3 overflows the destination" } */ } void test_memmove (void) { - memmove (d, d + 1, range ()); /* { dg-warning ".__builtin_memmove. writing between 4 and \[0-9\]+ bytes into a region of size 3 overflows the destination" } */ + memmove (d, d + 1, range ()); /* { dg-warning ".__builtin_memmove. writing 4 or more bytes into a region of size 3 overflows the destination" } */ } void test_mempcpy (void) { - mempcpy (d, s, range ()); /* { dg-warning ".__builtin_mempcpy. writing between 4 and \[0-9\]+ bytes into a region of size 3 overflows the destination" } */ + mempcpy (d, s, range ()); /* { dg-warning ".__builtin_mempcpy. writing 4 or more bytes into a region of size 3 overflows the destination" } */ } void test_memset (int n) { - memset (d, n, range ()); /* { dg-warning ".__builtin_memset. writing between 4 and \[0-9\]+ bytes into a region of size 3 overflows the destination" } */ + memset (d, n, range ()); /* { dg-warning ".__builtin_memset. writing 4 or more bytes into a region of size 3 overflows the destination" } */ } void test_strcat (int i) @@ -49,7 +49,7 @@ void test_strcat (int i) { const char *s = i < 0 ? "123" : "4567"; - strcat (d, s); /* { dg-warning ".__builtin_strcat. writing 4 bytes into a region of size 3 overflows the destination" } */ + strcat (d, s); /* { dg-warning ".__builtin_strcat. writing between 4 and 5 bytes into a region of size 3 overflows the destination" } */ } char* test_stpcpy (int i) @@ -56,7 +56,7 @@ char* test_stpcpy (int i) { const char *s = i < 0 ? "123" : "4567"; - return stpcpy (d, s); /* { dg-warning ".__builtin_stpcpy. writing 4 bytes into a region of size 3 overflows the destination" } */ + return stpcpy (d, s); /* { dg-warning ".__builtin_stpcpy. writing between 4 and 5 bytes into a region of size 3 overflows the destination" } */ } char* test_stpncpy (int i) @@ -63,7 +63,7 @@ char* test_stpncpy (int i) { const char *s = i < 0 ? "123" : "4567"; - return stpncpy (d, s, range ()); /* { dg-warning ".__builtin_stpncpy. writing between 4 and \[0-9\]+ bytes into a region of size 3 overflows the destination" } */ + return stpncpy (d, s, range ()); /* { dg-warning ".__builtin_stpncpy. writing 4 or more bytes into a region of size 3 overflows the destination" } */ } char* test_strcpy (int i) @@ -70,7 +70,7 @@ char* test_strcpy (int i) { const char *s = i < 0 ? "123" : "4567"; - return strcpy (d, s); /* { dg-warning ".__builtin_strcpy. writing 4 bytes into a region of size 3 overflows the destination" } */ + return strcpy (d, s); /* { dg-warning ".__builtin_strcpy. writing between 4 and 5 bytes into a region of size 3 overflows the destination" } */ } char* test_strncpy (int i) @@ -77,7 +77,7 @@ char* test_strncpy (int i) { const char *s = i < 0 ? "123" : "4567"; - return strncpy (d, s, range ()); /* { dg-warning ".__builtin_strncpy. writing between 4 and \[0-9\]+ bytes into a region of size 3 overflows the destination" } */ + return strncpy (d, s, range ()); /* { dg-warning ".__builtin_strncpy. writing 4 or more bytes into a region of size 3 overflows the destination" } */ } char* test_strncat (int i) @@ -84,5 +84,5 @@ char* test_strncat (int i) { const char *s = i < 0 ? "123" : "4567"; - return strncat (d, s, range ()); /* { dg-warning ".__builtin_strncat.: specified bound between 4 and \[0-9\]+" } */ + return strncat (d, s, range ()); /* { dg-warning ".__builtin_strncat. specified bound between 4 and \[0-9\]+" } */ } Index: gcc/testsuite/gcc.dg/pr79222.c =================================================================== --- gcc/testsuite/gcc.dg/pr79222.c (revision 247651) +++ gcc/testsuite/gcc.dg/pr79222.c (revision 247652) @@ -9,5 +9,5 @@ char d[3]; char* f (int i) { const char *s = i < 0 ? "01234567" : "9876543210"; - return stpcpy (d, s); /* { dg-warning ".stpcpy. writing 9 bytes into a region of size 3 overflows the destination" } */ + return stpcpy (d, s); /* { dg-warning ".stpcpy. writing between 9 and 11 bytes into a region of size 3 overflows the destination" } */ } Index: gcc/testsuite/gcc.dg/pr79223.c =================================================================== --- gcc/testsuite/gcc.dg/pr79223.c (revision 247651) +++ gcc/testsuite/gcc.dg/pr79223.c (revision 247652) @@ -23,15 +23,15 @@ size_t range (void) void test_memcpy (void) { - memcpy (d, s, range ()); /* { dg-warning ".memcpy. writing between 4 and \[0-9\]+ bytes into a region of size 3 overflows the destination" } */ + memcpy (d, s, range ()); /* { dg-warning ".memcpy. writing 4 or more bytes into a region of size 3 overflows the destination" } */ } void test_mempcpy (void) { - mempcpy (d, s, range ()); /* { dg-warning ".mempcpy. writing between 4 and \[0-9\]+ bytes into a region of size 3 overflows the destination" } */ + mempcpy (d, s, range ()); /* { dg-warning ".mempcpy. writing 4 or more bytes into a region of size 3 overflows the destination" } */ } void test_memmove (void) { - memmove (d + 1, d, range ()); /* { dg-warning ".memmove. writing between 4 and \[0-9\]+ bytes into a region of size 2 overflows the destination" } */ + memmove (d + 1, d, range ()); /* { dg-warning ".memmove. writing 4 or more bytes into a region of size 2 overflows the destination" } */ } Index: gcc/testsuite/gcc.dg/pr78138.c =================================================================== --- gcc/testsuite/gcc.dg/pr78138.c (revision 247651) +++ gcc/testsuite/gcc.dg/pr78138.c (revision 247652) @@ -12,7 +12,7 @@ extern char* strcpy (char*, const char*); void f (int i, int j) { - strcpy (d, j ? "12345" : "123456"); /* { dg-warning ".strcpy.: writing between 6 and 7 bytes into a region of size 5 " } */ + strcpy (d, j ? "12345" : "123456"); /* { dg-warning ".strcpy. writing between 6 and 7 bytes into a region of size 5 " } */ } void g (void *p) Index: gcc/testsuite/gcc.dg/tree-ssa/builtins-folding-gimple-ub.c =================================================================== --- gcc/testsuite/gcc.dg/tree-ssa/builtins-folding-gimple-ub.c (revision 247651) +++ gcc/testsuite/gcc.dg/tree-ssa/builtins-folding-gimple-ub.c (revision 247652) @@ -13,9 +13,16 @@ main (void) /* MEMCHR. */ if (__builtin_memchr ("", 'x', 1000)) /* Not folded away. */ - __builtin_abort (); + { + /* { dg-warning "reading 1000 bytes from a region of size 1" "" { target *-*-* } .-2 } */ + __builtin_abort (); + } + if (__builtin_memchr (foo1, 'x', 1000)) /* Not folded away. */ - __builtin_abort (); + { + /* { dg-warning "reading 1000 bytes from a region of size 1" "" { target *-*-* } .-2 } */ + __builtin_abort (); + } /* STRNCMP. */ if (strncmp ("a", "b", -1)) /* { dg-warning "implicit declaration of function" } */