This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, Fortran, OOP] PR 44962: [OOP] ICE with specification expression SIZE(<CLASS>)
- From: dominiq at lps dot ens dot fr (Dominique Dhumieres)
- To: fortran at gcc dot gnu dot org
- Cc: gcc-patches at gcc dot gnu dot org, burnus at net-b dot de, janus at gcc dot gnu dot org
- Date: Mon, 26 Jul 2010 09:20:11 +0200
- Subject: Re: [Patch, Fortran, OOP] PR 44962: [OOP] ICE with specification expression SIZE(<CLASS>)
Janus,
I just noticed that you have changed the test typebound_proc_17.f03
between revisions of your patch:
--- typebound_proc_17_old.f03 2010-07-26 07:45:13.000000000 +0200
+++ /opt/gcc/work/gcc/testsuite/gfortran.dg/typebound_proc_17.f03 2010-07-26 07:15:54.000000000 +0200
@@ -24,14 +24,11 @@ end module array
type :: t2
- real, dimension(irand()+5) :: co2 ! { dg-error "must be constant" }
+ real, dimension(iabs(-3)+2) :: com
end type
-type(t2) :: a
+real, dimension(irand()+2) :: r2 ! { dg-error "must have constant shape" }
-print *, size(a%co2)
-a%co2 = 1.0
-print *, a
end
! { dg-final { cleanup-modules "array" } }
(where I have added the last 4 '-' lines for testing as commented below).
With the latest patch the line
real, dimension(irand()+5) :: co2 ! { dg-error "must be constant" }
in "type :: t2" no longer triggers the error. Is it according the last lines
of f2008 [7.1.11] quoted by Tobias Burnus? If yes, is it normal that
"print *, size(a%co2)" yields 0?
Also when compiled with -std=f2003, both versions give the error:
real, dimension(irand()+*) :: * ! { dg-error "must *" }
1
Error: Specification function 'irand' at (1) must be PURE
Has this constraint been removed in f2008?
Finally, as I said in a previous post, the *rand functions are
g77 extensions and their use should probably discouraged in
post f90 codes. If the issues raised by Tobias appear only
for these functions, is it really necessary to spend too
much time on them?
Cheers,
Dominique