public inbox for gcc-regression@sourceware.org
help / color / mirror / Atom feed
* [r12-4725 Regression] FAIL: libgomp.c/doacross-1.c (test for excess errors) on Linux/x86_64
@ 2021-10-27  5:22 sunil.k.pandey
  2021-10-27 13:30 ` Jakub Jelinek
  0 siblings, 1 reply; 5+ messages in thread
From: sunil.k.pandey @ 2021-10-27  5:22 UTC (permalink / raw)
  To: gcc-patches, gcc-regression, msebor

On Linux/x86_64,

88b504b7a8c5affb0ffa97990d22af2b199e36ed is the first bad commit
commit 88b504b7a8c5affb0ffa97990d22af2b199e36ed
Author: Martin Sebor <msebor@redhat.com>
Date:   Tue Oct 26 14:34:16 2021 -0600

    Detect overflow by atomic functions [PR102453].

caused

FAIL: gcc.dg/Warray-bounds-90.c (test for excess errors)
FAIL: gcc.dg/Warray-bounds-90.c  (test for warnings, line 100)
FAIL: gcc.dg/Warray-bounds-90.c  (test for warnings, line 103)
FAIL: gcc.dg/Warray-bounds-90.c  (test for warnings, line 105)
FAIL: gcc.dg/Warray-bounds-90.c  (test for warnings, line 107)
FAIL: gcc.dg/Warray-bounds-90.c  (test for warnings, line 110)
FAIL: gcc.dg/Warray-bounds-90.c  (test for warnings, line 112)
FAIL: gcc.dg/Warray-bounds-90.c  (test for warnings, line 114)
FAIL: gcc.dg/Warray-bounds-90.c  (test for warnings, line 121)
FAIL: gcc.dg/Warray-bounds-90.c  (test for warnings, line 124)
FAIL: gcc.dg/Warray-bounds-90.c  (test for warnings, line 127)
FAIL: gcc.dg/Warray-bounds-90.c  (test for warnings, line 129)
FAIL: gcc.dg/Warray-bounds-90.c  (test for warnings, line 132)
FAIL: gcc.dg/Warray-bounds-90.c  (test for warnings, line 134)
FAIL: gcc.dg/Warray-bounds-90.c  (test for warnings, line 136)
FAIL: gcc.dg/Warray-bounds-90.c  (test for warnings, line 139)
FAIL: gcc.dg/Warray-bounds-90.c  (test for warnings, line 141)
FAIL: gcc.dg/Warray-bounds-90.c  (test for warnings, line 144)
FAIL: gcc.dg/Warray-bounds-90.c  (test for warnings, line 146)
FAIL: gcc.dg/Warray-bounds-90.c  (test for warnings, line 66)
FAIL: gcc.dg/Warray-bounds-90.c  (test for warnings, line 69)
FAIL: gcc.dg/Warray-bounds-90.c  (test for warnings, line 73)
FAIL: gcc.dg/Warray-bounds-90.c  (test for warnings, line 77)
FAIL: gcc.dg/Warray-bounds-90.c  (test for warnings, line 85)
FAIL: gcc.dg/Warray-bounds-90.c  (test for warnings, line 88)
FAIL: gcc.dg/Warray-bounds-90.c  (test for warnings, line 91)
FAIL: gcc.dg/Warray-bounds-90.c  (test for warnings, line 93)
FAIL: gcc.dg/Warray-bounds-90.c  (test for warnings, line 96)
FAIL: gcc.dg/Warray-bounds-90.c  (test for warnings, line 98)
FAIL: libgomp.c/doacross-1.c (test for excess errors)

with GCC configured with

../../gcc/configure --prefix=/local/skpandey/gccwork/toolwork/gcc-bisect-master/master/r12-4725/usr --enable-clocale=gnu --with-system-zlib --with-demangler-in-ld --with-fpmath=sse --enable-languages=c,c++,fortran --enable-cet --without-isl --enable-libmpx x86_64-linux --disable-bootstrap

To reproduce:

$ cd {build_dir}/gcc && make check RUNTESTFLAGS="dg.exp=gcc.dg/Warray-bounds-90.c --target_board='unix{-m32}'"
$ cd {build_dir}/gcc && make check RUNTESTFLAGS="dg.exp=gcc.dg/Warray-bounds-90.c --target_board='unix{-m32\ -march=cascadelake}'"
$ cd {build_dir}/x86_64-linux/libgomp/testsuite && make check RUNTESTFLAGS="c.exp=libgomp.c/doacross-1.c --target_board='unix{-m64}'"
$ cd {build_dir}/x86_64-linux/libgomp/testsuite && make check RUNTESTFLAGS="c.exp=libgomp.c/doacross-1.c --target_board='unix{-m64\ -march=cascadelake}'"

(Please do not reply to this email, for question about this report, contact me at skpgkp2 at gmail dot com)


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [r12-4725 Regression] FAIL: libgomp.c/doacross-1.c (test for excess errors) on Linux/x86_64
  2021-10-27  5:22 [r12-4725 Regression] FAIL: libgomp.c/doacross-1.c (test for excess errors) on Linux/x86_64 sunil.k.pandey
@ 2021-10-27 13:30 ` Jakub Jelinek
  2021-10-27 15:36   ` Martin Sebor
  0 siblings, 1 reply; 5+ messages in thread
From: Jakub Jelinek @ 2021-10-27 13:30 UTC (permalink / raw)
  To: Martin Sebor, sunil.k.pandey; +Cc: gcc-patches, gcc-regression

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



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [r12-4725 Regression] FAIL: libgomp.c/doacross-1.c (test for excess errors) on Linux/x86_64
  2021-10-27 13:30 ` Jakub Jelinek
