public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/95743] New: [9/10 Regression] bogus recursive call to nonrecursive procedure with -fcheck=recursion
@ 2020-06-18 13:54 antoine.lemoine@bordeaux-inp.fr
  2020-06-19  7:11 ` [Bug fortran/95743] " rguenth at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: antoine.lemoine@bordeaux-inp.fr @ 2020-06-18 13:54 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95743
           Summary: [9/10 Regression] bogus recursive call to nonrecursive
                    procedure with -fcheck=recursion
           Product: gcc
           Version: 9.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: antoine.lemoine@bordeaux-inp.fr
  Target Milestone: ---

I was able to reproduce the closed bug #80361 with gfortran 9.3.0 and 10.1.0
using the following code:

program test_recursive_call                                                     
   implicit none

   type t_tree_node
      type(t_tree_node), dimension(:), allocatable :: child
   end type

   type t_tree
      type(t_tree_node), allocatable :: root
   end type

   type(t_tree), allocatable :: tree

   allocate(tree)
   allocate(tree%root)
   allocate(tree%root%child(1))
   ! If the line below is removed, the code works fine.                         
   allocate(tree%root%child(1)%child(1))
   deallocate(tree)
end program

Command line to compile the code:
gfortran -g -fcheck=recursion -o tree tree.f90

I obtain the following runtime error:

At line 1 of file tree.f90
Fortran runtime error: Recursive call to nonrecursive procedure
'__deallocate_test_recursive_call_T_tree_node'

Error termination. Backtrace:
#0  0x5623824511fb in __deallocate_test_recursive_call_T_tree_node
        at /home/****/fortran/test_gcc_ice2/tree.f90:1
#1  0x562382451302 in __deallocate_test_recursive_call_T_tree_node
        at /home/****/fortran/test_gcc_ice2/tree.f90:1
#2  0x562382451b95 in test_recursive_call
        at /home/****/fortran/test_gcc_ice2/tree.f90:18
#3  0x562382452230 in main
        at /home/****/fortran/test_gcc_ice2/tree.f90:19

It works fine without -fcheck=recursion.

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

* [Bug fortran/95743] [9/10 Regression] bogus recursive call to nonrecursive procedure with -fcheck=recursion
  2020-06-18 13:54 [Bug fortran/95743] New: [9/10 Regression] bogus recursive call to nonrecursive procedure with -fcheck=recursion antoine.lemoine@bordeaux-inp.fr
@ 2020-06-19  7:11 ` rguenth at gcc dot gnu.org
  2020-06-28 12:44 ` tkoenig at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-06-19  7:11 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |9.4
           Priority|P3                          |P4

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

* [Bug fortran/95743] [9/10 Regression] bogus recursive call to nonrecursive procedure with -fcheck=recursion
  2020-06-18 13:54 [Bug fortran/95743] New: [9/10 Regression] bogus recursive call to nonrecursive procedure with -fcheck=recursion antoine.lemoine@bordeaux-inp.fr
  2020-06-19  7:11 ` [Bug fortran/95743] " rguenth at gcc dot gnu.org
