public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrew Benson <abenson@carnegiescience.edu>
To: Fortran List <fortran@gcc.gnu.org>
Cc: Andrew Benson <abensonca@gmail.com>
Subject: ICE with elemental finalizer
Date: Sun, 31 Mar 2024 00:01:04 -0700	[thread overview]
Message-ID: <CAM3HiBd93wr4xd6a+iHkGmboFJX_m8QhUs6C=QAbaWTn57AeBA@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 2902 bytes --]

I opened PR114535 for the following ICE:

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

The following code (which must be in two files to trigger the error) causes
an ICE using the latest gfortran.

$ cat ice1.F90
module iv
  type, public :: vs
   contains
     final :: destructor
  end type vs
contains
 elemental subroutine destructor(s)
    type(vs), intent(inout) :: s
  end subroutine destructor
end module iv

$ cat ice2.F90                                                     module d
contains
  function en() result(dd)
    use :: iv
    type(vs) :: dd
    return
  end function en
end module d

module ni
contains
  subroutine iss()
    use :: d
    return
  end subroutine iss
end module ni

$ gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/data001/abenson/Galacticus/Tools_Devel/bin/../libexec/gcc/x86_64-pc-linux-gnu/14.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-git/configure
--prefix=/home/abenson/Galacticus/Tools_Devel
--enable-languages=c,c++,fortran --disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.1 20240330 (experimental) (GCC)

$ gfortran -c ice1.F90 -o ice1.o
$ gfortran -c ice2.F90 -o ice2.o
 ice2.F90:16:13:
   16 | end module ni                                         |
 1
internal compiler error: in gfc_trans_call, at fortran/trans-stmt.cc:400
                                    0x78ddb6 gfc_trans_call(gfc_code*,
bool, tree_node*, tree_node*, bool)
        ../../gcc-git/gcc/fortran/trans-stmt.cc:400     0xaa8a1b
trans_code
 ../../gcc-git/gcc/fortran/trans.cc:2431
0xb47c14 gfc_trans_simple_do
        ../../gcc-git/gcc/fortran/trans-stmt.cc:2521
0xb47c14 gfc_trans_do(gfc_code*, tree_node*)
        ../../gcc-git/gcc/fortran/trans-stmt.cc:2653
0xaa898a trans_code
 ../../gcc-git/gcc/fortran/trans.cc:2463
0xb485e9 gfc_trans_integer_select
 ../../gcc-git/gcc/fortran/trans-stmt.cc:3199
0xb485e9 gfc_trans_select(gfc_code*)
        ../../gcc-git/gcc/fortran/trans-stmt.cc:3692
0xaa8957 trans_code
        ../../gcc-git/gcc/fortran/trans.cc:2475
0xadd6fb gfc_generate_function_code(gfc_namespace*)
        ../../gcc-git/gcc/fortran/trans-decl.cc:7879
0xaadbf1 gfc_generate_module_code(gfc_namespace*)
        ../../gcc-git/gcc/fortran/trans.cc:2785
0xa5113d translate_all_program_units
        ../../gcc-git/gcc/fortran/parse.cc:7086
0xa5113d gfc_parse_file()
        ../../gcc-git/gcc/fortran/parse.cc:7413
0xaa546f gfc_be_parse_file
        ../../gcc-git/gcc/fortran/f95-lang.cc:241
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

This only occurs if the FINAL subroutine is ELEMENTAL.


--

* Andrew Benson: http://users.obs.carnegiescience.edu/abenson

* Galacticus: https://github.com/galacticusorg/galacticus

                 reply	other threads:[~2024-03-31  7:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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='CAM3HiBd93wr4xd6a+iHkGmboFJX_m8QhUs6C=QAbaWTn57AeBA@mail.gmail.com' \
    --to=abenson@carnegiescience.edu \
    --cc=abensonca@gmail.com \
    --cc=fortran@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).