public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/96102] New: ICE in check_host_association, at fortran/resolve.c:5994
@ 2020-07-07 17:27 gscfq@t-online.de
  2020-07-07 17:27 ` [Bug fortran/96102] " gscfq@t-online.de
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: gscfq@t-online.de @ 2020-07-07 17:27 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96102
           Summary: ICE in check_host_association, at
                    fortran/resolve.c:5994
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gscfq@t-online.de
  Target Milestone: ---

It's an old issue, affects versions down to at least r5 :


$ cat z1.f90
module m
   integer :: n = 2
contains
   subroutine s
      if ( n /= 2 ) stop 1
   contains
      integer function n()
         n = 0
      end
   end
end


$ gfortran-11-20200705 -c z1.f90
f951: internal compiler error: Segmentation fault
0xbd3bdf crash_signal
        ../../gcc/toplev.c:328
0x6c515c check_host_association
        ../../gcc/fortran/resolve.c:5994
0x6c515c gfc_resolve_expr(gfc_expr*)
        ../../gcc/fortran/resolve.c:7053
0x6c76d7 gfc_resolve_expr(gfc_expr*)
        ../../gcc/fortran/resolve.c:4410
0x6c76d7 resolve_operator
        ../../gcc/fortran/resolve.c:3997
0x6c4087 gfc_resolve_expr(gfc_expr*)
        ../../gcc/fortran/resolve.c:7047
0x6d5ff1 gfc_resolve_expr(gfc_expr*)
        ../../gcc/fortran/resolve.c:7021
0x6d5ff1 gfc_resolve_blocks(gfc_code*, gfc_namespace*)
        ../../gcc/fortran/resolve.c:10658
0x6cbc88 gfc_resolve_code(gfc_code*, gfc_namespace*)
        ../../gcc/fortran/resolve.c:11746
0x6ce517 resolve_codes
        ../../gcc/fortran/resolve.c:17273
0x6ce44e resolve_codes
        ../../gcc/fortran/resolve.c:17256
0x6ce5de gfc_resolve(gfc_namespace*)
        ../../gcc/fortran/resolve.c:17308
0x6b64f2 gfc_parse_file()
        ../../gcc/fortran/parse.c:6448
0x70284f gfc_be_parse_file
        ../../gcc/fortran/f95-lang.c:212

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

* [Bug fortran/96102] ICE in check_host_association, at fortran/resolve.c:5994
  2020-07-07 17:27 [Bug fortran/96102] New: ICE in check_host_association, at fortran/resolve.c:5994 gscfq@t-online.de
@ 2020-07-07 17:27 ` gscfq@t-online.de
  2020-07-07 21:51 ` kargl at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: gscfq@t-online.de @ 2020-07-07 17:27 UTC (permalink / raw)
  To: gcc-bugs

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

G. Steinmetz <gscfq@t-online.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-invalid-code

--- Comment #1 from G. Steinmetz <gscfq@t-online.de> ---

For reference a valid and working variant :


$ cat z0.f90
module m
   integer :: n = 2
contains
   subroutine s
      if ( n() /= 0 ) stop 1
      print *, n()
   contains
      integer function n()
         n = 0
      end
   end
end
program p
   use m
   call s
end


$ gfortran-11-20200705 z0.f90 && ./a.out
           0
$

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

* [Bug fortran/96102] ICE in check_host_association, at fortran/resolve.c:5994
  2020-07-07 17:27 [Bug fortran/96102] New: ICE in check_host_association, at fortran/resolve.c:5994 gscfq@t-online.de
  2020-07-07 17:27 ` [Bug fortran/96102] " gscfq@t-online.de
@ 2020-07-07 21:51 ` kargl at gcc dot gnu.org
  2020-08-02 12:27 ` pault at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: kargl at gcc dot gnu.org @ 2020-07-07 21:51 UTC (permalink / raw)
  To: gcc-bugs

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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu.org
     Ever confirmed|0                           |1
           Priority|P3                          |P4
   Last reconfirmed|                            |2020-07-07
             Status|UNCONFIRMED                 |NEW

