summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjanus <janus@138bc75d-0d04-0410-961f-82ee72b054a4>2013-01-03 16:14:54 +0000
committerjanus <janus@138bc75d-0d04-0410-961f-82ee72b054a4>2013-01-03 16:14:54 +0000
commitc44e251950af1a1b3714183ada521ba6560eb9f2 (patch)
treeafefe9f86acc329127bc795a8d892848d8f080d6
parent6f75c845ff39ef4d66e38f1ce9136c19aacaae5b (diff)
downloadgcc-c44e251950af1a1b3714183ada521ba6560eb9f2.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@194857 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/expr.c5
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gfortran.dg/assignment_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/assignment_4.f9016
5 files changed, 31 insertions, 4 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 1fc88f22e07..2b050b12d7f 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -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
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
index 5c9ce11c4ee..261078460d2 100644
--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -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. */
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 36383ad29f7..234eeaceedd 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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.
diff --git a/gcc/testsuite/gfortran.dg/assignment_1.f90 b/gcc/testsuite/gfortran.dg/assignment_1.f90
index c8018a3d4c3..4322e5934c0 100644
--- a/gcc/testsuite/gfortran.dg/assignment_1.f90
+++ b/gcc/testsuite/gfortran.dg/assignment_1.f90
@@ -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
index 00000000000..77181a2054e
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/assignment_4.f90
@@ -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