public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "antoine.lemoine@bordeaux-inp.fr" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/95743] New: [9/10 Regression] bogus recursive call to nonrecursive procedure with -fcheck=recursion
Date: Thu, 18 Jun 2020 13:54:12 +0000	[thread overview]
Message-ID: <bug-95743-4@http.gcc.gnu.org/bugzilla/> (raw)

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.

             reply	other threads:[~2020-06-18 13:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-18 13:54 antoine.lemoine@bordeaux-inp.fr [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-95743-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).