@ 2021-10-27 15:36   ` Martin Sebor
  2021-10-27 15:48     ` Tobias Burnus
  0 siblings, 1 reply; 5+ messages in thread
From: Martin Sebor @ 2021-10-27 15:36 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches, gcc-regression

On 10/27/21 7:30 AM, Jakub Jelinek wrote:
> 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)

I don't see this failure in my logs (or the other one) or any
evidence of the libhomp tests having run.  Does the libgomp
test suite need something special to enable?

> 
> 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.

The warning is in the IL below:

   <bb 167> [local count: 30]:
   _865 = ivtmp.273_871 + 4294967294;
   _923 = (int) _865;
   _308 = (sizetype) _923;
   _707 = _308 * 4;
   _924 = &a + _707;
   _926 = __atomic_load_4 (_924, 0);

The code calls range_of_expr (vr, val, stmt) where val is _707
and stmt is the assignment _924 = &a + _707.  The result is
the VR_RANGE [-8589934592, -8].  The code is in get_range() in
tree-ssa-strlen.c of all places.  The warning uses the range
as is, treating it as signed.  The debug_ranger() output for
the block is below.  Am I missing something here?

=========== BB 167 ============
Imports: _926
Exports: _926  l.0_927
          l.0_927 : _926(I)
_243	int VARYING
ivtmp.272_874	unsigned int [2147483648, +INF]
Relational : (_865 != ivtmp.273_871)
     <bb 167> [local count: 30]:
     _865 = ivtmp.273_871 + 4294967294;
     _923 = (int) _865;
     _308 = (sizetype) _923;
     _707 = _308 * 4;
     _924 = &a + _707;
     _926 = __atomic_load_4 (_924, 0);
     l.0_927 = (int) _926;
     if (l.0_927 <= 1)
       goto <bb 13>; [0.00%]
     else
       goto <bb 166>; [100.00%]

_308 : sizetype [18446744071562067968, 18446744073709551614]
_707 : sizetype [18446744065119617024, 18446744073709551608]
_923 : int [-INF, -2]
_924 : int * [1B, +INF]
167->13  (T) _926 : 	unsigned int [0, 1][2147483648, +INF]
167->13  (T) l.0_927 : 	int [-INF, 1]
167->166  (F) _926 : 	unsigned int [2, 2147483647]
167->166  (F) l.0_927 : 	int [2, +INF]

