From patchwork Thu Mar 10 00:39:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siddhesh Poyarekar X-Patchwork-Id: 51832 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7D8B93857C7E for ; Thu, 10 Mar 2022 00:40:39 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from dragonfly.birch.relay.mailchannels.net (dragonfly.birch.relay.mailchannels.net [23.83.209.51]) by sourceware.org (Postfix) with ESMTPS id 5C1BC3858415 for ; Thu, 10 Mar 2022 00:40:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5C1BC3858415 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gotplt.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gotplt.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 75AD862199A for ; Thu, 10 Mar 2022 00:40:19 +0000 (UTC) Received: from pdx1-sub0-mail-a307.dreamhost.com (unknown [127.0.0.6]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 0D4D9622699 for ; Thu, 10 Mar 2022 00:40:19 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1646872819; a=rsa-sha256; cv=none; b=7ppN53fbq+CD1rmkws497CPDSAB51rCrXglA+LzyOf9+KJrj0cVbH8Kcci12EZ2Ge7Prsk DJ6+60thK6+98XNuQQ+t5f99ARTFSz+mYMCXxByoXiekgQH/JUY5BXE+fWZQHh6Lbwkgba UtmSg8ttNmadnD8KXDOqHAR+QJR2oU748dmUbFyemNJnw5swGOfkhJ3vdJGVRvZrIvokzd YgwnPlJxH4HNNaRHY1s1gB47Z1BLpcjcpssyr0wAfHBV6pa8M4TZLM98ne1nSaFo3IggZU Rcr/+PblSPwMCmtXJF0TppCTCuH8P4alYHSCVYG9t5jclYikNdD0P3suLne45w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1646872819; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:dkim-signature; bh=oo82YF5nb2FXbOlh+SEUUsIaEfWd6EhL2iXRxJ7Kx/w=; b=UC99as86TBLpCjEhTZV4a3dWE4GjzsRSlYQkIE2UQqiUT/8r7prtGmVZuKGlROxv1mtyGO tcCTn2l5LDg8eGrNSta64lLX029nCipDpm2vtmzUyo8GBfou+vj2kKte20wqlSJUU72K6K jXydByPyN5nldgGu6raij9yvAp4431/CzJTXRQrqUJJ2GiAseV+k72zO/KQfLKuo3da6kj tyKOHSMigAbHXSEeutsbcRhxYEoxVaSyg4eCg7zBkfm7fp68dRhltkHwHe8A9wVGktAiWB qlEDRa64COfgQH1GMKUlQ7jKsX7qooNRH3usn/prKlwwTeg5cPgZgEwsJWipfw== ARC-Authentication-Results: i=1; rspamd-c9cb649d9-wmzd9; auth=pass smtp.auth=dreamhost smtp.mailfrom=siddhesh@gotplt.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from pdx1-sub0-mail-a307.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.124.31.75 (trex/6.5.3); Thu, 10 Mar 2022 00:40:19 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Skirt-Skirt: 754838d33599d0b1_1646872819335_877678938 X-MC-Loop-Signature: 1646872819335:1912731430 X-MC-Ingress-Time: 1646872819335 Received: from rhbox.redhat.com (unknown [1.186.122.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a307.dreamhost.com (Postfix) with ESMTPSA id 4KDVb55DRcz22 for ; Wed, 9 Mar 2022 16:40:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gotplt.org; s=dreamhost; t=1646872818; bh=oo82YF5nb2FXbOlh+SEUUsIaEfWd6EhL2iXRxJ7Kx/w=; h=From:To:Subject:Date:Content-Transfer-Encoding; b=vurY4xHmQFXF4dzHuvzPYIVK7YG+jCpAiJYcxOTx2+webJSonnPtvzQbxM/i6+8RV DUf/qCMqCgeopy2BibN1I4thpMYcq1i0W+wrzkMxyXwp3XimFMLfbr2lO+MTH0s2IX haKBy2x8fDSJOnh2+2SOMoMheFqFJjlNcOEqR7h3aL7bZX0yA2RdbdeNQDjVAoTrJI 07ufXJpRphtI393h7TPXkt4DRnqxfn9wnhhed5B+axgaKGk/ewzYXiTWYSWm/9QQQk yHQ2/DhgwsF1Q5zL9iG9Z8SWeAIDf/IZf5qllN+zf6E4+JMFmNspW+HltLyly+Husu JytzafXFMYlOg== From: Siddhesh Poyarekar To: gcc-patches@gcc.gnu.org Subject: [PATCH] middle-end/104854: Avoid overread warning for strnlen and strndup Date: Thu, 10 Mar 2022 06:09:55 +0530 Message-Id: <20220310003955.1784701-1-siddhesh@gotplt.org> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-Spam-Status: No, score=-3037.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, RCVD_IN_SBL, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" The size argument larger than size of SRC for strnlen and strndup is problematic only if SRC is not NULL terminated, which invokes undefined behaviour. In all other cases, as long as SRC is large enough to have a NULL char (i.e. size 1 or more), a larger N should not invoke a warning during compilation. Such a warning may be a suitable check for the static analyzer instead with slightly different wording suggesting that choice of size argument makes the function call equivalent to strlen/strdup. This change results in the following code going through without a warning: ------------------ char *buf; char * foo (void) { buf = __builtin_malloc (4); __builtin_memset (buf, 'A', 4); return __builtin_strndup (buf, 5); } int main () { __builtin_printf ("%s\n", foo ()); } ------------------ but the problem above is a missing NULL, not N being larger than the size of SRC and the overread warning in this context is confusing at best and misleading (and hinting at the wrong solution) in the worst case. gcc/ChangeLog: middle-end/104854 * gimple-ssa-warn-access.cc (check_access): New parameter. Skip warning if in read-only mode, source string is NULL terminated and has non-zero object size. (check_access): New parameter. (check_access): Adjust. (check_read_access): New parameter. Adjust for check_access change. (pass_waccess::check_builtin): Adjust check_read_access call for memcmp, memchr. (pass_waccess::maybe_check_access_sizes): Likewise. gcc/testsuite/ChangeLog: middle-end/104854 * gcc.dg/Wstringop-overread.c (test_strnlen_array, test_strndup_array): Don't expect warning for non-zero source sizes. * gcc.dg/attr-nonstring-4.c (strnlen_range): Likewise. * gcc.dg/pr78902.c: Likewise. * gcc.dg/warn-strnlen-no-nul.c: Likewise. Signed-off-by: Siddhesh Poyarekar --- Tested with an x86_64 bootstrap. strncmp has a similar issue, I'll post a separate patch for it. gcc/gimple-ssa-warn-access.cc | 35 ++++++++++++++-------- gcc/testsuite/gcc.dg/Wstringop-overread.c | 26 ++++++++-------- gcc/testsuite/gcc.dg/attr-nonstring-4.c | 2 +- gcc/testsuite/gcc.dg/pr78902.c | 1 - gcc/testsuite/gcc.dg/warn-strnlen-no-nul.c | 16 +++++----- 5 files changed, 45 insertions(+), 35 deletions(-) diff --git a/gcc/gimple-ssa-warn-access.cc b/gcc/gimple-ssa-warn-access.cc index c36cd5d45d4..972e80e4b62 100644 --- a/gcc/gimple-ssa-warn-access.cc +++ b/gcc/gimple-ssa-warn-access.cc @@ -1256,7 +1256,7 @@ static bool check_access (GimpleOrTree exp, tree dstwrite, tree maxread, tree srcstr, tree dstsize, access_mode mode, const access_data *pad, - range_query *rvals) + range_query *rvals, bool null_terminated) { /* The size of the largest object is half the address space, or PTRDIFF_MAX. (This is way too permissive.) */ @@ -1431,6 +1431,15 @@ check_access (GimpleOrTree exp, tree dstwrite, } } + /* For functions that take string inputs and stop reading on encountering a + NULL, if remaining size in the source is non-zero, it is legitimate for + such functions to pass a larger size (that perhaps is the maximum object + size of all possible inputs), making the MAXREAD comparison noisy. */ + if (null_terminated + && pad && pad->mode == access_read_only + && pad->src.size_remaining () != 0) + return true; + /* Check the maximum length of the source sequence against the size of the destination object if known, or against the maximum size of an object. */ @@ -1522,10 +1531,10 @@ static bool check_access (gimple *stmt, tree dstwrite, tree maxread, tree srcstr, tree dstsize, access_mode mode, const access_data *pad, - range_query *rvals) + range_query *rvals, bool null_terminated = true) { return check_access (stmt, dstwrite, maxread, srcstr, dstsize, - mode, pad, rvals); + mode, pad, rvals, null_terminated); } bool @@ -1534,7 +1543,7 @@ check_access (tree expr, tree dstwrite, access_mode mode, const access_data *pad /* = NULL */) { return check_access (expr, dstwrite, maxread, srcstr, dstsize, - mode, pad, nullptr); + mode, pad, nullptr, true); } /* Return true if STMT is a call to an allocation function. Unless @@ -2109,7 +2118,8 @@ private: void check_stxncpy (gcall *); void check_strncmp (gcall *); void check_memop_access (gimple *, tree, tree, tree); - void check_read_access (gimple *, tree, tree = NULL_TREE, int = 1); + void check_read_access (gimple *, tree, tree = NULL_TREE, int = 1, + bool = true); void maybe_check_dealloc_call (gcall *); void maybe_check_access_sizes (rdwr_map *, tree, tree, gimple *); @@ -2745,7 +2755,7 @@ pass_waccess::check_memop_access (gimple *stmt, tree dest, tree src, tree size) tree dstsize = compute_objsize (dest, stmt, 0, &data.dst, &m_ptr_qry); check_access (stmt, size, /*maxread=*/NULL_TREE, srcsize, dstsize, - data.mode, &data, m_ptr_qry.rvals); + data.mode, &data, m_ptr_qry.rvals, false); } /* A convenience wrapper for check_access to check access by a read-only @@ -2754,7 +2764,8 @@ pass_waccess::check_memop_access (gimple *stmt, tree dest, tree src, tree size) void pass_waccess::check_read_access (gimple *stmt, tree src, tree bound /* = NULL_TREE */, - int ost /* = 1 */) + int ost /* = 1 */, + bool null_terminated /* = true */) { if (m_early_checks_p || !warn_stringop_overread) return; @@ -2770,7 +2781,7 @@ pass_waccess::check_read_access (gimple *stmt, tree src, compute_objsize (src, stmt, ost, &data.src, &m_ptr_qry); check_access (stmt, /*dstwrite=*/ NULL_TREE, /*maxread=*/ bound, /*srcstr=*/ src, /*dstsize=*/ NULL_TREE, data.mode, - &data, m_ptr_qry.rvals); + &data, m_ptr_qry.rvals, null_terminated); } /* Return true if memory model ORD is constant in the context of STMT and @@ -3230,8 +3241,8 @@ pass_waccess::check_builtin (gcall *stmt) tree a1 = call_arg (stmt, 0); tree a2 = call_arg (stmt, 1); tree len = call_arg (stmt, 2); - check_read_access (stmt, a1, len, 0); - check_read_access (stmt, a2, len, 0); + check_read_access (stmt, a1, len, 0, false); + check_read_access (stmt, a2, len, 0, false); return true; } @@ -3250,7 +3261,7 @@ pass_waccess::check_builtin (gcall *stmt) { tree src = call_arg (stmt, 0); tree len = call_arg (stmt, 2); - check_read_access (stmt, src, len, 0); + check_read_access (stmt, src, len, 0, false); return true; } @@ -3546,7 +3557,7 @@ pass_waccess::maybe_check_access_sizes (rdwr_map *rwm, tree fndecl, tree fntype, if (mode == access_deferred) mode = TYPE_READONLY (argtype) ? access_read_only : access_read_write; check_access (stmt, access_size, /*maxread=*/ NULL_TREE, srcsize, - dstsize, mode, &data, m_ptr_qry.rvals); + dstsize, mode, &data, m_ptr_qry.rvals, false); if (warning_suppressed_p (stmt, OPT_Wstringop_overflow_)) opt_warned = OPT_Wstringop_overflow_; diff --git a/gcc/testsuite/gcc.dg/Wstringop-overread.c b/gcc/testsuite/gcc.dg/Wstringop-overread.c index 7db74029819..709e7fff63e 100644 --- a/gcc/testsuite/gcc.dg/Wstringop-overread.c +++ b/gcc/testsuite/gcc.dg/Wstringop-overread.c @@ -313,7 +313,7 @@ void test_strnlen_array (int i, int i0, unsigned n) T (strnlen (a1, 0)); T (strnlen (a1, 1)); - T (strnlen (a1, 2)); // { dg-warning "'strnlen' specified bound 2 exceeds source size 1" "pr87492" { xfail *-*-* } } + T (strnlen (a1, 2)); T (strnlen (a1, n)); T (strnlen (a1 + 1, 0)); @@ -323,16 +323,16 @@ void test_strnlen_array (int i, int i0, unsigned n) T (strnlen (a1 + 1, n)); T (strnlen (a1 + i, 0)); T (strnlen (a1 + i, 1)); - T (strnlen (a1 + i, 2)); // { dg-warning "'strnlen' specified bound 2 exceeds source size 1" } + T (strnlen (a1 + i, 2)); T (strnlen (a1 + i, n)); T (strnlen (a1 + i + 1, 0)); T (strnlen (a1 + i + 1, 1)); - T (strnlen (a1 + i + 1, 2)); // { dg-warning "'strnlen' specified bound 2 exceeds source size 1" } + T (strnlen (a1 + i + 1, 2)); T (strnlen (a1 + i + 1, n)); T (strnlen (a1 + i0, 0)); T (strnlen (a1 + i0, 1)); - T (strnlen (a1 + i0, 2)); // { dg-warning "'strnlen' specified bound 2 exceeds source size 1" } + T (strnlen (a1 + i0, 2)); T (strnlen (a1 + i0, n)); T (strnlen (a1 + i0 + 1, 0)); T (strnlen (a1 + i0 + 1, 1)); // { dg-warning "'strnlen' specified bound 1 exceeds source size 0" } @@ -344,7 +344,7 @@ void test_strnlen_array (int i, int i0, unsigned n) T (strnlen (a2, n)); T (strnlen (a2 + 1, 0)); T (strnlen (a2 + 1, 1)); - T (strnlen (a2 + 1, 2)); // { dg-warning "'strnlen' specified bound 2 exceeds source size 1" "pr87492" } + T (strnlen (a2 + 1, 2)); T (strnlen (a2 + 1, n)); T (strnlen (a2 + 2, 0)); T (strnlen (a2 + 2, 1)); // { dg-warning "'strnlen' specified bound 1 exceeds source size 0" } @@ -360,12 +360,12 @@ void test_strnlen_array (int i, int i0, unsigned n) T (strnlen (a2 + i0, 0)); T (strnlen (a2 + i0, 1)); T (strnlen (a2 + i0, 2)); - T (strnlen (a2 + i0, 3)); // { dg-warning "'strnlen' specified bound 3 exceeds source size 2" } + T (strnlen (a2 + i0, 3)); T (strnlen (a2 + i0, n)); T (strnlen (a2 + i0 + 1, 0)); T (strnlen (a2 + i0 + 1, 1)); - T (strnlen (a2 + i0 + 1, 2)); // { dg-warning "'strnlen' specified bound 2 exceeds source size 1" } + T (strnlen (a2 + i0 + 1, 2)); T (strnlen (a2 + i0 + 1, n)); T (strnlen (a2 + i0 + 2, 0)); @@ -509,7 +509,7 @@ void test_strndup_array (int i, int i0, unsigned n) T (strndup (a1, 0)); T (strndup (a1, 1)); - T (strndup (a1, 2)); // { dg-warning "'strndup' specified bound 2 exceeds source size 1" } + T (strndup (a1, 2)); T (strndup (a1, n)); T (strndup (a1 + 1, 0)); T (strndup (a1 + 1, 1)); // { dg-warning "'strndup' specified bound 1 exceeds source size 0" } @@ -518,11 +518,11 @@ void test_strndup_array (int i, int i0, unsigned n) T (strndup (a1 + 1, n)); T (strndup (a1 + i, 0)); T (strndup (a1 + i, 1)); - T (strndup (a1 + i, 2)); // { dg-warning "'strndup' specified bound 2 exceeds source size 1" } + T (strndup (a1 + i, 2)); T (strndup (a1 + i, n)); T (strndup (a1 + i + 1, 0)); T (strndup (a1 + i + 1, 1)); - T (strndup (a1 + i + 1, 2)); // { dg-warning "'strndup' specified bound 2 exceeds source size 1" } + T (strndup (a1 + i + 1, 2)); T (strndup (a1 + i + 1, n)); T (strndup (a1 + i0, 0)); @@ -538,7 +538,7 @@ void test_strndup_array (int i, int i0, unsigned n) T (strndup (a2, n)); T (strndup (a2 + 1, 0)); T (strndup (a2 + 1, 1)); - T (strndup (a2 + 1, 2)); // { dg-warning "'strndup' specified bound 2 exceeds source size 1" } + T (strndup (a2 + 1, 2)); T (strndup (a2 + 1, n)); T (strndup (a2 + 2, 0)); T (strndup (a2 + 2, 1)); // { dg-warning "'strndup' specified bound 1 exceeds source size 0" } @@ -554,12 +554,12 @@ void test_strndup_array (int i, int i0, unsigned n) T (strndup (a2 + i0, 0)); T (strndup (a2 + i0, 1)); T (strndup (a2 + i0, 2)); - T (strndup (a2 + i0, 3)); // { dg-warning "'strndup' specified bound 3 exceeds source size 2" } + T (strndup (a2 + i0, 3)); T (strndup (a2 + i0, n)); T (strndup (a2 + i0 + 1, 0)); T (strndup (a2 + i0 + 1, 1)); - T (strndup (a2 + i0 + 1, 2)); // { dg-warning "'strndup' specified bound 2 exceeds source size 1" } + T (strndup (a2 + i0 + 1, 2)); T (strndup (a2 + i0 + 1, n)); T (strndup (a2 + i0 + 2, 0)); diff --git a/gcc/testsuite/gcc.dg/attr-nonstring-4.c b/gcc/testsuite/gcc.dg/attr-nonstring-4.c index 6f03a562026..0ce062e513b 100644 --- a/gcc/testsuite/gcc.dg/attr-nonstring-4.c +++ b/gcc/testsuite/gcc.dg/attr-nonstring-4.c @@ -53,7 +53,7 @@ void strnlen_range (void) T (STR, /* [] */, n); T (STR, /* [] */, n + 1); /* { dg-warning "specified bound \\\[\[0-9\]+, \[0-9\]+] exceeds maximum object size \[0-9\]+" } */ - T (STR, 1, n); /* { dg-warning "specified bound \\\[\[0-9\]+, \[0-9\]+] exceeds source size 1" } */ + T (STR, 1, n); T (STR, 2, n + 1); /* { dg-warning "specified bound \\\[\[0-9\]+, \[0-9\]+] exceeds maximum object size \[0-9\]+" } */ T (NS, /* [] */, n); diff --git a/gcc/testsuite/gcc.dg/pr78902.c b/gcc/testsuite/gcc.dg/pr78902.c index a9a617cde23..51b42548071 100644 --- a/gcc/testsuite/gcc.dg/pr78902.c +++ b/gcc/testsuite/gcc.dg/pr78902.c @@ -12,5 +12,4 @@ void foo(void) __builtin_aligned_alloc (10, 16); /* { dg-warning "ignoring return value of '__builtin_aligned_alloc' declared with attribute 'warn_unused_result'" } */ __builtin_strdup ("pes"); /* { dg-warning "ignoring return value of '__builtin_strdup' declared with attribute 'warn_unused_result'" } */ __builtin_strndup ("pes", 10); /* { dg-warning "ignoring return value of '__builtin_strndup' declared with attribute 'warn_unused_result'" } */ - /* { dg-warning "\\\[-Wstringop-overread" "strndup excessive bound" { target *-*-* } .-1 } */ } diff --git a/gcc/testsuite/gcc.dg/warn-strnlen-no-nul.c b/gcc/testsuite/gcc.dg/warn-strnlen-no-nul.c index 70f6a432b97..b9ee69c0a2a 100644 --- a/gcc/testsuite/gcc.dg/warn-strnlen-no-nul.c +++ b/gcc/testsuite/gcc.dg/warn-strnlen-no-nul.c @@ -147,11 +147,11 @@ T (v0 ? b[3] : "", bsz); the strnlen calls are safe because the reads are bounded by the length of the constant arguments. Most of the calls are not diagnosed anymore as a result of the fix for PR 103215. */ -T (v0 ? "" : b[0], bsz + 1); /* { dg-warning "bound 6 exceeds source size 5" } */ +T (v0 ? "" : b[0], bsz + 1); T (v0 ? "" : b[1], bsz + 1); T (v0 ? "" : b[2], bsz + 1); T (v0 ? "" : b[3], bsz + 1); -T (v0 ? b[0] : "", bsz + 1); /* { dg-warning "bound 6 exceeds source size 5" } */ +T (v0 ? b[0] : "", bsz + 1); T (v0 ? b[1] : "", bsz + 1); T (v0 ? b[2] : "", bsz + 1); T (v0 ? b[3] : "", bsz + 1); @@ -218,10 +218,10 @@ T (&s.a[i1] + v0, asz); T (s.a, asz + 1); T (&s.a[0], asz + 1); T (&s.a[0] + 1, asz + 1); -T (&s.a[0] + v0, asz + 1); /* { dg-warning "specified bound 6 exceeds source size 5 " } */ +T (&s.a[0] + v0, asz + 1); T (&s.a[1], asz + 1); T (&s.a[1] + 1, asz + 1); -T (&s.a[1] + v0, asz + 1); /* { dg-bogus "specified bound 6 exceeds source size 5" "pr95794" { xfail *-*-* } } */ +T (&s.a[1] + v0, asz + 1); T (&s.a[i0], asz + 1); T (&s.a[i0] + i1, asz + 1); @@ -272,10 +272,10 @@ const struct B ba[] = { T (ba[0].a[0].a, asz + 1); T (&ba[0].a[0].a[0], asz + 1); T (&ba[0].a[0].a[0] + 1, asz + 1); -T (&ba[0].a[0].a[0] + v0, asz + 1); /* { dg-bogus "specified bound 6 exceeds source size 5" pr95794" { xfail *-*-* } } */ +T (&ba[0].a[0].a[0] + v0, asz + 1); T (&ba[0].a[0].a[1], asz + 1); T (&ba[0].a[0].a[1] + 1, asz + 1); -T (&ba[0].a[0].a[1] + v0, asz + 1); /* { dg-bogus "specified bound 6 exceeds source size 5" pr95794" { xfail *-*-* } } */ +T (&ba[0].a[0].a[1] + v0, asz + 1); T (ba[0].a[0].b, bsz); T (&ba[0].a[0].b[0], bsz); @@ -308,10 +308,10 @@ T (&ba[0].a[1].a[1] + v0, asz + 1); /* { dg-warning "unterminated" } */ T (ba[0].a[1].b, bsz + 1); T (&ba[0].a[1].b[0], bsz + 1); T (&ba[0].a[1].b[0] + 1, bsz + 1); -T (&ba[0].a[1].b[0] + v0, bsz + 1); /* { dg-bogus "specified bound 6 exceeds source size 5" pr95794" { xfail *-*-* } } */ +T (&ba[0].a[1].b[0] + v0, bsz + 1); T (&ba[0].a[1].b[1], bsz + 1); T (&ba[0].a[1].b[1] + 1, bsz + 1); -T (&ba[0].a[1].b[1] + v0, bsz + 1); /* { dg-bogus "specified bound 6 exceeds source size 5" pr95794" { xfail *-*-* } } */ +T (&ba[0].a[1].b[1] + v0, bsz + 1); T (ba[1].a[0].a, asz); T (&ba[1].a[0].a[0], asz);