--- Comment #2 from kargl at gcc dot gnu.org ---
Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c       (revision 280157)
+++ gcc/fortran/resolve.c       (working copy)
@@ -5899,6 +5899,15 @@ check_host_association (gfc_expr *e)
              && sym->attr.flavor == FL_PROCEDURE
              && sym->attr.contained)
        {
+
+         if (old_sym->attr.flavor == FL_VARIABLE
+             && sym->attr.proc == PROC_INTERNAL)
+           {
+             gfc_error ("Internal procedure %qs at %L has already been "
+                        "used as a variable", sym->name, &sym->declared_at);
+             return false;
+           }
+
          /* Clear the shape, since it might not be valid.  */
          gfc_free_shape (&e->shape, e->rank);

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

* [Bug fortran/96102] ICE in check_host_association, at fortran/resolve.c:5994
  2020-07-07 17:27 [Bug fortran/96102] New: ICE in check_host_association, at fortran/resolve.c:5994 gscfq@t-online.de
  2020-07-07 17:27 ` [Bug fortran/96102] " gscfq@t-online.de
  2020-07-07 21:51 ` kargl at gcc dot gnu.org
@ 2020-08-02 12:27 ` pault at gcc dot gnu.org
  2020-08-10  5:19 ` cvs-commit at gcc dot gnu.org
  2020-12-28 12:00 ` pault at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: pault at gcc dot gnu.org @ 2020-08-02 12:27 UTC (permalink / raw)
  To: gcc-bugs

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

Paul Thomas <pault at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pault at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |pault at gcc dot gnu.org

--- Comment #3 from Paul Thomas <pault at gcc dot gnu.org> ---
Created attachment 48983
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48983&action=edit
Proposed patch for the PR

Steve's proposed patch caused regressions in host_assoc_function_[1,2].f90.

This one regtests OK.

I don't know if the gcc_assert needs to be retained or not. I will go through
all the possible cases that can arrive here. If the only one is caught by the
condition above, then the assert can go as can the second and third lines in
the condition.

Paul

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

* [Bug fortran/96102] ICE in check_host_association, at fortran/resolve.c:5994
  2020-07-07 17:27 [Bug fortran/96102] New: ICE in check_host_association, at fortran/resolve.c:5994 gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2020-08-02 12:27 ` pault at gcc dot gnu.org
@ 2020-08-10  5:19 ` cvs-commit at gcc dot gnu.org
  2020-12-28 12:00 ` pault at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-08-10  5:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Paul Thomas <pault@gcc.gnu.org>:

https://gcc.gnu.org/g:359815ad136ee6ad142fb54470ce79609e43ff5d

commit r11-2624-g359815ad136ee6ad142fb54470ce79609e43ff5d
Author: Paul Thomas <pault@gcc.gnu.org>
Date:   Mon Aug 10 06:19:25 2020 +0100

    This patch fixes PR96102. See the explanatory comment in the testcase.

    2020-08-10  Paul Thomas  <pault@gcc.gnu.org>

    gcc/fortran
            PR fortran/96102
            * resolve.c (check_host_association): Replace the gcc_assert
            with an error for internal procedures.

    gcc/testsuite/
            PR fortran/96102
            * gfortran.dg/pr96102.f90: New test.

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

* [Bug fortran/96102] ICE in check_host_association, at fortran/resolve.c:5994
  2020-07-07 17:27 [Bug fortran/96102] New: ICE in check_host_association, at fortran/resolve.c:5994 gscfq@t-online.de
                   ` (3 preceding siblings ...)
  2020-08-10  5:19 ` cvs-commit at gcc dot gnu.org
@ 2020-12-28 12:00 ` pault at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: pault at gcc dot gnu.org @ 2020-12-28 12:00 UTC (permalink / raw)
  To: gcc-bugs

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

Paul Thomas <pault at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #5 from Paul Thomas <pault at gcc dot gnu.org> ---
I should have closed this one. I have too much of a backlog to be backporting
non-regressions.

Thanks for the report.

Paul

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

end of thread, other threads:[~2020-12-28 12:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-07 17:27 [Bug fortran/96102] New: ICE in check_host_association, at fortran/resolve.c:5994 gscfq@t-online.de
2020-07-07 17:27 ` [Bug fortran/96102] " gscfq@t-online.de
2020-07-07 21:51 ` kargl at gcc dot gnu.org
2020-08-02 12:27 ` pault at gcc dot gnu.org
2020-08-10  5:19 ` cvs-commit at gcc dot gnu.org
2020-12-28 12:00 ` pault 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).