[Patch, Fortran] PR fortran/35837: Fix type-resolving and gfc_current_ns

Dominique Dhumieres dominiq@lps.ens.fr
Sat Sep 6 15:55:00 GMT 2008


Daniel, Tobias,

Thanks for the answers.  I got confused by the different comments and thought
that the rhs of statement functions had to use pure functions.  Following your
answers and since the restriction did not make sense for me, I went back to the
standard. After the usual knots to my neurones, I ended with the following
assertion:

the rhs of statement functions does not have to use pure functions *unless*
the statement function is within a pure procedure.

If you agree with this assertion, the test I gave is valid and is wrongly rejected
by the gfortran version prior the pr35837 patch. Now, in the test there is a comented
FORALL statement, so I removed the comment expecting the FORALL to be rejected.
Unfortunately, it is not!-(unless there is a pr already open for this case, I'll
fill a new pr for that).

Concerning a new test case, why not doing the following changes?

[ibook-dhum] f90/bug% diff -u /opt/gcc/_gcc_clean/gcc/testsuite/gfortran.dg/stfunc_6.f90 stfunc_6_db.f90
--- /opt/gcc/_gcc_clean/gcc/testsuite/gfortran.dg/stfunc_6.f90	2007-12-10 17:17:22.000000000 +0100
+++ stfunc_6_db.f90	2008-09-06 17:41:37.000000000 +0200
@@ -10,10 +10,13 @@
 
   INTEGER :: st1, i = 99, a(4), q = 6
   st1 (i) = i * i * i 
+  st3 (i) = i * v(i)  ! This Ok
   FORALL(i=1:4) a(i) = st1 (i) 
   FORALL(i=1:4) a(i) = u (a(i)) - a(i)** 2 
   if (any (a .ne. 0)) call abort ()
   if (i .ne. 99) call abort ()
+  FORALL(i=1:4) a(i) = st3 (i) ! This should give "Error: reference to non-PURE 'v' at (1) is inside a FORALL block"
+  FORALL(i=1:4) a(i) = v (i) ! This gives "Error: reference  to non-PURE 'v' at (1) is inside a FORALL block"
 contains
   pure integer function u (x)
     integer,intent(in) :: x

It is also my understanding that the fix will be backported to 4.3. If yes, it may be not
necessary to open a reject-valid pr against 4.3(?).

cheers

Dominique



More information about the Fortran mailing list