re PR fortran/55855 ([OOP] incorrect warning with procedure pointer component on pointer-valued base object)

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
This commit is contained in:
Janus Weil 2013-01-03 17:14:54 +01:00
parent 59fd17e3a6
commit 8988cde62b
5 changed files with 31 additions and 4 deletions

View 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

View 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. */

View 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.

View 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()

View file

@ -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