[Bug fortran/71961] [7 Regression] 178.galgel in SPEC CPU 2000 is miscompiled

2016-08-07 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71961

--- Comment #18 from Thomas Koenig  ---
Author: tkoenig
Date: Sun Aug  7 15:25:56 2016
New Revision: 239221

URL: https://gcc.gnu.org/viewcvs?rev=239221=gcc=rev
Log:
2016-08-07  Thomas Koenig  

PR fortran/71961
* gfortran.dg/pr70040.f90:  New testcase.


Added:
trunk/gcc/testsuite/gfortran.dg/pr70040.f90
Modified:
trunk/gcc/testsuite/ChangeLog

[Bug fortran/71961] [7 Regression] 178.galgel in SPEC CPU 2000 is miscompiled

2016-08-07 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71961

Thomas Koenig  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #17 from Thomas Koenig  ---
Test case committed, closing.

[Bug fortran/71961] [7 Regression] 178.galgel in SPEC CPU 2000 is miscompiled

2016-08-07 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71961

--- Comment #16 from Thomas Koenig  ---
Author: tkoenig
Date: Sun Aug  7 13:24:32 2016
New Revision: 239220

URL: https://gcc.gnu.org/viewcvs?rev=239220=gcc=rev
Log:
2016-08-07  Thomas Koenig  

PR fortran/71961
* gfortran.dg/matmul_10.f90:  New testcase.


Added:
trunk/gcc/testsuite/gfortran.dg/matmul_10.f90
Modified:
trunk/gcc/testsuite/ChangeLog

[Bug fortran/71961] [7 Regression] 178.galgel in SPEC CPU 2000 is miscompiled

2016-07-28 Thread renlin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71961

--- Comment #15 from Renlin Li  ---
The change r238497 has been reverted as r238815.

I confirmed that, after the revert, the 178.gagel mis-compare
is fixed in aarch64-linux environment.

PR 71902 is reopend as well.

[Bug fortran/71961] [7 Regression] 178.galgel in SPEC CPU 2000 is miscompiled

2016-07-28 Thread renlin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71961

--- Comment #14 from Renlin Li  ---
Author: renlin
Date: Thu Jul 28 11:21:53 2016
New Revision: 238815

URL: https://gcc.gnu.org/viewcvs?rev=238815=gcc=rev
Log:
[PATCH] Revert Revert r238497 because of PR 71961.

This patch reverts the change for PR 71902 since it causes 178.gagel
miscompile in spec2000 as reported in PR 71961 which was observed in
x86_64, aarch64, powerpc64.

gcc/fortran/ChangeLog:

2016-07-28  Renlin Li  

Revert
2016-07-19  Thomas Koenig  

PR fortran/71902
* dependency.c (gfc_check_dependency): Use dep_ref.  Handle case
if identical is true and two array element references differ.
(gfc_dep_resovler):  Move most of the code to dep_ref.
(dep_ref):  New function.
* frontend-passes.c (realloc_string_callback):  Name temporary
variable "realloc_string".

gcc/testsuite/ChangeLog:

2016-07-28  Renlin Li  

Revert
2016-07-19  Thomas Koenig  

PR fortran/71902
* gfortran.dg/dependency_47.f90:  New test.


Removed:
trunk/gcc/testsuite/gfortran.dg/dependency_47.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/dependency.c
trunk/gcc/fortran/frontend-passes.c
trunk/gcc/testsuite/ChangeLog

[Bug fortran/71961] [7 Regression] 178.galgel in SPEC CPU 2000 is miscompiled

2016-07-27 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71961

Thomas Koenig  changed:

   What|Removed |Added

 Status|WAITING |NEW

--- Comment #13 from Thomas Koenig  ---
This looks OK.

A revert is pre-approved (if that is even needed), so
whowever can do so at the moment, feel free. Just make
sure to repoen PR 71902.


[Bug fortran/71961] [7 Regression] 178.galgel in SPEC CPU 2000 is miscompiled

