re PR fortran/55855 ([OOP] incorrect warning with procedure pointer component on...
authorJanus Weil <janus@gcc.gnu.org>
Thu, 3 Jan 2013 16:14:54 +0000 (17:14 +0100)
committerJanus Weil <janus@gcc.gnu.org>
Thu, 3 Jan 2013 16:14:54 +0000 (17:14 +0100)
2013-01-03  Janus Weil  <janus@gcc.gnu.org>

PR fortran/55855
* expr.c (gfc_check_assign): Use 'gfc_expr_attr' to evaluate attributes
of rvalue. Correct hyphenation in error message.

2013-01-03  Janus Weil  <janus@gcc.gnu.org>

PR fortran/55855
* gfortran.dg/assignment_1.f90: Modified.
* gfortran.dg/assignment_4.f90: New.

From-SVN: r194857

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

index 1fc88f22e070318ef64a83195fe627f9312693c0..2b050b12d7f8691f0d8a70a645c4eed90a48cc67 100644 (file)
@@ -1,3 +1,9 @@
+2013-01-03  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/55855
+       * expr.c (gfc_check_assign): Use 'gfc_expr_attr' to evaluate attributes
+       of rvalue. Correct hyphenation in error message.
+
 2013-01-03  Jakub Jelinek  <jakub@redhat.com>
 
        * gfortranspec.c (lang_specific_driver): Update copyright notice
index 5c9ce11c4eec62e3d168bb87e642abdbf2505b16..261078460d255ceefaad5c3db908f784f4ede17b 100644 (file)
@@ -3151,9 +3151,8 @@ gfc_check_assign (gfc_expr *lvalue, gfc_expr *rvalue, int conform)
 
   /* This is possibly a typo: x = f() instead of x => f().  */
   if (gfc_option.warn_surprising
-      && rvalue->expr_type == EXPR_FUNCTION
-      && rvalue->symtree->n.sym->attr.pointer)
-    gfc_warning ("POINTER valued function appears on right-hand side of "
+      && rvalue->expr_type == EXPR_FUNCTION && gfc_expr_attr (rvalue).pointer)
+    gfc_warning ("POINTER-valued function appears on right-hand side of "
                 "assignment at %L", &rvalue->where);
 
   /* Check size of array assignments.  */
index 36383ad29f78e22d0b62609c4913caffbeb43827..234eeaceedd404fb3da4c1620f831b47c7fc4969 100644 (file)
@@ -1,3 +1,9 @@
+2013-01-03  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/55855
+       * gfortran.dg/assignment_1.f90: Modified.
+       * gfortran.dg/assignment_4.f90: New.
+
 2013-01-03  David Edelsohn  <dje.gcc@gmail.com>
 
        * gcc.dg/torture/tls/tls-reload-1.c: Add tls options.
index c8018a3d4c3c669455c0455e9474b8595797af9d..4322e5934c019e7a43aaa0389f3a0d302a03aff6 100644 (file)
@@ -12,7 +12,7 @@ integer, target :: t, s
 t = 1
 p => s
 ! We didn't dereference the pointer in the following line.
-p = f() ! { dg-warning "POINTER valued function" "" }
+p = f() ! { dg-warning "POINTER-valued function" "" }
 p = p+1
 if (p.ne.2) call abort()
 if (p.ne.s) call abort()
diff --git a/gcc/testsuite/gfortran.dg/assignment_4.f90 b/gcc/testsuite/gfortran.dg/assignment_4.f90
new file mode 100644 (file)
index 0000000..77181a2
--- /dev/null
@@ -0,0 +1,16 @@
+! { dg-do compile }
+! { dg-options "-Wall" }
+!
+! PR 55855: [OOP] incorrect warning with procedure pointer component on pointer-valued base object
+!
+! Contributed by Andrew Benson <abensonca@gmail.com>
+
+  implicit none
+  type :: event
+    procedure(logical), pointer, nopass :: task
+  end type event
+  logical :: r
+  type(event), pointer :: myEvent
+  allocate(myEvent)
+  r=myEvent%task()
+end