Bug 52893 - [4.7 Regression] Moving functions out of implied DO loops
Summary: [4.7 Regression] Moving functions out of implied DO loops
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.8.0
: P3 normal
Target Milestone: 4.7.1
Assignee: Thomas Koenig
URL:
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2012-04-06 19:19 UTC by Thomas Koenig
Modified: 2012-04-07 20:27 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2012-04-06 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Koenig 2012-04-06 19:19:44 UTC
The following aborts with -ffrontend-optimize:

program test
  integer, parameter :: N = 4
  integer, parameter :: dp=kind(1.d0)
  real(kind=dp), parameter :: pi=4*atan(1._dp)
  real(kind=dp), parameter :: eps = 1.e-14_dp
  real(kind=dp) :: h1(0:N-1), h2(0:N-1)
  integer i

  i = 1
  h1 = [(cos(2*pi*mod(i*k,N)/N),k=0,N/2), &
       & (sin(2*pi*mod(i*k,N)/N),k=1,N/2-1)]
  h2 = (/ 1._dp, 0._dp, -1._dp, 1._dp /)
  if (any(abs(h1 - h2) > eps)) call abort
end program test
Comment 1 Thomas Koenig 2012-04-07 16:38:19 UTC
Author: tkoenig
Date: Sat Apr  7 16:38:11 2012
New Revision: 186213

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=186213
Log:
2012-04-07  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/52893
	* frontend-passes.c:  Keep track of wether we are in an implicit
	DO loop; do not do function elimination if we are.

2012-04-07  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/52893
	* gfortran.dg/function_optimize_11.f90:  New test.


Added:
    trunk/gcc/testsuite/gfortran.dg/function_optimize_11.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/frontend-passes.c
    trunk/gcc/testsuite/ChangeLog
Comment 2 Thomas Koenig 2012-04-07 20:27:10 UTC
Author: tkoenig
Date: Sat Apr  7 20:27:02 2012
New Revision: 186215

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=186215
Log:
2012-04-07  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/52893
	Backport from trunk
	* frontend-passes.c:  Keep track of wether we are in an implicit
	DO loop; do not do function elimination if we are.

2012-04-07  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/52893
	Backport from trunk
	* gfortran.dg/function_optimize_11.f90:  New test.


Added:
    branches/gcc-4_7-branch/gcc/testsuite/gfortran.dg/function_optimize_11.f90
Modified:
    branches/gcc-4_7-branch/gcc/fortran/ChangeLog
    branches/gcc-4_7-branch/gcc/fortran/frontend-passes.c
    branches/gcc-4_7-branch/gcc/testsuite/ChangeLog
Comment 3 Thomas Koenig 2012-04-07 20:27:35 UTC
Fixed, closing.