public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ipa/86389] execute FAILs with -fipa-pta
       [not found] <bug-86389-4@http.gcc.gnu.org/bugzilla/>
@ 2021-08-23 11:21 ` marxin at gcc dot gnu.org
  2021-08-24 13:47 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-08-23 11:21 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86389

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |marxin at gcc dot gnu.org

--- Comment #8 from Martin Liška <marxin at gcc dot gnu.org> ---
Using (C, C++ and Fortran) I see only the following execution failures:

./x86_64-pc-linux-gnu/libstdc++-v3/testsuite/libstdc++.log:FAIL:
25_algorithms/minmax_element/constrained.cc execution test
./x86_64-pc-linux-gnu/libstdc++-v3/testsuite/libstdc++.log:FAIL:
25_algorithms/mismatch/constrained.cc execution test
./gcc/testsuite/gfortran/gfortran.log:FAIL: gfortran.dg/vector_subscript_1.f90 
 -O1  execution test
./gcc/testsuite/gfortran/gfortran.log:FAIL: gfortran.dg/vector_subscript_1.f90 
 -O2  execution test
./gcc/testsuite/gfortran/gfortran.log:FAIL: gfortran.dg/vector_subscript_1.f90 
 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer
-finline-functions  execution test
./gcc/testsuite/gfortran/gfortran.log:FAIL: gfortran.dg/vector_subscript_1.f90 
 -O3 -g  execution test
./gcc/testsuite/gfortran/gfortran.log:FAIL: gfortran.dg/vector_subscript_1.f90 
 -Os  execution test

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

* [Bug ipa/86389] execute FAILs with -fipa-pta
       [not found] <bug-86389-4@http.gcc.gnu.org/bugzilla/>
  2021-08-23 11:21 ` [Bug ipa/86389] execute FAILs with -fipa-pta marxin at gcc dot gnu.org
@ 2021-08-24 13:47 ` rguenth at gcc dot gnu.org
  2021-08-24 14:15 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-08-24 13:47 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86389

--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
The fortran fail can be reduced to the following with -O1 -fipa-pta, not
sure what goes wrong.  It looks like part of the

  a (idx (10:6:-2)) = b (idx (10:6:-2))

stores are wrongly elided.

! PR 19239.  Check for various kinds of vector subscript.  In this test,
! all vector subscripts are indexing single-dimensional arrays.
! { dg-do run }
program main
  implicit none
  integer, parameter :: n = 10
  integer :: i, j, calls
  integer, dimension (n) :: a, b, idx, id

  idx = (/ 3, 1, 5, 2, 4, 10, 8, 7, 6, 9 /)
  id = (/ (i, i = 1, n) /)
  b = (/ (i * 100, i = 1, n) /)

  !------------------------------------------------------------------
  ! Tests for a simple variable subscript
  !------------------------------------------------------------------

  a (idx) = b
  call test (idx, id)

  a = b (idx)
  call test (id, idx)

  a (idx (1:7:3)) = b (idx (10:6:-2))
  call test (idx (1:7:3), idx (10:6:-2))

  a (idx (10:6:-2)) = b (idx (10:6:-2))
  call test (idx (10:6:-2), idx (10:6:-2))

contains
  subroutine test (lhs, rhs)
    integer, dimension (:) :: lhs, rhs
    integer :: i

    if (size (lhs, 1) .ne. size (rhs, 1)) STOP 11
    do i = 1, size (lhs, 1)
      if (a (lhs (i)) .ne. b (rhs (i))) STOP 12
    end do
    a = 0
  end subroutine test
end program main

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

* [Bug ipa/86389] execute FAILs with -fipa-pta
       [not found] <bug-86389-4@http.gcc.gnu.org/bugzilla/>
  2021-08-23 11:21 ` [Bug ipa/86389] execute FAILs with -fipa-pta marxin at gcc dot gnu.org
  2021-08-24 13:47 ` rguenth at gcc dot gnu.org
@ 2021-08-24 14:15 ` rguenth at gcc dot gnu.org
  2021-11-05 17:02 ` marxin at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-08-24 14:15 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86389

--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
-fdisable-tree-dom2 fixes it, DOM2 does

--- a/vector_subscript_1.f90.127t.dom2  2021-08-24 15:41:19.245450872 +0200
+++ b/vector_subscript_1.f90.127t.dom2  2021-08-24 15:41:23.421513299 +0200
@@ -383,11 +383,11 @@
   <bb 9> [local count: 292809384]:
   # S.29_149 = PHI <S.29_112(9), 0(8)>
   _14 = S.29_149 * -2;
-  _110 = MEM <integer(kind=4)D.8[0:]> [(integer(kind=4)D.8[0:] *)&idxD.4029 +
36B][_14];
-  _15 = (integer(kind=8)D.9) _110;
-  _16 = _15 + -1;
-  _17 = FRAME.39D.4164.bD.4167[_16];
-  FRAME.39D.4164.aD.4165[_16] = _17;
+  _110 = _84;
+  _15 = _9;
+  _16 = _10;
+  _17 = FRAME.39D.4164.bD.4167[_10];
+  FRAME.39D.4164.aD.4165[_10] = _17;
   S.29_112 = S.29_149 + 1;
   if (S.29_112 > 2)
     goto <bb 10>; [25.00%]

but that's odd, _84 is defined inside another loop

  <bb 7> [local count: 292809384]:
  # S.24_148 = PHI <S.24_86(7), 0(6)>
  _7 = S.24_148 * 3;
  _83 = MEM <integer(kind=4)D.8[0:]> [(integer(kind=4)D.8[0:]
*)&idxD.4029][_7];
  _8 = S.24_148 * -2;
  _84 = MEM <integer(kind=4)D.8[0:]> [(integer(kind=4)D.8[0:] *)&idxD.4029 +
36B][_8];
  _9 = (integer(kind=8)D.9) _84;
  _10 = _9 + -1;
  _11 = (integer(kind=8)D.9) _83;
  _12 = _11 + -1;
  _13 = FRAME.39D.4164.bD.4167[_10];
  FRAME.39D.4164.aD.4165[_12] = _13;
  S.24_86 = S.24_148 + 1;
  if (S.24_86 > 2)
    goto <bb 8>; [25.00%]
  else
    goto <bb 7>; [75.00%]

there's a call inbetween

  test (&parm.25D.4099, &parm.26D.4105); [static-chain: &FRAME.39D.4164]

and IPA PTA is likely required to disambiguate against that.

The second loop looks like (pre DOM):

  <bb 9> [local count: 292809384]:
  # S.29_149 = PHI <S.29_112(9), 0(8)>
  _14 = S.29_149 * -2;
  _110 = MEM <integer(kind=4)D.8[0:]> [(integer(kind=4)D.8[0:] *)&idxD.4029 +
36B][_14];
  _15 = (integer(kind=8)D.9) _110;
  _16 = _15 + -1;
  _17 = FRAME.39D.4164.bD.4167[_16];
  FRAME.39D.4164.aD.4165[_16] = _17;
  S.29_112 = S.29_149 + 1;
  if (S.29_112 > 2)
    goto <bb 10>; [25.00%]
  else
    goto <bb 9>; [75.00%]

but sth as simple as the following does not reproduce DOMs behavior.

int a[1024], b[1024], idx[1024];
void foo ()
{
  int i = 0;
  do
    {
      int tem = (idx + 2)[-i];
      a[tem] = b[tem];
    }
  while (++i <= 2);
  i = 0;
  do
    {
      int tem = (idx + 2)[-i];
      a[tem] = b[tem];
    }
  while (++i <= 2);
}

So I guess it must be sth to do with

MEM <integer(kind=4)[0:]> [(integer(kind=4)[0:] *)&idx + 36B][_14];

and equal_mem_array_ref_p which uses get_ref_base_and_extent somehow
arrives at the conclusion that the referenced array has a single element
and is not trailing...  indeed we have 'int idx[10];' here but _14
is negative and the domain is [0:..] which means the access is outside
of the domain of the array.  Which means this is likely a frontend issue.

When the frontend lowers idx (10:6:-2) it generates

      parm.22D.4083.dimD.4082[0].lboundD.3942 = 1;
      parm.22D.4083.dimD.4082[0].uboundD.3943 = 3;
      parm.22D.4083.dimD.4082[0].strideD.3941 = -2;
      parm.22D.4083.dataD.4078 = (voidD.27 *) &idxD.4029[9];
...
              D.4091 = (*(integer(kind=4)D.8[0:] *)
parm.22D.4083.dataD.4078)[parm.22D.4083.dimD.4082[0].strideD.3941 *
NON_LVALUE_EXPR <S.24D.4090>];

and that looks clearly wrong to me.

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

* [Bug ipa/86389] execute FAILs with -fipa-pta
       [not found] <bug-86389-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2021-08-24 14:15 ` rguenth at gcc dot gnu.org
