Bug 19766 - wrong results or crash from PURE function
Summary: wrong results or crash from PURE function
Status: RESOLVED DUPLICATE of bug 22607
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: unknown
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: wrong-code
: 19760 (view as bug list)
Depends on: 19561 19574
Blocks:
  Show dependency treegraph
 
Reported: 2005-02-02 17:10 UTC by Vivek Rao
Modified: 2005-11-10 21:51 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-09-18 05:46:19


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vivek Rao 2005-02-02 17:10:51 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:21:15 UTC
Confirmed but more related to PR 19574 and 19561
Comment 2 Andrew Pinski 2005-02-02 19:22:32 UTC
*** Bug 19760 has been marked as a duplicate of this bug. ***
Comment 3 eedelman 2005-11-10 21:51:33 UTC
This bug and PR 22607, which was fixed recently, appears to be duplicates.

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