re PR fortran/55199 ([OOP] Equivalenced variable has wrong type when used with generi...
authorJanus Weil <janus@gcc.gnu.org>
Sun, 4 Nov 2012 17:13:16 +0000 (18:13 +0100)
committerJanus Weil <janus@gcc.gnu.org>
Sun, 4 Nov 2012 17:13:16 +0000 (18:13 +0100)
2012-11-04  Janus Weil  <janus@gcc.gnu.org>

PR fortran/55199
* primary.c (gfc_match_varspec): Clear typespec if it cannot be
determined at this point.

2012-11-04  Janus Weil  <janus@gcc.gnu.org>

PR fortran/55199
* gfortran.dg/associate_12.f90: New.

From-SVN: r193136

gcc/fortran/ChangeLog
gcc/fortran/primary.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/associate_12.f90 [new file with mode: 0644]

index 8e3e728610cc982b09947f025e8e1f86a2172d1e..084f1f8c53bc2c390ba20524ff85cfceb03677d5 100644 (file)
@@ -1,3 +1,9 @@
+2012-11-04  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/55199
+       * primary.c (gfc_match_varspec): Clear typespec if it cannot be
+       determined at this point.
+
 2012-10-31  Janus Weil  <janus@gcc.gnu.org>
 
        PR fortran/53718
index 7b64a3c6854e240cac78a90ce02234c00c753c1f..6be55b0ef2c49b304d8dd913b6a6fc17b3c9e0ad 100644 (file)
@@ -1975,6 +1975,8 @@ gfc_match_varspec (gfc_expr *primary, int equiv_flag, bool sub_flag,
          gcc_assert (primary->symtree->n.sym->attr.referenced);
          if (tbp_sym)
            primary->ts = tbp_sym->ts;
+         else
+           gfc_clear_ts (&primary->ts);
 
          m = gfc_match_actual_arglist (tbp->n.tb->subroutine,
                                        &primary->value.compcall.actual);
index 0473976ccffdfd1668018d4cb42a070d870541a8..4aced9cadb269b3b2b338f9074ac74dfc53e02e6 100644 (file)
@@ -1,3 +1,8 @@
+2012-11-04  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/55199
+       * gfortran.dg/associate_12.f90: New.
+
 2012-11-03  Jack Howarth  <howarth@bromo.med.uc.edu>
 
        PR target/54255
diff --git a/gcc/testsuite/gfortran.dg/associate_12.f90 b/gcc/testsuite/gfortran.dg/associate_12.f90
new file mode 100644 (file)
index 0000000..1ead1e7
--- /dev/null
@@ -0,0 +1,29 @@
+! { dg-do compile }
+!
+! PR 55199: [OOP] Equivalenced variable has wrong type when used with generic member function
+!
+! Contributed by Rich Townsend <townsend@astro.wisc.edu>
+
+module assoc_err_m
+  implicit none
+  type :: foo_t
+   contains
+     procedure :: func_1
+     generic   :: func => func_1
+  end type
+contains
+  real function func_1 (this)
+    class(foo_t), intent(in) :: this
+  end function
+end module
+
+program assoc_err
+  use assoc_err_m
+  implicit none
+  type(foo_t) :: f
+  associate(b => f%func())
+    print *, 1. + b
+  end associate
+end program
+
+! { dg-final { cleanup-modules "assoc_err_m" } }