Patchwork [fortran] PR56477 ICE on pointer assignment checking

login
register
mail settings
Submitter Mikael Morin
Date March 3, 2013, 6:42 p.m.
Message ID <5133997B.5030302@sfr.fr>
Download mbox | patch
Permalink /patch/224563/
State New
Headers show

Comments

Mikael Morin - March 3, 2013, 6:42 p.m.
Hello,

I'm testing the attached patch which fixes the PR56477 test case.

Will commit as obvious tonight.

Mikael
2013-03-03  Mikael Morin  <mikael@gcc.gnu.org>

	PR fortran/56477
	* expr.c (gfc_check_pointer_assign): Avoid NULL pointer dereference.

2013-03-03  Mikael Morin  <mikael@gcc.gnu.org>

	PR fortran/56477
	* gfortran.dg/pointer_check_13.f90: New test.

Patch

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;