------- Comment #15 from dominiq at lps dot ens dot fr 2010-04-30 14:51 -------
> ... without -fwhole-file. But all IPA optimizations rely on that, so it's
> critical that -fwhole-file is enabled.
-fwhole-file works only at the file level, i.e., if proc_ptr_comp_12.f90 is
split as:
[macbook] f90/bug% cat aa.f90
! { dg-do run }
!
! PR 40646: [F03] array-valued procedure pointer components
!
! Original test case by Charlie Sharpsteen <[email protected]>
! Modified by Janus Weil <[email protected]>
module bugTestMod
implicit none
type:: boundTest
procedure(returnMat), pointer, nopass:: test
end type boundTest
contains
function returnMat( a, b ) result( mat )
integer:: a, b
double precision, dimension(a,b):: mat
mat = 1d0
end function returnMat
end module bugTestMod
[macbook] f90/bug% cat bb.f90
program bugTest
use bugTestMod
implicit none
type( boundTest ):: testObj
double precision, dimension(2,2):: testCatch
testObj%test => returnMat
testCatch = testObj%test(2,2)
print *,testCatch
if (sum(testCatch)/=4) call abort()
print *,testObj%test(3,3)
if (sum(testObj%test(3,3))/=9) call abort()
end program bugTest
! { dg-final { cleanup-modules "bugTestMod" } }
one gets
[macbook] f90/bug% gfc -O2 -fipa-pta bb.f90 aa.f90 -fwhole-file -flto
[macbook] f90/bug% a.out
1.0000000000000000 1.0000000000000000 1.0000000000000000
1.0000000000000000
1.0000000000000000 1.0000000000000000 1.0000000000000000
1.0000000000000000 1.0000000000000000 1.0000000000000000
1.0000000000000000 1.0000000000000000 1.0000000000000000
Segmentation fault
--
dominiq at lps dot ens dot fr changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pault at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43879