This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch, Fortran, 4.5 Regression] PR 39861/39864: Problems with INTRINSIC


Hi all,

here is the (pretty obvious) fix for PR 39861 and 39864. Both have
been caused by r146554, which I committed yesterday to fix PR 39735,
and which included some modifications for intrinsics.

I'm amazed by two things:
1) how indifferent the testsuite reacted to these regressions
2) how fast our users were in finding them

The two-line patch has been regtested on x86_64-unknown-linux-gnu. Ok for trunk?

Thanks for the reports and sorry for the trouble.

Cheers,
Janus



2009-04-23  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/39861
	PR fortran/39864
	* symbol.c (gfc_copy_formal_args_intr): Set attr.flavor and attr.dummy
	for the formal arguments.


2009-04-23  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/39861
	PR fortran/39864
	* gfortran.dg/intrinsic_1.f90: New.
Index: gcc/testsuite/gfortran.dg/intrinsic_1.f90
===================================================================
--- gcc/testsuite/gfortran.dg/intrinsic_1.f90	(Revision 0)
+++ gcc/testsuite/gfortran.dg/intrinsic_1.f90	(Revision 0)
@@ -0,0 +1,28 @@
+! { dg-do compile }
+!
+! PR 39861/39864
+!
+! Test cases provided by Dominique d'Humieres <dominiq@lps.ens.fr>
+! and Michael Richmond <michael.a.richmond@nasa.gov>.
+
+module vector_calculus
+  intrinsic :: dot_product, sqrt
+
+contains
+
+  function len(r)
+    real, dimension(:), intent(in) :: r
+    real :: len
+    len = sqrt(dot_product(r,r))
+  end function len
+
+  FUNCTION next_state()
+    INTRINSIC :: RESHAPE
+    INTEGER, PARAMETER :: trantb(1,1) = RESHAPE((/1,2/), shape=(/1,1/))
+    next_state = trantb(1, 1)
+  END FUNCTION next_state
+
+end module vector_calculus
+
+! { dg-final { cleanup-modules "vector_calculus" } }
+
Index: gcc/fortran/symbol.c
===================================================================
--- gcc/fortran/symbol.c	(Revision 146567)
+++ gcc/fortran/symbol.c	(Arbeitskopie)
@@ -3865,6 +3865,8 @@ gfc_copy_formal_args_intr (gfc_symbol *d
       /* May need to copy more info for the symbol.  */
       formal_arg->sym->ts = curr_arg->ts;
       formal_arg->sym->attr.optional = curr_arg->optional;
+      formal_arg->sym->attr.flavor = FL_VARIABLE;
+      formal_arg->sym->attr.dummy = 1;
 
       /* If this isn't the first arg, set up the next ptr.  For the
         last arg built, the formal_arg->next will never get set to

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]