public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/41213] New: miscompilation at -O2
@ 2009-09-01 12:12 jpr at csc dot fi
2009-09-01 12:15 ` [Bug tree-optimization/41213] " jpr at csc dot fi
0 siblings, 1 reply; 2+ messages in thread
From: jpr at csc dot fi @ 2009-09-01 12:12 UTC (permalink / raw)
To: gcc-bugs
The program below is miscompiled using
gfortran -O2 -o m m.f90; ./m
gives:
y= 0.60653065945526063 2*y= 2.0000000000000000
(the second of the printed numbers should equal twice the first). Using
gfortran -fno-inline -O2 -o m m.f90
works OK.
The compiler is:
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: /home/jerry/gcc/trunk/configure --prefix=/usr/local/gfortran
--enable-languages=c,fortran --disable-libmudflap --enable-libgomp
--disable-shared
Thread model: posix
gcc version 4.5.0 20090831 (experimental) [trunk revision 151238] (GCC)
program m
double precision :: y,z
call b(1.0d0,y,z)
print*,'y= ', y, ' 2*y=', z
contains
subroutine b( x, y, z)
implicit none
double precision :: x,y,z
integer :: i, k
double precision :: h, r
y = 1.0d0
z = 0.0d0
h = 0
DO k = 1,10
h = h + 1.0d0/k
r = 1
DO i = 1,k
r = (x/(2*i) ) * r
END DO
y = y + (-1)**k * r
z = z + (-1)**(k+1) * h * r
IF ( ABS(2*k/x*r) < 1d-6 ) EXIT
END DO
z = 2*y
end subroutine b
end program m
--
Summary: miscompilation at -O2
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jpr at csc dot fi
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41213
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug tree-optimization/41213] miscompilation at -O2
2009-09-01 12:12 [Bug tree-optimization/41213] New: miscompilation at -O2 jpr at csc dot fi
@ 2009-09-01 12:15 ` jpr at csc dot fi
0 siblings, 0 replies; 2+ messages in thread
From: jpr at csc dot fi @ 2009-09-01 12:15 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from jpr at csc dot fi 2009-09-01 12:15 -------
Sorry about the duplicate...
*** This bug has been marked as a duplicate of 41212 ***
--
jpr at csc dot fi changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41213
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-09-01 12:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-01 12:12 [Bug tree-optimization/41213] New: miscompilation at -O2 jpr at csc dot fi
2009-09-01 12:15 ` [Bug tree-optimization/41213] " jpr at csc dot fi
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).