From 37775e79ee9baac8d0037ac2fc30f386111a7a45 Mon Sep 17 00:00:00 2001 From: Jerry DeLisle Date: Fri, 22 Jun 2007 16:21:23 +0000 Subject: [PATCH] re PR fortran/32360 (GFORTRAN WON'T COMPILE 'DATA PTR1 /NULL ()/' WHEN PTR1 HAS POINTER ATTRIBUTE) 2007-06-22 Jerry DeLisle PR fortran/32360 * expr.c (gfc_check_assign): If the rvalue expression type is NULL_EXPR, check to see if the lvalue has attribute pointer and data. From-SVN: r125949 --- gcc/fortran/ChangeLog | 6 ++++++ gcc/fortran/expr.c | 18 ++++++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index befa318e0e9..f3238863fa2 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2007-06-22 Jerry DeLisle + + PR fortran/32360 + * expr.c (gfc_check_assign): If the rvalue expression type is NULL_EXPR, + check to see if the lvalue has attribute pointer and data. + 2007-06-21 Jerry DeLisle PR fortran/31162 diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index 00ed9a04d77..d3f0ddf5cce 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -2407,12 +2407,18 @@ gfc_check_assign (gfc_expr *lvalue, gfc_expr *rvalue, int conform) return FAILURE; } - if (rvalue->expr_type == EXPR_NULL) - { - gfc_error ("NULL appears on right-hand side in assignment at %L", - &rvalue->where); - return FAILURE; - } + if (rvalue->expr_type == EXPR_NULL) + { + if (lvalue->symtree->n.sym->attr.pointer + && lvalue->symtree->n.sym->attr.data) + return SUCCESS; + else + { + gfc_error ("NULL appears on right-hand side in assignment at %L", + &rvalue->where); + return FAILURE; + } + } if (sym->attr.cray_pointee && lvalue->ref != NULL -- 2.30.2