public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/101085] New: ICE in gfc_conv_intrinsic_to_class, at fortran/trans-expr.c:1039
@ 2021-06-15 17:09 gscfq@t-online.de
  2021-06-15 17:10 ` [Bug fortran/101085] " gscfq@t-online.de
  0 siblings, 1 reply; 2+ messages in thread
From: gscfq@t-online.de @ 2021-06-15 17:09 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101085
           Summary: ICE in gfc_conv_intrinsic_to_class, at
                    fortran/trans-expr.c:1039
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gscfq@t-online.de
  Target Milestone: ---

This invalid code z1 (rank mismatch scalar versus array) affects
versions down to r7.  Case z2 is a correct variant of z1, similar
invalid case z3 is detected (integer instead of character) :


$ cat z1.f90
program p
   type t
      integer :: n
   end type
   class(t), allocatable :: c(:)
   character(3) :: a = 'abc'
   c = [t(1)]
   if ( f(c, a) /= 1 ) stop 1
contains
   integer function f(x, y)
      class(t) :: x(:)
      class(*) :: y(size(x))
      f = size(y)
   end
end


$ gfortran-12-20210613 -c z1.f90
z1.f90:8:8:

    8 |    if ( f(c, a) /= 1 ) stop 1
      |        1
internal compiler error: in fold_convert_loc, at fold-const.c:2553
0x9b26a3 fold_convert_loc(unsigned int, tree_node*, tree_node*)
        ../../gcc/fold-const.c:2553
0x7d4c5b gfc_conv_intrinsic_to_class(gfc_se*, gfc_expr*, gfc_typespec)
        ../../gcc/fortran/trans-expr.c:1039
0x7d5e65 gfc_conv_procedure_call(gfc_se*, gfc_symbol*, gfc_actual_arglist*,
gfc_expr*, vec<tree_node*, va_gc, vl_embed>*)
        ../../gcc/fortran/trans-expr.c:5878
0x7cdaca gfc_conv_expr(gfc_se*, gfc_expr*)
        ../../gcc/fortran/trans-expr.c:9017
0x7cde9d gfc_conv_expr_op
        ../../gcc/fortran/trans-expr.c:3883
0x7cde9d gfc_conv_expr(gfc_se*, gfc_expr*)
        ../../gcc/fortran/trans-expr.c:9013
0x7d0993 gfc_conv_expr_val(gfc_se*, gfc_expr*)
        ../../gcc/fortran/trans-expr.c:9070
0x80dcf9 gfc_trans_if_1
        ../../gcc/fortran/trans-stmt.c:1469
0x8158aa gfc_trans_if(gfc_code*)
        ../../gcc/fortran/trans-stmt.c:1507
0x79f9c7 trans_code
        ../../gcc/fortran/trans.c:2006
0x7c6054 gfc_generate_function_code(gfc_namespace*)
        ../../gcc/fortran/trans-decl.c:6893
0x74c876 translate_all_program_units
        ../../gcc/fortran/parse.c:6461
0x74c876 gfc_parse_file()
        ../../gcc/fortran/parse.c:6730
0x798bbf gfc_be_parse_file
        ../../gcc/fortran/f95-lang.c:212

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

* [Bug fortran/101085] ICE in gfc_conv_intrinsic_to_class, at fortran/trans-expr.c:1039
  2021-06-15 17:09 [Bug fortran/101085] New: ICE in gfc_conv_intrinsic_to_class, at fortran/trans-expr.c:1039 gscfq@t-online.de
@ 2021-06-15 17:10 ` gscfq@t-online.de
  0 siblings, 0 replies; 2+ messages in thread
From: gscfq@t-online.de @ 2021-06-15 17:10 UTC (permalink / raw)
  To: gcc-bugs

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

G. Steinmetz <gscfq@t-online.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-invalid-code

--- Comment #1 from G. Steinmetz <gscfq@t-online.de> ---

$ cat z2.f90
program p
   type t
      integer :: n
   end type
   class(t), allocatable :: c(:)
   character(3) :: a(1) = ['abc']
   c = [t(1)]
   if ( f(c, a) /= 1 ) stop 1
contains
   integer function f(x, y)
      class(t) :: x(:)
      class(*) :: y(size(x))
      f = size(y)
   end
end


$ cat z3.f90
program p
   type t
      integer :: n
   end type
   class(t), allocatable :: c(:)
   integer :: a = 3
   c = [t(1)]
   if ( f(c, a) /= 1 ) stop 1
contains
   integer function f(x, y)
      class(t) :: x(:)
      class(*) :: y(size(x))
      f = size(y)
   end
end


$ gfortran-12-20210613 -c z2.f90
$
$ gfortran-12-20210613 -c z3.f90
z3.f90:8:13:

    8 |    if ( f(c, a) /= 1 ) stop 1
      |             1
Error: Rank mismatch in argument 'y' at (1) (rank-1 and scalar)

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

end of thread, other threads:[~2021-06-15 17:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-15 17:09 [Bug fortran/101085] New: ICE in gfc_conv_intrinsic_to_class, at fortran/trans-expr.c:1039 gscfq@t-online.de
2021-06-15 17:10 ` [Bug fortran/101085] " gscfq@t-online.de

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).