@ 2020-06-28 12:44 ` tkoenig at gcc dot gnu.org
  2020-06-29 20:35 ` [Bug fortran/95743] [9/10/11 " tkoenig at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2020-06-28 12:44 UTC (permalink / raw)
  To: gcc-bugs

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

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2020-06-28
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #1 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Confirmed.

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

* [Bug fortran/95743] [9/10/11 Regression] bogus recursive call to nonrecursive procedure with -fcheck=recursion
  2020-06-18 13:54 [Bug fortran/95743] New: [9/10 Regression] bogus recursive call to nonrecursive procedure with -fcheck=recursion antoine.lemoine@bordeaux-inp.fr
  2020-06-19  7:11 ` [Bug fortran/95743] " rguenth at gcc dot gnu.org
  2020-06-28 12:44 ` tkoenig at gcc dot gnu.org
@ 2020-06-29 20:35 ` tkoenig at gcc dot gnu.org
  2020-06-29 21:13 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2020-06-29 20:35 UTC (permalink / raw)
  To: gcc-bugs

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

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[9/10 Regression] bogus     |[9/10/11 Regression] bogus
                   |recursive call to           |recursive call to
                   |nonrecursive procedure with |nonrecursive procedure with
                   |-fcheck=recursion           |-fcheck=recursion

--- Comment #2 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Also fails on current master.

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

* [Bug fortran/95743] [9/10/11 Regression] bogus recursive call to nonrecursive procedure with -fcheck=recursion
  2020-06-18 13:54 [Bug fortran/95743] New: [9/10 Regression] bogus recursive call to nonrecursive procedure with -fcheck=recursion antoine.lemoine@bordeaux-inp.fr
                   ` (2 preceding siblings ...)
  2020-06-29 20:35 ` [Bug fortran/95743] [9/10/11 " tkoenig at gcc dot gnu.org
@ 2020-06-29 21:13 ` cvs-commit at gcc dot gnu.org
  2020-06-30 13:03 ` 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 @ 2020-06-29 21:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Thomas Kथà¤nig <tkoenig@gcc.gnu.org>:

https://gcc.gnu.org/g:95cdcf701dad826f225d6413b59650f181954399

commit r11-1719-g95cdcf701dad826f225d6413b59650f181954399
Author: Thomas Koenig <tkoenig@gcc.gnu.org>
Date:   Mon Jun 29 23:11:06 2020 +0200

    Do not generate recursion check for compiler-generated procedures.

    This one-line fix removes a check for recursion for procedures
    which are compiler-generated, such as finalizers or deallocation.
    These need to be recursive, even if the user code should not be.

    gcc/fortran/ChangeLog:

            PR fortran/95743
            * trans-decl.c (gfc_generate_function_code): Do not generate
            recursion check for compiler-generated procedures.

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

* [Bug fortran/95743] [9/10/11 Regression] bogus recursive call to nonrecursive procedure with -fcheck=recursion
  2020-06-18 13:54 [Bug fortran/95743] New: [9/10 Regression] bogus recursive call to nonrecursive procedure with -fcheck=recursion antoine.lemoine@bordeaux-inp.fr
                   ` (3 preceding siblings ...)
  2020-06-29 21:13 ` cvs-commit at gcc dot gnu.org
@ 2020-06-30 13:03 ` cvs-commit at gcc dot gnu.org
  2020-06-30 13:50 ` cvs-commit at gcc dot gnu.org
  2020-06-30 13:51 ` tkoenig at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-06-30 13:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Thomas Kथà¤nig
<tkoenig@gcc.gnu.org>:

https://gcc.gnu.org/g:6e1d5e760513bf47931f99d0e5b277a5afcdb6d1

commit r10-8396-g6e1d5e760513bf47931f99d0e5b277a5afcdb6d1
Author: Thomas Koenig <tkoenig@gcc.gnu.org>
Date:   Mon Jun 29 23:11:06 2020 +0200

    Do not generate recursion check for compiler-generated procedures.

    This one-line fix removes a check for recursion for procedures
    which are compiler-generated, such as finalizers or deallocation.
    These need to be recursive, even if the user code should not be.

    gcc/fortran/ChangeLog:

            PR fortran/95743
            * trans-decl.c (gfc_generate_function_code): Do not generate
            recursion check for compiler-generated procedures.

    (cherry picked from commit 95cdcf701dad826f225d6413b59650f181954399)

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

* [Bug fortran/95743] [9/10/11 Regression] bogus recursive call to nonrecursive procedure with -fcheck=recursion
  2020-06-18 13:54 [Bug fortran/95743] New: [9/10 Regression] bogus recursive call to nonrecursive procedure with -fcheck=recursion antoine.lemoine@bordeaux-inp.fr
                   ` (4 preceding siblings ...)
  2020-06-30 13:03 ` cvs-commit at gcc dot gnu.org
@ 2020-06-30 13:50 ` cvs-commit at gcc dot gnu.org
  2020-06-30 13:51 ` tkoenig at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-06-30 13:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Thomas Kथà¤nig
<tkoenig@gcc.gnu.org>:

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

commit r9-8707-gdc0a56856417a91dc49fd1ea75e0802d0f5da276
Author: Thomas Koenig <tkoenig@gcc.gnu.org>
Date:   Mon Jun 29 23:11:06 2020 +0200

    Do not generate recursion check for compiler-generated procedures.

    This one-line fix removes a check for recursion for procedures
    which are compiler-generated, such as finalizers or deallocation.
    These need to be recursive, even if the user code should not be.

    gcc/fortran/ChangeLog:

            PR fortran/95743
            * trans-decl.c (gfc_generate_function_code): Do not generate
            recursion check for compiler-generated procedures.

    (cherry picked from commit 95cdcf701dad826f225d6413b59650f181954399)

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

* [Bug fortran/95743] [9/10/11 Regression] bogus recursive call to nonrecursive procedure with -fcheck=recursion
  2020-06-18 13:54 [Bug fortran/95743] New: [9/10 Regression] bogus recursive call to nonrecursive procedure with -fcheck=recursion antoine.lemoine@bordeaux-inp.fr
                   ` (5 preceding siblings ...)
  2020-06-30 13:50 ` cvs-commit at gcc dot gnu.org
@ 2020-06-30 13:51 ` tkoenig at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2020-06-30 13:51 UTC (permalink / raw)
  To: gcc-bugs

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

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

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

--- Comment #6 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Fixed on all affected branches.

Thanks for the bug report!

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

end of thread, other threads:[~2020-06-30 13:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-18 13:54 [Bug fortran/95743] New: [9/10 Regression] bogus recursive call to nonrecursive procedure with -fcheck=recursion antoine.lemoine@bordeaux-inp.fr
2020-06-19  7:11 ` [Bug fortran/95743] " rguenth at gcc dot gnu.org
2020-06-28 12:44 ` tkoenig at gcc dot gnu.org
2020-06-29 20:35 ` [Bug fortran/95743] [9/10/11 " tkoenig at gcc dot gnu.org
2020-06-29 21:13 ` cvs-commit at gcc dot gnu.org
2020-06-30 13:03 ` cvs-commit at gcc dot gnu.org
2020-06-30 13:50 ` cvs-commit at gcc dot gnu.org
2020-06-30 13:51 ` tkoenig 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).