@ 2021-11-05 17:02 ` marxin at gcc dot gnu.org
  2021-11-05 17:17 ` hubicka at gcc dot gnu.org
  2021-11-08  8:13 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 6+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-11-05 17:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86389

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hubicka at gcc dot gnu.org

--- Comment #11 from Martin Liška <marxin at gcc dot gnu.org> ---
*** Bug 103101 has been marked as a duplicate of this bug. ***

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

* [Bug ipa/86389] execute FAILs with -fipa-pta
       [not found] <bug-86389-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2021-11-05 17:02 ` marxin at gcc dot gnu.org
@ 2021-11-05 17:17 ` hubicka at gcc dot gnu.org
  2021-11-08  8:13 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 6+ messages in thread
From: hubicka at gcc dot gnu.org @ 2021-11-05 17:17 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86389

--- Comment #12 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
Since the vector_subscript testcase seems indeed to be frontend issue triggered
by -fipa-pta (and soon by modref). I wonder if we should have fortran bug
tracking this or change component here?

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

* [Bug ipa/86389] execute FAILs with -fipa-pta
       [not found] <bug-86389-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2021-11-05 17:17 ` hubicka at gcc dot gnu.org
@ 2021-11-08  8:13 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-11-08  8:13 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86389

--- Comment #13 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Jan Hubicka from comment #12)
> Since the vector_subscript testcase seems indeed to be frontend issue
> triggered by -fipa-pta (and soon by modref). I wonder if we should have
> fortran bug tracking this or change component here?

That's PR102043

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

end of thread, other threads:[~2021-11-08  8:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-86389-4@http.gcc.gnu.org/bugzilla/>
2021-08-23 11:21 ` [Bug ipa/86389] execute FAILs with -fipa-pta marxin at gcc dot gnu.org
2021-08-24 13:47 ` rguenth at gcc dot gnu.org
2021-08-24 14:15 ` rguenth at gcc dot gnu.org
2021-11-05 17:02 ` marxin at gcc dot gnu.org
2021-11-05 17:17 ` hubicka at gcc dot gnu.org
2021-11-08  8:13 ` rguenth at gcc dot gnu.org

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