public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/66045] New: ICE on incorrect code with null
@ 2015-05-07  7:59 gerhard.steinmetz.fortran@t-online.de
  2015-05-07 15:18 ` [Bug fortran/66045] " kargl at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: gerhard.steinmetz.fortran@t-online.de @ 2015-05-07  7:59 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66045

            Bug ID: 66045
           Summary: ICE on incorrect code with null
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gerhard.steinmetz.fortran@t-online.de
  Target Milestone: ---

This incorrect code snippet disrupts :

   program p
      contains
      integer :: null=null()
   end

f951: internal compiler error: Segmentation fault

Tested with gfortran 5.1.1 on SUSE Linux 13.2 (64 bit).
Kind regards.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug fortran/66045] ICE on incorrect code with null
  2015-05-07  7:59 [Bug fortran/66045] New: ICE on incorrect code with null gerhard.steinmetz.fortran@t-online.de
@ 2015-05-07 15:18 ` kargl at gcc dot gnu.org
  2015-05-18 22:21 ` kargl at gcc dot gnu.org
  2015-05-19 18:03 ` kargl at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: kargl at gcc dot gnu.org @ 2015-05-07 15:18 UTC (permalink / raw)
  To: gcc-bugs

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)


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug fortran/66045] ICE on incorrect code with null
  2015-05-07  7:59 [Bug fortran/66045] New: ICE on incorrect code with null gerhard.steinmetz.fortran@t-online.de
  2015-05-07 15:18 ` [Bug fortran/66045] " kargl at gcc dot gnu.org
@ 2015-05-18 22:21 ` kargl at gcc dot gnu.org
  2015-05-19 18:03 ` kargl at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: kargl at gcc dot gnu.org @ 2015-05-18 22:21 UTC (permalink / raw)
  To: gcc-bugs

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  <kargl@gcc.gnu.org>

        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  <kargl@gcc.gnu.org>

        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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug fortran/66045] ICE on incorrect code with null
  2015-05-07  7:59 [Bug fortran/66045] New: ICE on incorrect code with null gerhard.steinmetz.fortran@t-online.de
  2015-05-07 15:18 ` [Bug fortran/66045] " kargl at gcc dot gnu.org
  2015-05-18 22:21 ` kargl at gcc dot gnu.org
@ 2015-05-19 18:03 ` kargl at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: kargl at gcc dot gnu.org @ 2015-05-19 18:03 UTC (permalink / raw)
  To: gcc-bugs

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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-05-19 18:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-07  7:59 [Bug fortran/66045] New: ICE on incorrect code with null gerhard.steinmetz.fortran@t-online.de
2015-05-07 15:18 ` [Bug fortran/66045] " kargl at gcc dot gnu.org
2015-05-18 22:21 ` kargl at gcc dot gnu.org
2015-05-19 18:03 ` kargl at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).