public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/103717] New: ICE in doloop_code, at fortran/frontend-passes.c:2656
@ 2021-12-14 18:12 gscfq@t-online.de
  2021-12-14 20:13 ` [Bug fortran/103717] " anlauf at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: gscfq@t-online.de @ 2021-12-14 18:12 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 103717
           Summary: ICE in doloop_code, at fortran/frontend-passes.c:2656
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gscfq@t-online.de
  Target Milestone: ---

Affects versions down to at least r5 :
(gcc configured with --enable-checking=yes)


$ cat z1.f90
program p
   integer :: i
   do i = 1, 2
      call s(i)
   end do
contains
   subroutine s(*)
   end
end


$ cat z2.f90
recursive subroutine s(*)
   integer :: i
   do i = 1, 2
      call s(i)
   end do
end


$ gfortran-12-20211212 -c z1.f90
z1.f90:4:15:

    4 |       call s(i)
      |               1
Error: Missing alternate return specifier in subroutine call at (1)
f951: internal compiler error: Segmentation fault
0xf12d1f crash_signal
        ../../gcc/toplev.c:322
0x957d0e doloop_code
        ../../gcc/fortran/frontend-passes.c:2656
0x955909 gfc_code_walker(gfc_code**, int (*)(gfc_code**, int*, void*), int
(*)(gfc_expr**, int*, void*), void*)
        ../../gcc/fortran/frontend-passes.c:5337
0x955a87 gfc_code_walker(gfc_code**, int (*)(gfc_code**, int*, void*), int
(*)(gfc_expr**, int*, void*), void*)
        ../../gcc/fortran/frontend-passes.c:5673
0x956afb doloop_warn
        ../../gcc/fortran/frontend-passes.c:3063
0x95704a gfc_run_passes(gfc_namespace*)
        ../../gcc/fortran/frontend-passes.c:156
0x857657 gfc_resolve(gfc_namespace*)
        ../../gcc/fortran/resolve.c:17573
0x83f954 resolve_all_program_units
        ../../gcc/fortran/parse.c:6586
0x83f954 gfc_parse_file()
        ../../gcc/fortran/parse.c:6842
0x88db0f gfc_be_parse_file
        ../../gcc/fortran/f95-lang.c:216

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

* [Bug fortran/103717] ICE in doloop_code, at fortran/frontend-passes.c:2656
  2021-12-14 18:12 [Bug fortran/103717] New: ICE in doloop_code, at fortran/frontend-passes.c:2656 gscfq@t-online.de
@ 2021-12-14 20:13 ` anlauf at gcc dot gnu.org
  2021-12-14 20:57 ` cvs-commit at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-12-14 20:13 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-12-14
                 CC|                            |anlauf at gcc dot gnu.org
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
           Priority|P3                          |P4

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

NULL pointer dereference:


diff --git a/gcc/fortran/frontend-passes.c b/gcc/fortran/frontend-passes.c
index c106ee0957a..6ffe072b185 100644
--- a/gcc/fortran/frontend-passes.c
+++ b/gcc/fortran/frontend-passes.c
@@ -2653,7 +2653,7 @@ doloop_code (gfc_code **c, int *walk_subtrees
ATTRIBUTE_UNUSED,

              do_sym = cl->ext.iterator->var->symtree->n.sym;

-             if (a->expr && a->expr->symtree
+             if (a->expr && a->expr->symtree && f->sym
                  && a->expr->symtree->n.sym == do_sym)
                {
                  if (f->sym->attr.intent == INTENT_OUT)

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

* [Bug fortran/103717] ICE in doloop_code, at fortran/frontend-passes.c:2656
  2021-12-14 18:12 [Bug fortran/103717] New: ICE in doloop_code, at fortran/frontend-passes.c:2656 gscfq@t-online.de
  2021-12-14 20:13 ` [Bug fortran/103717] " anlauf at gcc dot gnu.org
@ 2021-12-14 20:57 ` cvs-commit at gcc dot gnu.org
  2021-12-14 21:04 ` anlauf at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-12-14 20:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Harald Anlauf <anlauf@gcc.gnu.org>:

https://gcc.gnu.org/g:ca39102e10643a6b3f07d06934cc0907ba83d9ee

commit r12-5968-gca39102e10643a6b3f07d06934cc0907ba83d9ee
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Tue Dec 14 21:57:04 2021 +0100

    Fortran: prevent NULL pointer dereference in check of passed do-loop
variable

    gcc/fortran/ChangeLog:

            PR fortran/103717
            * frontend-passes.c (doloop_code): Prevent NULL pointer
            dereference when checking for passing a do-loop variable to a
            contained procedure with an interface mismatch.

    gcc/testsuite/ChangeLog:

            PR fortran/103717
            * gfortran.dg/do_check_19.f90: New test.

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

* [Bug fortran/103717] ICE in doloop_code, at fortran/frontend-passes.c:2656
  2021-12-14 18:12 [Bug fortran/103717] New: ICE in doloop_code, at fortran/frontend-passes.c:2656 gscfq@t-online.de
  2021-12-14 20:13 ` [Bug fortran/103717] " anlauf at gcc dot gnu.org
  2021-12-14 20:57 ` cvs-commit at gcc dot gnu.org
@ 2021-12-14 21:04 ` anlauf at gcc dot gnu.org
  2021-12-15 19:36 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-12-14 21:04 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |anlauf at gcc dot gnu.org

--- Comment #3 from anlauf at gcc dot gnu.org ---
Taking.

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

* [Bug fortran/103717] ICE in doloop_code, at fortran/frontend-passes.c:2656
  2021-12-14 18:12 [Bug fortran/103717] New: ICE in doloop_code, at fortran/frontend-passes.c:2656 gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2021-12-14 21:04 ` anlauf at gcc dot gnu.org
