From: Steven G. Kargl Date: Mon, 18 May 2015 22:21:08 +0000 (+0000) Subject: re PR fortran/66045 (ICE on incorrect code with null) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bfeeb14516c9ef05958f47a1bad907c1e6d73f5b;p=gcc.git re PR fortran/66045 (ICE on incorrect code with null) 2015-05-18 Steven G. Kargl PR fortran/66045 * expr.c (gfc_check_assign): Check for assignment of NULL() instead of the (intended) pointer assignment. 2015-05-18 Steven G. Kargl PR fortran/66045 * gfortran.dg/null1.f90: New test. From-SVN: r223322 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 8f571b40b55..a8598a2004a 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2015-05-18 Steven G. Kargl + + PR fortran/66043 + * gfortran.dg/storage_size_6.f90: New tests. + 2015-05-18 Steven G. Kargl PR fortran/66044 diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index aa79243fa04..a0c37566cfb 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -3128,19 +3128,22 @@ gfc_check_assign (gfc_expr *lvalue, gfc_expr *rvalue, int conform) bad_proc = true; /* (ii) The assignment is in the main program; or */ - if (gfc_current_ns->proc_name->attr.is_main_program) + if (gfc_current_ns->proc_name + && gfc_current_ns->proc_name->attr.is_main_program) bad_proc = true; /* (iii) A module or internal procedure... */ - if ((gfc_current_ns->proc_name->attr.proc == PROC_INTERNAL - || gfc_current_ns->proc_name->attr.proc == PROC_MODULE) + if (gfc_current_ns->proc_name + && (gfc_current_ns->proc_name->attr.proc == PROC_INTERNAL + || gfc_current_ns->proc_name->attr.proc == PROC_MODULE) && gfc_current_ns->parent && (!(gfc_current_ns->parent->proc_name->attr.function || gfc_current_ns->parent->proc_name->attr.subroutine) || gfc_current_ns->parent->proc_name->attr.is_main_program)) { /* ... that is not a function... */ - if (!gfc_current_ns->proc_name->attr.function) + if (gfc_current_ns->proc_name + && !gfc_current_ns->proc_name->attr.function) bad_proc = true; /* ... or is not an entry and has a different name. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9f5c0ba49ee..1ae1f08f49c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-05-18 Steven G. Kargl + + PR fortran/66045 + * gfortran.dg/null1.f90: New test. + 2015-05-18 Steven G. Kargl PR fortran/66044 diff --git a/gcc/testsuite/gfortran.dg/null1.f90 b/gcc/testsuite/gfortran.dg/null1.f90 new file mode 100644 index 00000000000..fc50f414d1f --- /dev/null +++ b/gcc/testsuite/gfortran.dg/null1.f90 @@ -0,0 +1,9 @@ +! { dg-do compile } +! PR fortran/66045 +! +! Original code from Gerhard Steinmetz +! +program p + contains + integer :: null=null() ! { dg-error "NULL appears on right-hand side" } +end