Hello,
I'm testing the attached patch which fixes the PR56477 test case.
Will commit as obvious tonight.
Mikael
2013-03-03 Mikael Morin <[email protected]>
PR fortran/56477
* expr.c (gfc_check_pointer_assign): Avoid NULL pointer dereference.
2013-03-03 Mikael Morin <[email protected]>
PR fortran/56477
* gfortran.dg/pointer_check_13.f90: New test.
Index: fortran/expr.c
===================================================================
--- fortran/expr.c (révision 196416)
+++ fortran/expr.c (copie de travail)
@@ -3732,7 +3732,7 @@ gfc_check_pointer_assign (gfc_expr *lvalue, gfc_ex
&& rvalue->symtree->n.sym->ns->proc_name->attr.flavor != FL_PROCEDURE
&& rvalue->symtree->n.sym->ns->proc_name->attr.flavor != FL_PROGRAM)
for (ns = rvalue->symtree->n.sym->ns;
- ns->proc_name && ns->proc_name->attr.flavor != FL_PROCEDURE;
+ ns && ns->proc_name && ns->proc_name->attr.flavor != FL_PROCEDURE;
ns = ns->parent)
if (ns->parent == lvalue->symtree->n.sym->ns)
warn = true;
! { dg-do compile }
!
! PR fortran/56477
! The pointer target live range checking code using to trigger an ICE on
! the following
!
! Contributed by Andrew Benson <[email protected]>
!
module s
contains
function so()
implicit none
integer, target :: so
integer, pointer :: sp
sp => so
return
end function So
end module s