@ 2021-12-15 19:36 ` cvs-commit at gcc dot gnu.org
  2021-12-16 22:22 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-12-15 19:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Harald Anlauf
<anlauf@gcc.gnu.org>:

https://gcc.gnu.org/g:1a5c50c3ad2a2f66f1232d25b0f0c15ee1bf449f

commit r11-9386-g1a5c50c3ad2a2f66f1232d25b0f0c15ee1bf449f
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Tue Dec 14 21:57:04 2021 +0100

    Fortran: prevent NULL pointer dereference in check of passed do-loop
variable

    gcc/fortran/ChangeLog:

            PR fortran/103717
            * frontend-passes.c (doloop_code): Prevent NULL pointer
            dereference when checking for passing a do-loop variable to a
            contained procedure with an interface mismatch.

    gcc/testsuite/ChangeLog:

            PR fortran/103717
            * gfortran.dg/do_check_19.f90: New test.

    (cherry picked from commit ca39102e10643a6b3f07d06934cc0907ba83d9ee)

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

* [Bug fortran/103717] ICE in doloop_code, at fortran/frontend-passes.c:2656
  2021-12-14 18:12 [Bug fortran/103717] New: ICE in doloop_code, at fortran/frontend-passes.c:2656 gscfq@t-online.de
                   ` (3 preceding siblings ...)
  2021-12-15 19:36 ` cvs-commit at gcc dot gnu.org
@ 2021-12-16 22:22 ` cvs-commit at gcc dot gnu.org
  2021-12-16 22:34 ` cvs-commit at gcc dot gnu.org
  2021-12-16 22:36 ` anlauf at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-12-16 22:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Harald Anlauf
<anlauf@gcc.gnu.org>:

https://gcc.gnu.org/g:b99da5f23e122af800c1fca77e03664e686ae575

commit r10-10343-gb99da5f23e122af800c1fca77e03664e686ae575
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Tue Dec 14 21:57:04 2021 +0100

    Fortran: prevent NULL pointer dereference in check of passed do-loop
variable

    gcc/fortran/ChangeLog:

            PR fortran/103717
            * frontend-passes.c (doloop_code): Prevent NULL pointer
            dereference when checking for passing a do-loop variable to a
            contained procedure with an interface mismatch.

    gcc/testsuite/ChangeLog:

            PR fortran/103717
            * gfortran.dg/do_check_19.f90: New test.

    (cherry picked from commit ca39102e10643a6b3f07d06934cc0907ba83d9ee)

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

* [Bug fortran/103717] ICE in doloop_code, at fortran/frontend-passes.c:2656
  2021-12-14 18:12 [Bug fortran/103717] New: ICE in doloop_code, at fortran/frontend-passes.c:2656 gscfq@t-online.de
                   ` (4 preceding siblings ...)
  2021-12-16 22:22 ` cvs-commit at gcc dot gnu.org
@ 2021-12-16 22:34 ` cvs-commit at gcc dot gnu.org
  2021-12-16 22:36 ` anlauf at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-12-16 22:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Harald Anlauf
<anlauf@gcc.gnu.org>:

https://gcc.gnu.org/g:54947545e364016d396c2e4012b1d7e6fc5cc6ba

commit r9-9872-g54947545e364016d396c2e4012b1d7e6fc5cc6ba
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Tue Dec 14 21:57:04 2021 +0100

    Fortran: prevent NULL pointer dereference in check of passed do-loop
variable

    gcc/fortran/ChangeLog:

            PR fortran/103717
            * frontend-passes.c (doloop_code): Prevent NULL pointer
            dereference when checking for passing a do-loop variable to a
            contained procedure with an interface mismatch.

    gcc/testsuite/ChangeLog:

            PR fortran/103717
            * gfortran.dg/do_check_19.f90: New test.

    (cherry picked from commit ca39102e10643a6b3f07d06934cc0907ba83d9ee)

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

* [Bug fortran/103717] ICE in doloop_code, at fortran/frontend-passes.c:2656
  2021-12-14 18:12 [Bug fortran/103717] New: ICE in doloop_code, at fortran/frontend-passes.c:2656 gscfq@t-online.de
                   ` (5 preceding siblings ...)
  2021-12-16 22:34 ` cvs-commit at gcc dot gnu.org
@ 2021-12-16 22:36 ` anlauf at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-12-16 22:36 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED
   Target Milestone|---                         |9.5

--- Comment #7 from anlauf at gcc dot gnu.org ---
Fixed.

Thanks for the report!

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

end of thread, other threads:[~2021-12-16 22:36 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-14 18:12 [Bug fortran/103717] New: ICE in doloop_code, at fortran/frontend-passes.c:2656 gscfq@t-online.de
2021-12-14 20:13 ` [Bug fortran/103717] " anlauf at gcc dot gnu.org
2021-12-14 20:57 ` cvs-commit at gcc dot gnu.org
2021-12-14 21:04 ` anlauf at gcc dot gnu.org
2021-12-15 19:36 ` cvs-commit at gcc dot gnu.org
2021-12-16 22:22 ` cvs-commit at gcc dot gnu.org
2021-12-16 22:34 ` cvs-commit at gcc dot gnu.org
2021-12-16 22:36 ` anlauf 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).