Martin

> 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
> 



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [r12-4725 Regression] FAIL: libgomp.c/doacross-1.c (test for excess errors) on Linux/x86_64
  2021-10-27 15:36   ` Martin Sebor
@ 2021-10-27 15:48     ` Tobias Burnus
  2021-10-27 16:06       ` Martin Sebor
  0 siblings, 1 reply; 5+ messages in thread
From: Tobias Burnus @ 2021-10-27 15:48 UTC (permalink / raw)
  To: Martin Sebor, Jakub Jelinek; +Cc: gcc-regression, gcc-patches

On 27.10.21 17:36, Martin Sebor via Gcc-patches wrote:

> On 10/27/21 7:30 AM, Jakub Jelinek wrote:
>> 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)
>
> I don't see this failure in my logs (or the other one) or any
> evidence of the libhomp tests having run.  Does the libgomp
> test suite need something special to enable?

I don't know whether it can be disabled - but I bet you have build
libgomp. Thus:

Did you run "make check" in the main build directory or in $(BUILD)/gcc?
– only the former runs it.

You can run it directly (from the main $(BUILD) dir) as "make
check-target-libgomp" – or just got to $(BUILD)/*/libgomp/ and run "make
check" there. – In the latter directory, you an also use RUNTESTFLAGS=
to run only a specific test.

(The * above is the target triplet; here, it is x86_64-pc-linux-gnu.)

Besides libgomp, there are some other libraries with testsuites outside
gcc/testsuite, like libstdc++-v3/testsuite or libatomic/testsuite or ...

Tobias
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [r12-4725 Regression] FAIL: libgomp.c/doacross-1.c (test for excess errors) on Linux/x86_64
  2021-10-27 15:48     ` Tobias Burnus
@ 2021-10-27 16:06       ` Martin Sebor
  0 siblings, 0 replies; 5+ messages in thread
From: Martin Sebor @ 2021-10-27 16:06 UTC (permalink / raw)
  To: Tobias Burnus, Jakub Jelinek; +Cc: gcc-regression, gcc-patches

On 10/27/21 9:48 AM, Tobias Burnus wrote:
> On 27.10.21 17:36, Martin Sebor via Gcc-patches wrote:
> 
>> On 10/27/21 7:30 AM, Jakub Jelinek wrote:
>>> 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)
>>
>> I don't see this failure in my logs (or the other one) or any
>> evidence of the libhomp tests having run.  Does the libgomp
>> test suite need something special to enable?
> 
> I don't know whether it can be disabled - but I bet you have build
> libgomp. Thus:
> 
> Did you run "make check" in the main build directory or in $(BUILD)/gcc?
> – only the former runs it.

Thanks.  I figured out why I didn't see it.  I was looking at
the wrong log file, one from testing just the one patch for
the atomic built-ins, rather than the one for all three that
I pushed yesterday (including the one to make a greater use
of the ranger).  The warning only shows with all of them
applied.

Martin

> 
> You can run it directly (from the main $(BUILD) dir) as "make
> check-target-libgomp" – or just got to $(BUILD)/*/libgomp/ and run "make
> check" there. – In the latter directory, you an also use RUNTESTFLAGS=
> to run only a specific test.
> 
> (The * above is the target triplet; here, it is x86_64-pc-linux-gnu.)
> 
> Besides libgomp, there are some other libraries with testsuites outside
> gcc/testsuite, like libstdc++-v3/testsuite or libatomic/testsuite or ...
> 
> Tobias
> -----------------
> Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 
> 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: 
> Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; 
> Registergericht München, HRB 106955



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-10-27 16:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-27  5:22 [r12-4725 Regression] FAIL: libgomp.c/doacross-1.c (test for excess errors) on Linux/x86_64 sunil.k.pandey
2021-10-27 13:30 ` Jakub Jelinek
2021-10-27 15:36   ` Martin Sebor
2021-10-27 15:48     ` Tobias Burnus
2021-10-27 16:06       ` Martin Sebor

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).