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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu.org

--- Comment #3 from kargl at gcc dot gnu.org ---
(In reply to G. Steinmetz from comment #1)
> Some older issues :
> 
> 
> $ cat z3.f90
> program p
>    print *, [real :: 1, [integer :: (real(k), k=2,1), 2]]
> end
> 
> 
> $ cat z4.f90
> program p
>    print *, [real :: [integer :: (dble(k), k=1,0), 2]]
> end
> 
> 
> $ gfortran-9-20181118 -c z3.f90
> f951: internal compiler error: gfc_convert_constant(): Unexpected type
> 0x61a501 gfc_internal_error(char const*, ...)
>         ../../gcc/fortran/error.c:1363
> 0x6a759c gfc_convert_constant(gfc_expr*, bt, int)
>         ../../gcc/fortran/simplify.c:8363
> 0x6a761a gfc_convert_constant(gfc_expr*, bt, int)
>         ../../gcc/fortran/simplify.c:8396
> 0x62d3cb do_simplify
>         ../../gcc/fortran/intrinsic.c:4475
> 0x638452 gfc_convert_type_warn(gfc_expr*, gfc_typespec*, int, int)
>         ../../gcc/fortran/intrinsic.c:5148
> 0x5ece92 gfc_match_array_constructor(gfc_expr**)
>         ../../gcc/fortran/array.c:1249
> 0x650479 match_primary
>         ../../gcc/fortran/matchexp.c:153
> 0x650479 match_level_1
>         ../../gcc/fortran/matchexp.c:211
> 0x650479 match_mult_operand
>         ../../gcc/fortran/matchexp.c:267
> 0x6506d8 match_add_operand
>         ../../gcc/fortran/matchexp.c:356
> 0x65092c match_level_2
>         ../../gcc/fortran/matchexp.c:480
> 0x650a82 match_level_3
>         ../../gcc/fortran/matchexp.c:551
> 0x650b74 match_level_4
>         ../../gcc/fortran/matchexp.c:599
> 0x650b74 match_and_operand
>         ../../gcc/fortran/matchexp.c:693
> 0x650d62 match_or_operand
>         ../../gcc/fortran/matchexp.c:722
> 0x650e32 match_equiv_operand
>         ../../gcc/fortran/matchexp.c:765
> 0x650f04 match_level_5
>         ../../gcc/fortran/matchexp.c:811
> 0x6502e1 gfc_match_expr(gfc_expr**)
>         ../../gcc/fortran/matchexp.c:870
> 0x638e23 match_io_element
>         ../../gcc/fortran/io.c:3587
> 0x63b795 match_io_list
>         ../../gcc/fortran/io.c:3626

(In reply to kargl from comment #2)
> (In reply to G. Steinmetz from comment #0)
> > With invalid code for versions 8/9, silently accepted with 5/6/7  :
> > 
> > 
> > $ cat z1.f90
> > program p
> >    print *, [integer :: 1, [integer(8) :: 2, ['3']]]
> > end
> > 
> > 
> > $ gfortran-9-20181118 -c z1.f90
> > f951: internal compiler error: gfc_convert_constant(): Unexpected type
> > 0x61a501 gfc_internal_error(char const*, ...)
> >         ../../gcc/fortran/error.c:1363
> > 0x6a759c gfc_convert_constant(gfc_expr*, bt, int)
> >         ../../gcc/fortran/simplify.c:8363
> > 0x6a761a gfc_convert_constant(gfc_expr*, bt, int)
> >         ../../gcc/fortran/simplify.c:8396
> > 0x62d3cb do_simplify
> >         ../../gcc/fortran/intrinsic.c:4475
> > 0x638452 gfc_convert_type_warn(gfc_expr*, gfc_typespec*, int, int)
> >         ../../gcc/fortran/intrinsic.c:5148
> > 0x5ece92 gfc_match_array_constructor(gfc_expr**)
> >         ../../gcc/fortran/array.c:1249
> > 0x650479 match_primary
> >         ../../gcc/fortran/matchexp.c:153
> > 0x650479 match_level_1
> >         ../../gcc/fortran/matchexp.c:211
> > 0x650479 match_mult_operand
> >         ../../gcc/fortran/matchexp.c:267
> > 0x6506d8 match_add_operand
> >         ../../gcc/fortran/matchexp.c:356
> > 0x65092c match_level_2
> >         ../../gcc/fortran/matchexp.c:480
> > 0x650a82 match_level_3
> >         ../../gcc/fortran/matchexp.c:551
> > 0x650b74 match_level_4
> >         ../../gcc/fortran/matchexp.c:599
> > 0x650b74 match_and_operand
> >         ../../gcc/fortran/matchexp.c:693
> > 0x650d62 match_or_operand
> >         ../../gcc/fortran/matchexp.c:722
> > 0x650e32 match_equiv_operand
> >         ../../gcc/fortran/matchexp.c:765
> > 0x650f04 match_level_5
> >         ../../gcc/fortran/matchexp.c:811
> > 0x6502e1 gfc_match_expr(gfc_expr**)
> >         ../../gcc/fortran/matchexp.c:870
> > 0x638e23 match_io_element
> >         ../../gcc/fortran/io.c:3587
> > 0x63b795 match_io_list
> >         ../../gcc/fortran/io.c:3626
> 
> Index: gcc/fortran/simplify.c
> ===================================================================
> --- gcc/fortran/simplify.c    (revision 266281)
> +++ gcc/fortran/simplify.c    (working copy)
> @@ -8360,7 +8360,7 @@ gfc_convert_constant (gfc_expr *e, bt type, int kind)
>  
>      default:
>      oops:
> -      gfc_internal_error ("gfc_convert_constant(): Unexpected type");
> +      return &gfc_bad_expr;
>      }
>  
>    result = NULL;
> 
> %  gfcx -o z a.f90 && ./z
> a.f90:3:46:
> 
>     3 |    print *, [integer :: 1, [integer(8) :: 2, ['3']]]
>       |                                              1
> Error: Can't convert CHARACTER(1) to INTEGER(8) at (1)

program p
  print *, [real :: 1, [integer :: (real(k), k=2,1), 2]]
  print *, [real :: [integer :: (dble(k), k=1,0), 2]]
end


 gfcx -o z a.f90 && ./z
   1.00000000       2.00000000    
   2.00000000

Reply via email to