[Bug fortran/82567] New: [6/7/8] gfortran takes a long time to compile a simple implied-do with -Optimization.
chinoune.mehdi at hotmail dot com
gcc-bugzilla@gcc.gnu.org
Mon Oct 16 16:38:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82567
Bug ID: 82567
Summary: [6/7/8] gfortran takes a long time to compile a simple
implied-do with -Optimization.
Product: gcc
Version: 6.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: chinoune.mehdi at hotmail dot com
Target Milestone: ---
gfortran takes about 11s to compile this simple subroutine with -O1 :
SUBROUTINE sub()
IMPLICIT NONE
INTEGER, PARAMETER :: n = 10000
REAL, ALLOCATABLE :: x(:)
REAL :: xc, h
INTEGER :: i
ALLOCATE( x(n) )
xc = 100.
h = xc/n
x = h*[(i,i=1,n)]
! Replacing the previous line with one of these lines gives faster
compilation
! x = [(i*h,i=1,n)]
! x = (100./n) *[(i,i=1,n)]
END SUBROUTINE sub
time gfortran -O1 -c test.f90:
real 0m11.167s
the time increases with n (-O1) :
n | 10000 | 20000 | 30000 | 40000
-------------------------------------
time | 11s | 25s | 43s | 1m7s
and decrease with the level of optimization (n=20000) :
-Ox | -O1 | -O2 | -O3 | -Ofast
-------------------------------
time | 20s | 15s | 15s | 8s
tested with gfortran 6/7/8 Linux-64 and gfortran-7 MinGW-64
More information about the Gcc-bugs
mailing list