Patchwork [Fortran,OOP] PR 44962: [OOP] ICE with specification expression SIZE(<CLASS>)

login
register
mail settings
Submitter Dominique Dhumieres
Date July 26, 2010, 7:20 a.m.
Message ID <20100726072011.37BB43BE18@mailhost.lps.ens.fr>
Download mbox | patch
Permalink /patch/59893/
State New
Headers show

Comments

Dominique Dhumieres - July 26, 2010, 7:20 a.m.
Janus,

I just noticed that you have changed the test typebound_proc_17.f03
between revisions of your patch:


(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

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" } }