[Bug fortran/15149] New: [gfortran] problem computing Pi
jv244 at cam dot ac dot uk
gcc-bugzilla@gcc.gnu.org
Mon Apr 26 15:05:00 GMT 2004
Trying to verify the claim in
http://gcc.gnu.org/ml/fortran/2004-04/msg00203.html
I keep getting (incorrectly) 0.0 as an approximate value for Pi, whereas
3.14...
is returned using other compilers.
TYPE point_type
SEQUENCE
REAL :: pos(2)
END TYPE
INTEGER, PARAMETER :: N=1000000
TYPE(point_type) :: points(N)
REAL, DIMENSION(2*N) :: scratch
EQUIVALENCE(points,scratch)
CALL RANDOM_NUMBER(scratch)
scratch=2.0*scratch-1.0
count=0
DO i=1,N
IF (SUM(points(i)%pos**2)<1.0) THEN
count=count+1
ENDIF
ENDDO
write(6,*) 4.0*REAL(count)/REAL(N)
END
with the latest version of gfortran, i.e.
gfortran -v mytest.f90
Driving: gfortran -v mytest.f90 -lgfortranbegin -lgfortran -lm -shared-libgcc
Reading specs from /data1/vondele/gcc-g95/bin/../lib/gcc/i686-pc-linux-gnu/3.5-
tree-ssa/specs
Configured with: /data1/vondele/gcc-g95/gcc/configure --
prefix=/data1/vondele/gcc-g95/ --with-gmp-dir=/data1/vondele/gmp-4.1.2/ --
enable-languages=c,f95
Thread model: posix
gcc version 3.5-tree-ssa 20040426 (merged 20040414)
/data1/vondele/gcc-g95/bin/../libexec/gcc/i686-pc-linux-gnu/3.5-tree-ssa/f951
mytest.f90 -quiet -dumpbase mytest.f90 -mtune=pentiumpro -auxbase mytest -
version -o /tmp/ccwcrrYe.s
GNU F95 version 3.5-tree-ssa 20040426 (merged 20040414) (i686-pc-linux-gnu)
compiled by GNU C version 3.5-tree-ssa 20040426 (merged 20040414).
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
as -V -Qy -o /tmp/ccaWH9Uk.o /tmp/ccwcrrYe.s
GNU assembler version 2.12.90.0.1 (i386-linux) using BFD version 2.12.90.0.1
20020307 Debian/GNU Linux
/data1/vondele/gcc-g95/bin/../libexec/gcc/i686-pc-linux-gnu/3.5-tree-
ssa/collect2 --eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-
linux.so.2 /usr/lib/crt1.o /usr/lib/crti.o /data1/vondele/gcc-
g95/bin/../lib/gcc/i686-pc-linux-gnu/3.5-tree-ssa/crtbegin.o -
L/data1/vondele/gcc-g95/bin/../lib/gcc/i686-pc-linux-gnu/3.5-tree-ssa -
L/data1/vondele/gcc-g95/bin/../lib/gcc -L/data1/vondele/gcc-g95//lib/gcc/i686-
pc-linux-gnu/3.5-tree-ssa -L/data1/vondele/gcc-g95/bin/../lib/gcc/i686-pc-
linux-gnu/3.5-tree-ssa/../../.. -L/data1/vondele/gcc-g95//lib/gcc/i686-pc-
linux-gnu/3.5-tree-ssa/../../.. /tmp/ccaWH9Uk.o -lgfortranbegin -lgfortran -
lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /data1/vondele/gcc-g95/bin/../lib/gcc/i686-
pc-linux-gnu/3.5-tree-ssa/crtend.o /usr/lib/crtn.o
--
Summary: [gfortran] problem computing Pi
Product: gcc
Version: tree-ssa
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jv244 at cam dot ac dot uk
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15149
More information about the Gcc-bugs
mailing list