public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/114308] New: ICE in fold_convert_loc, at fold-const.cc:2627
@ 2024-03-11 16:25 asiancorporator at yahoo dot de
  2024-03-11 16:36 ` [Bug fortran/114308] " pinskia at gcc dot gnu.org
  2024-03-12 12:02 ` rguenth at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: asiancorporator at yahoo dot de @ 2024-03-11 16:25 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114308
           Summary: ICE in fold_convert_loc, at fold-const.cc:2627
           Product: gcc
           Version: 13.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: asiancorporator at yahoo dot de
  Target Milestone: ---

I am getting an error when I tried to extend an array that is supposed to
contain instances inherited from abstract classes. Ran on macOS Sonoma 14.2.1
(M1) with gfortran 13.2.1.

module my_module
  implicit none
  private

  type, abstract, public :: a
  end type

  type, extends(a), public :: b
  end type
end

program main
  use my_module
  implicit none

  class(a), allocatable :: a_array(:)
  type(b) :: b_instance

  a_array = [b_instance] ! This line works
  a_array = [a_array, b_instance] ! This one throws an ICE
end program

Output:

main.f90                               failed.
[ 50%] Compiling...
app/main.f90:20:58:

   20 |   a_array = [a_array, b_instance] ! This one throws an ICE
      |                                                          1
internal compiler error: in fold_convert_loc, at fold-const.cc:2627
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
See <https://github.com/Homebrew/homebrew-core/issues> for instructions.
<ERROR> Compilation failed for object " app_main.f90.o "
<ERROR> stopping due to failed compilation
STOP 1

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

* [Bug fortran/114308] ICE in fold_convert_loc, at fold-const.cc:2627
  2024-03-11 16:25 [Bug fortran/114308] New: ICE in fold_convert_loc, at fold-const.cc:2627 asiancorporator at yahoo dot de
@ 2024-03-11 16:36 ` pinskia at gcc dot gnu.org
  2024-03-12 12:02 ` rguenth at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-11 16:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
GCC before 7 didn't support this feature:
Error: Assignment to an allocatable polymorphic variable at (1) is not yet
supported

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

* [Bug fortran/114308] ICE in fold_convert_loc, at fold-const.cc:2627
  2024-03-11 16:25 [Bug fortran/114308] New: ICE in fold_convert_loc, at fold-const.cc:2627 asiancorporator at yahoo dot de
  2024-03-11 16:36 ` [Bug fortran/114308] " pinskia at gcc dot gnu.org
@ 2024-03-12 12:02 ` rguenth at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-03-12 12:02 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2024-03-12
     Ever confirmed|0                           |1
           Keywords|                            |ice-on-valid-code

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed on trunk, not sure if valid or invalid.  We call fold_convert to
convert an object of type b to type a, this is not a conversion supported
this way.  Building a VIEW_CONVERT_EXPR would be what's supported but not
sure whether that's the correct thing to do.

> ./f951 -quiet t.f90
t.f90:20:58:

   20 |   a_array = [a_array, b_instance] ! This one throws an ICE
      |                                                          1
internal compiler error: in fold_convert_loc, at fold-const.cc:2757
0x126cdc0 fold_convert_loc(unsigned int, tree_node*, tree_node*)
        /space/rguenther/src/gcc/gcc/fold-const.cc:2757
0xeef77b gfc_trans_array_ctor_element
        /space/rguenther/src/gcc/gcc/fortran/trans-array.cc:1956
0xeefeeb gfc_trans_array_constructor_value
        /space/rguenther/src/gcc/gcc/fortran/trans-array.cc:2144
0xef2369 trans_array_constructor
        /space/rguenther/src/gcc/gcc/fortran/trans-array.cc:2976
0xef2daa gfc_add_loop_ss_code
        /space/rguenther/src/gcc/gcc/fortran/trans-array.cc:3269
0xef9ebc gfc_conv_loop_setup(gfc_loopinfo*, locus*)
        /space/rguenther/src/gcc/gcc/fortran/trans-array.cc:5656
0xf63110 gfc_trans_assignment_1
        /space/rguenther/src/gcc/gcc/fortran/trans-expr.cc:12216
0xf64810 gfc_trans_assignment(gfc_expr*, gfc_expr*, bool, bool, bool, bool)
        /space/rguenther/src/gcc/gcc/fortran/trans-expr.cc:12679
0xf64888 gfc_trans_assign(gfc_code*)
        /space/rguenther/src/gcc/gcc/fortran/trans-expr.cc:12691
0xee858c trans_code
        /space/rguenther/src/gcc/gcc/fortran/trans.cc:2363
0xee8bdf gfc_trans_code(gfc_code*)
        /space/rguenther/src/gcc/gcc/fortran/trans.cc:2718
0xf34d1b gfc_generate_function_code(gfc_namespace*)
        /space/rguenther/src/gcc/gcc/fortran/trans-decl.cc:7879

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

end of thread, other threads:[~2024-03-12 12:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-11 16:25 [Bug fortran/114308] New: ICE in fold_convert_loc, at fold-const.cc:2627 asiancorporator at yahoo dot de
2024-03-11 16:36 ` [Bug fortran/114308] " pinskia at gcc dot gnu.org
2024-03-12 12:02 ` rguenth 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).