2016-07-27 Thread pthaugen at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71961

Pat Haugen  changed:

   What|Removed |Added

   Last reconfirmed||2016-07-21 0:00

--- Comment #12 from Pat Haugen  ---
Just for completeness sake, this is what I whittled bifg21.f90 down to. r238496
produces a warning, r238497 does not. I'll also note 178.galgel also failed at
-O0, on powerpc64 at least.


  Subroutine BifG21 (G21, W11, W20, V, U, NS)

Real*8, Dimension(1000,1000) ::  HtTim
Integer  N, K
Real*8, Allocatable, Dimension(:) :: POP2

   Np = Max0(N,K)
   Allocate( POP2(Np) )

   POP2(1:N) = MATMUL( HtTim(1:K,1:K), POP2(1:K) )

   Deallocate( POP2 )
   Return
  End


> gfortran -S -m64 junk.f90 -Warray-temporaries
junk.f90:10:23:

POP2(1:N) = MATMUL( HtTim(1:K,1:K), POP2(1:K) )
   1
Warning: Creating array temporary at (1) [-Warray-temporaries]

[Bug fortran/71961] [7 Regression] 178.galgel in SPEC CPU 2000 is miscompiled

2016-07-27 Thread Joost.VandeVondele at mat dot ethz.ch
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71961

--- Comment #11 from Joost VandeVondele  
---
This even gives wrong results at -O0 ... 

