[Bug middle-end/52316] New: Loops not optimized away, though result is not used
burnus at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Feb 20 14:56:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52316
Bug #: 52316
Summary: Loops not optimized away, though result is not used
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: middle-end
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: burnus@gcc.gnu.org
The following program takes 7.5s without optimization and 1.5s with -O1 to
-Ofast. However, for -Ofast, I had expected that the loops are optimized away.
However, that does not seem to happen.
With "ifort -fast", the program takes "0.0s".
Found at
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/5ee459a4ddaeab9e#
program hello
implicit none
real :: x, y, n, i, j, t1, t2
call CPU_TIME(t1)
n = 30000.0
j = 1.0
do while (j < n)
i = 1.0
do while (i < n)
x = sin(45.0) * asin(0.5) * sqrt(5.000000) * atan(2.5555)
i = i + 1.0
end do
j = j + 1
end do
call CPU_TIME(t2)
print *, t2-t1
!call sleep(10)
end program hello
More information about the Gcc-bugs
mailing list