[Bug fortran/66045] ICE on incorrect code with null

2015-05-19 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66045

kargl at gcc dot gnu.org changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED
   Target Milestone|--- |5.2

--- Comment #4 from kargl at gcc dot gnu.org ---
Fixed on trunk and 5-branch.  Thanks for the bug report.


[Bug fortran/66045] ICE on incorrect code with null

2015-05-19 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66045

--- Comment #3 from kargl at gcc dot gnu.org ---
Author: kargl
Date: Tue May 19 17:59:58 2015
New Revision: 223406

URL: https://gcc.gnu.org/viewcvs?rev=223406&root=gcc&view=rev
Log:
2015-05-19  Steven G. Kargl  

PR fortran/66045
* expr.c (gfc_check_assign):  Check for assignment of NULL() instead
of the (intended) pointer assignment.

2015-05-19  Steven G. Kargl  

PR fortran/66045
* gfortran.dg/null1.f90: New test.

Added:
branches/gcc-5-branch/gcc/testsuite/gfortran.dg/null1.f90
Modified:
branches/gcc-5-branch/gcc/fortran/ChangeLog
branches/gcc-5-branch/gcc/fortran/expr.c
branches/gcc-5-branch/gcc/testsuite/ChangeLog


[Bug fortran/66045] ICE on incorrect code with null

2015-05-18 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66045

--- Comment #2 from kargl at gcc dot gnu.org ---
Author: kargl
Date: Mon May 18 22:21:08 2015
New Revision: 223322

URL: https://gcc.gnu.org/viewcvs?rev=223322&root=gcc&view=rev
Log:
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.


Added:
trunk/gcc/testsuite/gfortran.dg/null1.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/expr.c
trunk/gcc/testsuite/ChangeLog


[Bug fortran/66045] ICE on incorrect code with null

2015-05-07 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66045

kargl at gcc dot gnu.org changed:

   What|Removed |Added

   Priority|P3  |P4
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2015-05-07
 CC||kargl at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from kargl at gcc dot gnu.org ---
Confirmed.

This patch (watch copy-n-paste tab corruption)

Index: expr.c
===
--- expr.c  (revision 222869)
+++ expr.c  (working copy)
@@ -3118,19 +3118,22 @@ gfc_check_assign (gfc_expr *lvalue, gfc_
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.  */

yields

gfc6 -c po.f90
po.f90:3:19:

integer :: null=null()
   1
Error: NULL appears on right-hand side in assignment at (1)