Bug 19760 - wrong results or crash from PURE function
Summary: wrong results or crash from PURE function
Status: RESOLVED DUPLICATE of bug 19766
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: unknown
: P2 critical
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-02-02 15:57 UTC by Vivek Rao
Modified: 2005-07-23 22:49 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vivek Rao 2005-02-02 15:57:13 UTC
program xx
implicit none
real :: x(1)
x = f((/1.0/))
print*,x
! commenting the above 3 lines and uncommenting the next causes a crash
! write (*,*) f((/4.0/))
contains
pure function f(xx) result(xsum)
real, intent(in) :: xx(:)
real             :: xsum(size(xx))
xsum = 1.0
end function f
end program xx

gfortran -o xpure_bug.exe -v --free-form -Wall xpure_bug.f  
Driving: gfortran -o xpure_bug.exe -v -ffree-form -Wall xpure_bug.f -
lgfortranbegin -lgfortran
Using built-in specs.
Configured with: ../gcc/configure --prefix=/mingw --enable-languages=c,f95
Thread model: win32
gcc version 4.0.0 20050120 (experimental)
 c:/programs/gfortran/bin/../libexec/gcc/i686-pc-mingw32/4.0.0/f951.exe 
xpure_bug.f -quiet -dumpbase xpure_bug.f -mtune=pentiumpro -auxbase xpure_bug -
Wall -version -ffree-form -o C:\DOCUME~1\rao\LOCALS~1\Temp/ccaWaaaa.s
GNU F95 version 4.0.0 20050120 (experimental) (i686-pc-mingw32)
	compiled by GNU C version 4.0.0 20050117 (experimental).
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
 as -o C:\DOCUME~1\rao\LOCALS~1\Temp/ccaIbaaa.o C:\DOCUME~1\rao\LOCALS~1
\Temp/ccaWaaaa.s
 ld -Bdynamic -o xpure_bug.exe c:/programs/gfortran/bin/../lib/gcc/i686-pc-
mingw32/4.0.0/../../../crt2.o -Lc:/programs/gfortran/bin/../lib/gcc/i686-pc-
mingw32/4.0.0 -Lc:/programs/gfortran/bin/../lib/gcc -
Lc:/programs/gfortran/bin/../lib/gcc/i686-pc-mingw32/4.0.0/../../.. C:\DOCUME~1
\rao\LOCALS~1\Temp/ccaIbaaa.o -lgfortranbegin -lgfortran -lmingw32 -lgcc -
lmoldname -lmingwex -lmsvcrt -luser32 -lkernel32 -ladvapi32 -lshell32 -
lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt

running xpure_bug.exe
  7.9179282E+33
Comment 1 Andrew Pinski 2005-02-02 19:22:30 UTC

*** This bug has been marked as a duplicate of 19766 ***