public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "abensonca at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/105807] ICE / error when defining a class containing polymorphic components
Date: Wed, 25 Jan 2023 03:42:02 +0000	[thread overview]
Message-ID: <bug-105807-4-hDUCJQau6f@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-105807-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #4 from Andrew Benson <abensonca at gcc dot gnu.org> ---
A possibly related case:

module tm

  type :: st
  end type st

  type :: resourceManager
     class  (*), pointer :: resource => null()
     integer   , pointer :: counter  => null()
  end type resourceManager

  interface resourceManager
     module procedure resourceManager
  end interface

  type :: wrap
     type(st), pointer :: obj => null()
     type(resourceManager) :: manager
  end type wrap

  interface wrap
     module procedure wrapConstructN
  end interface

contains

  function resourceManagerConstructor(resource) result(self)
    implicit none
    type(resourceManager) :: self
    class(*), intent(in   ), pointer :: resource

    self%resource => resource
    allocate(self%counter)
    self%counter=1
    return
  end function resourceManagerConstructor

  function wrapConstructN(i) result(self)
    implicit none
    type(wrap) :: self
    integer, intent(in   ) :: i
    type(st), pointer :: st_

    allocate(self%obj)
    self%obj=st()
    self%manager=resourceManager(self%obj)
    return
  end function wrapConstructN

end module tm

$ gfortran -c bug.F90 -o bug -g
bug.F90:45:42:

   45 |     self%manager=resourceManager(self%obj)
      |                                          1
internal compiler error: in fold_convert_loc, at fold-const.cc:2627
0x770b18 fold_convert_loc(unsigned int, tree_node*, tree_node*)
        ../../gcc-git-unpatched/gcc/fold-const.cc:2627
0xa65649 gfc_trans_subcomponent_assign
        ../../gcc-git-unpatched/gcc/fortran/trans-expr.cc:9053
0xa667c9 gfc_trans_structure_assign(tree_node*, gfc_expr*, bool, bool)
        ../../gcc-git-unpatched/gcc/fortran/trans-expr.cc:9246
0xa67531 gfc_conv_structure(gfc_se*, gfc_expr*, int)
        ../../gcc-git-unpatched/gcc/fortran/trans-expr.cc:9313
0xa6ae35 gfc_trans_assignment_1
        ../../gcc-git-unpatched/gcc/fortran/trans-expr.cc:11742
0xa1b307 trans_code
        ../../gcc-git-unpatched/gcc/fortran/trans.cc:1950
0xa4d81d gfc_generate_function_code(gfc_namespace*)
        ../../gcc-git-unpatched/gcc/fortran/trans-decl.cc:7674
0xa1f6d1 gfc_generate_module_code(gfc_namespace*)
        ../../gcc-git-unpatched/gcc/fortran/trans.cc:2370
0x9c73f5 translate_all_program_units
        ../../gcc-git-unpatched/gcc/fortran/parse.cc:6708
0x9c73f5 gfc_parse_file()
        ../../gcc-git-unpatched/gcc/fortran/parse.cc:7027
0xa1804f gfc_be_parse_file
        ../../gcc-git-unpatched/gcc/fortran/f95-lang.cc:229
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.

      parent reply	other threads:[~2023-01-25  3:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-01 18:45 [Bug fortran/105807] New: " bourdin at mcmaster dot ca
2022-06-16 12:53 ` [Bug fortran/105807] " marxin at gcc dot gnu.org
2022-06-21 18:48 ` gscfq@t-online.de
2022-06-23 15:38 ` gscfq@t-online.de
2023-01-25  3:42 ` abensonca at gcc dot gnu.org [this message]

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-105807-4-hDUCJQau6f@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).