> cat test.f90 
INTEGER, DIMENSION(:,:), POINTER :: a
INTEGER, DIMENSION(:,:), ALLOCATABLE :: b
ALLOCATE(a(4,4),b(4,2))
a=1 ; b=2
a(:,1:2)=MATMUL(a(:,1:4),b(:,:))
write(6,*) a
IF (ANY(a.NE.RESHAPE((/8,8,8,8,8,8,8,8,1,1,1,1,1,1,1,1/),(/4,4/ &
CALL ABORT
END

gives correct results with gcc 5.3

[Bug fortran/71961] [7 Regression] 178.galgel in SPEC CPU 2000 is miscompiled

2016-07-27 Thread Joost.VandeVondele at mat dot ethz.ch
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71961

--- Comment #10 from Joost VandeVondele  
---
(In reply to Thomas Koenig from comment #9)
> With a test case, it would be OK with me if somebody reverted the
> patch. I can then rework it to take care of that particular bug.

A revert would be good I think.. this is a small testcase showing the wrong
results and the missing warning. I suspect it could be matmul specific.

> cat test.f90 
REAL, DIMENSION(:,:), POINTER :: a
REAL, DIMENSION(:,:), ALLOCATABLE :: b
ALLOCATE(a(4,4),b(4,2))
CALL RANDOM_NUMBER(a)
CALL RANDOM_NUMBER(b)
a(1:4,1:2)=MATMUL(a(1:4,1:4),b(1:4,1:2))
WRITE(6,*) a(1,1)
END

> gfortran -O0 -Warray-temporaries test.f90 ; ./a.out
test.f90:6:11:

 a(1:4,1:2)=MATMUL(a(1:4,1:4),b(1:4,1:2))
   1
Warning: Creating array temporary at (1) [-Warray-temporaries]
  0.770401359

> gfortran -O1 -Warray-temporaries test.f90 ; ./a.out
  0.515214324

[Bug fortran/71961] [7 Regression] 178.galgel in SPEC CPU 2000 is miscompiled

2016-07-27 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71961

--- Comment #9 from Thomas Koenig  ---
(In reply to James Greenhalgh from comment #7)

> Reducing it would probably prove hard as the bug is a miscompile and
> therefore only shows at runtime in a >30 second test. H.J. has narrowed the
> miscompilation down to one file, would it be helpful for you if I generated
> some diffs of when the dumps first change, and the generated assembly for
> x86_64?

Use -Warray-temporaries, using a compiler with and one without the patch.
The compiler with the patch should be missing a warning about creating
an array temporary.

Create a minimum test case containing just the offending line, plus
any declarations that are needed to make it valid.

Check if the two compilers still exhibit the difference with
-Warray-temporaries. Voila, minimum test case!

BTW, I will only have time to work on this in around two weeks.

With a test case, it would be OK with me if somebody reverted the
patch. I can then rework it to take care of that particular bug.

[Bug fortran/71961] [7 Regression] 178.galgel in SPEC CPU 2000 is miscompiled

2016-07-27 Thread Joost.VandeVondele at mat dot ethz.ch
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71961

Joost VandeVondele  changed:

   What|Removed |Added

 CC||Joost.VandeVondele at mat dot 
ethz
   ||.ch

--- Comment #8 from Joost VandeVondele  
---
also miscompiles CP2K, but haven't been able to narrow it down.

[Bug fortran/71961] [7 Regression] 178.galgel in SPEC CPU 2000 is miscompiled

2016-07-27 Thread jgreenhalgh at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71961

James Greenhalgh  changed:

   What|Removed |Added

 CC||jgreenhalgh at gcc dot gnu.org

--- Comment #7 from James Greenhalgh  ---
(In reply to Thomas Koenig from comment #6)
> Is anybody working on reducing this?
> 
> AFAIK, none of the gfortran developers has access to SPEC.

Reducing it would probably prove hard as the bug is a miscompile and therefore
only shows at runtime in a >30 second test. H.J. has narrowed the
miscompilation down to one file, would it be helpful for you if I generated
some diffs of when the dumps first change, and the generated assembly for
x86_64?

[Bug fortran/71961] [7 Regression] 178.galgel in SPEC CPU 2000 is miscompiled

2016-07-26 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71961

Thomas Koenig  changed:

   What|Removed |Added

   Last reconfirmed|2016-07-21 00:00:00 |

--- Comment #6 from Thomas Koenig  ---
Is anybody working on reducing this?

AFAIK, none of the gfortran developers has access to SPEC.

[Bug fortran/71961] [7 Regression] 178.galgel in SPEC CPU 2000 is miscompiled

2016-07-25 Thread pthaugen at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71961

Pat Haugen  changed:

   What|Removed |Added

 CC||pthaugen at gcc dot gnu.org,
   ||seurer at gcc dot gnu.org

--- Comment #5 from Pat Haugen  ---
Also occurring on powerpc64.

[Bug fortran/71961] [7 Regression] 178.galgel in SPEC CPU 2000 is miscompiled

2016-07-23 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71961

--- Comment #4 from Thomas Koenig  ---
If there is a bug, it is likely an array dependence that
is mishandled.

[Bug fortran/71961] [7 Regression] 178.galgel in SPEC CPU 2000 is miscompiled

2016-07-22 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71961

--- Comment #3 from H.J. Lu  ---
bifg21.f90 is miscompiled.

[Bug fortran/71961] [7 Regression] 178.galgel in SPEC CPU 2000 is miscompiled

2016-07-22 Thread renlin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71961

Renlin Li  changed:

   What|Removed |Added

 CC||renlin at gcc dot gnu.org

--- Comment #2 from Renlin Li  ---
The miscompare of 178.galgel is observed in aarch64-linux as well.

[Bug fortran/71961] [7 Regression] 178.galgel in SPEC CPU 2000 is miscompiled

2016-07-22 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71961

Richard Biener  changed:

   What|Removed |Added

   Keywords||wrong-code
   Target Milestone|--- |7.0

[Bug fortran/71961] [7 Regression] 178.galgel in SPEC CPU 2000 is miscompiled

2016-07-21 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71961

Thomas Koenig  changed:

   What|Removed |Added

 Status|UNCONFIRMED |WAITING
   Last reconfirmed||2016-07-21
 Ever confirmed|0   |1

--- Comment #1 from Thomas Koenig  ---
Reduced test case?