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

            Bug ID: 91565
           Summary: [8/9/10 Regression] ICE in gfc_simplify_reshape, at
                    fortran/simplify.c:6707 etc.
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gs...@t-online.de
  Target Milestone: ---

ICE hits gfortran-8 and higher - this changed just before 20180525.
Starting with correct code z0.f90, then providing wrong orders
(accepted up to gfortran-7) :


$ cat z0.f90
program p
   integer, parameter :: a(2) = [2,1]
   print *, reshape([1,2,3,4,5,6], [2,3], order=a)
end

$ gfortran-10 z0.f90 && ./a.out
           1           4           2           5           3           6



$ cat z1.f90   # not a permutation
program p
   integer, parameter :: a(2) = [2,2]
   print *, reshape([1,2,3,4,5,6], [2,3], order=a)
end


$ cat z2.f90   # size of order and shape differs
program p
   integer, parameter :: a(1) = 1
   print *, reshape([1,2,3,4,5,6], [2,3], order=a)
end


$ cat z3.f90   # shape of order and shape differs
program p
   integer, parameter :: a(1,2) = 1
   print *, reshape([1,2,3,4,5,6], [2,3], order=a)
end



$ gfortran-7 z3.f90 && ./a.out
           1           3           4          -1           0           0
$
$ gfortran-10-20190825 -c z1.f90
f951: internal compiler error: in gfc_simplify_reshape, at
fortran/simplify.c:6707
0x6a6a99 gfc_simplify_reshape(gfc_expr*, gfc_expr*, gfc_expr*, gfc_expr*)
        ../../gcc/fortran/simplify.c:6707
0x62ef5b do_simplify
        ../../gcc/fortran/intrinsic.c:4556
0x6395ee gfc_intrinsic_func_interface(gfc_expr*, int)
        ../../gcc/fortran/intrinsic.c:4931
0x6907a1 resolve_unknown_f
        ../../gcc/fortran/resolve.c:2896
0x6907a1 resolve_function
        ../../gcc/fortran/resolve.c:3233
0x68ce2d gfc_resolve_expr(gfc_expr*)
        ../../gcc/fortran/resolve.c:6951
0x684e5b gfc_resolve_code(gfc_code*, gfc_namespace*)
        ../../gcc/fortran/resolve.c:11416
0x694fbf gfc_resolve_blocks(gfc_code*, gfc_namespace*)
        ../../gcc/fortran/resolve.c:10460
0x684fe9 gfc_resolve_code(gfc_code*, gfc_namespace*)
        ../../gcc/fortran/resolve.c:11406
0x687ca7 resolve_codes
        ../../gcc/fortran/resolve.c:16921
0x687d6e gfc_resolve(gfc_namespace*)
        ../../gcc/fortran/resolve.c:16956
0x67581c resolve_all_program_units
        ../../gcc/fortran/parse.c:6073
0x67581c gfc_parse_file()
        ../../gcc/fortran/parse.c:6320
0x6bf60f gfc_be_parse_file
        ../../gcc/fortran/f95-lang.c:204

Reply via email to