]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/58658 ([OOP] Pointer assignment to allocatable unlimited polymorphic...
authorTobias Burnus <burnus@net-b.de>
Mon, 14 Oct 2013 17:26:17 +0000 (19:26 +0200)
committerTobias Burnus <burnus@gcc.gnu.org>
Mon, 14 Oct 2013 17:26:17 +0000 (19:26 +0200)
2013-10-14  Tobias Burnus  <burnus@net-b.de>

        PR fortran/58658
        * expr.c (gfc_check_vardef_context): Fix pointer diagnostic
        for CLASS(*).

2013-10-14  Tobias Burnus  <burnus@net-b.de>

        PR fortran/58658
        * gfortran.dg/unlimited_polymorphic_10.f90: New.

From-SVN: r203572

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

index 583baa6430907a69c5bf467edde30028b9bdeb34..0515e6c68d5969ae27f4cabbe94179d72a5966db 100644 (file)
@@ -1,3 +1,9 @@
+2013-10-14  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/58658
+       * expr.c (gfc_check_vardef_context): Fix pointer diagnostic
+       for CLASS(*).
+
 2013-10-11  Jakub Jelinek  <jakub@redhat.com>
 
        * trans-openmp.c (gfc_omp_clause_default_ctor,
index b2af32816e5acae6df51d7bef21a08cf15a1be63..df96e5b4d351a0c743f76b055b01d0db35845e37 100644 (file)
@@ -4693,7 +4693,6 @@ gfc_check_vardef_context (gfc_expr* e, bool pointer, bool alloc_obj,
   bool is_pointer;
   bool check_intentin;
   bool ptr_component;
-  bool unlimited;
   symbol_attribute attr;
   gfc_ref* ref;
   int i;
@@ -4709,8 +4708,6 @@ gfc_check_vardef_context (gfc_expr* e, bool pointer, bool alloc_obj,
       sym = e->value.function.esym ? e->value.function.esym : e->symtree->n.sym;
     }
 
-  unlimited = e->ts.type == BT_CLASS && UNLIMITED_POLY (sym);
-
   attr = gfc_expr_attr (e);
   if (!pointer && e->expr_type == EXPR_FUNCTION && attr.pointer)
     {
@@ -4750,7 +4747,7 @@ gfc_check_vardef_context (gfc_expr* e, bool pointer, bool alloc_obj,
   /* Find out whether the expr is a pointer; this also means following
      component references to the last one.  */
   is_pointer = (attr.pointer || attr.proc_pointer);
-  if (pointer && !is_pointer && !unlimited)
+  if (pointer && !is_pointer)
     {
       if (context)
        gfc_error ("Non-POINTER in pointer association context (%s)"
index c5455e884a9a5b863b960e3ff139b4622361cd16..075d0714b48f68c4b9d55242358387e3aa4be4fb 100644 (file)
@@ -1,3 +1,8 @@
+2013-10-14  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/58658
+       * gfortran.dg/unlimited_polymorphic_10.f90: New.
+
 2013-10-14  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
        * gcc.dg/torture/pr58670.c (ASM_STR) [__i386__ || __x86_64__]: Use
diff --git a/gcc/testsuite/gfortran.dg/unlimited_polymorphic_10.f90 b/gcc/testsuite/gfortran.dg/unlimited_polymorphic_10.f90
new file mode 100644 (file)
index 0000000..04518d6
--- /dev/null
@@ -0,0 +1,10 @@
+! { dg-do compile }
+!
+! PR fortran/58658
+!
+! Contributed by Vladimír Fuka
+!
+subroutine sub(a)
+  class(*),allocatable :: a
+  a => null() ! { dg-error "Non-POINTER in pointer association context \\(pointer assignment\\)" }
+end subroutine