public inbox for gcc-regression@sourceware.org
help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Martin Sebor <msebor@gmail.com>,
"sunil.k.pandey" <skpandey@sc.intel.com>
Cc: gcc-patches@gcc.gnu.org, gcc-regression@gcc.gnu.org
Subject: Re: [r12-4725 Regression] FAIL: libgomp.c/doacross-1.c (test for excess errors) on Linux/x86_64
Date: Wed, 27 Oct 2021 15:30:28 +0200 [thread overview]
Message-ID: <20211027133028.GH304296@tucnak> (raw)
In-Reply-To: <20211027052219.DD6AF2864700@gskx-2.sc.intel.com>
On Tue, Oct 26, 2021 at 10:22:19PM -0700, sunil.k.pandey via Gcc-patches wrote:
> FAIL: libgomp.c/doacross-1.c (test for excess errors)
At least this one is a clear false positive.
int a[256];
...
#pragma omp for schedule(static, 1) ordered (1) nowait
for (i = 0; i < 256; i++)
{
#pragma omp atomic write
a[i] = 1;
#pragma omp ordered depend(sink: i - 1)
if (i)
{
#pragma omp atomic read
l = a[i - 1]; // <-------- Here is the false positive warning: '__atomic_load_4' writing 4 bytes into a region of size 0 overflows the destination [-Wstring-overflow=]
// note: at offset [-8589934592, -8] into destination object ‘a’ of size 1024
if (l < 2)
abort ();
}
The loop iterates i from 0 to 255 and the if body is guarded with i != 0,
so __atomic_load_4 (&a[i - 1].
Due to the doacross loop vrp doesn't know that the loop iterates from 0 to
256, because different threads are given just some subset of that interval,
so it is effectively VARYING. Perhaps it derives some quite useless range
from the i - 1 or i + 1 expressions on signed integer, but that doesn't mean
the warnings should assume the value is likely to be out of bounds.
And there is no warning on the a[i] either (which is also in bounds, but
if for the atomic load the warning code thinks i - 1 can be in
[-8589934592, -8] range, why doesn't it think that i can be in
[-8589934588, -4] range?
Jakub
next prev parent reply other threads:[~2021-10-27 13:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-27 5:22 sunil.k.pandey
2021-10-27 13:30 ` Jakub Jelinek [this message]
2021-10-27 15:36 ` Martin Sebor
2021-10-27 15:48 ` Tobias Burnus
2021-10-27 16:06 ` Martin Sebor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211027133028.GH304296@tucnak \
--to=jakub@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=gcc-regression@gcc.gnu.org \
--cc=msebor@gmail.com \
--cc=skpandey@sc.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).