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

            Bug ID: 105986
           Summary: ICE in gfc_convert_mpz_to_signed, at
                    fortran/simplify.cc:193
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gs...@t-online.de
  Target Milestone: ---

Affects versions down to at least r5 :


$ cat z1.f90
program p
   integer :: i
   print *, [(btest(ibset(8_1,i), i), i=0,8)]
   print *, [(btest(ibset(8_2,i), i), i=0,16)]
   print *, [(btest(ibset(8_4,i), i), i=0,32)]
   print *, [(btest(ibset(8_8,i), i), i=0,64)]
   print *, [(btest(ibset(8_16,i), i), i=0,128)]
end


$ cat z2.f90
program p
   integer :: i
   print *, [(btest(ibset(8_1,i), i), i=-1,7)]
   print *, [(btest(ibset(8_2,i), i), i=-1,15)]
   print *, [(btest(ibset(8_4,i), i), i=-1,31)]
   print *, [(btest(ibset(8_8,i), i), i=-1,63)]
   print *, [(btest(ibset(8_16,i), i), i=-1,127)]
end


$ gfortran-13-20220612 -c z1.f90
f951: internal compiler error: in gfc_convert_mpz_to_signed, at
fortran/simplify.cc:193
0x788eb1 gfc_convert_mpz_to_signed(__mpz_struct*, int)
        ../../gcc/fortran/simplify.cc:193
0x78e41b gfc_simplify_ibset(gfc_expr*, gfc_expr*)
        ../../gcc/fortran/simplify.cc:3452
0x70e3c6 do_simplify
        ../../gcc/fortran/intrinsic.cc:4670
0x7191c8 gfc_intrinsic_func_interface(gfc_expr*, int)
        ../../gcc/fortran/intrinsic.cc:4942
0x6ff0dc gfc_simplify_expr(gfc_expr*, int)
        ../../gcc/fortran/expr.cc:2228
0x6fed3b gfc_simplify_expr(gfc_expr*, int)
        ../../gcc/fortran/expr.cc:2224
0x6c59f1 expand_constructor
        ../../gcc/fortran/array.cc:1839
0x6c5c9e expand_expr
        ../../gcc/fortran/array.cc:1697
0x6c5c9e expand_iterator
        ../../gcc/fortran/array.cc:1767
0x6c5c9e expand_constructor
        ../../gcc/fortran/array.cc:1810
0x6c7dc7 gfc_array_size(gfc_expr*, __mpz_struct (*) [1])
        ../../gcc/fortran/array.cc:2677
0x76a75f expression_shape
        ../../gcc/fortran/resolve.cc:5519
0x76a75f gfc_expression_rank(gfc_expr*)
        ../../gcc/fortran/resolve.cc:5593
0x76c02f gfc_resolve_expr(gfc_expr*)
        ../../gcc/fortran/resolve.cc:7223
0x77411c gfc_resolve_expr(gfc_expr*)
        ../../gcc/fortran/resolve.cc:7154
0x77411c gfc_resolve_code(gfc_code*, gfc_namespace*)
        ../../gcc/fortran/resolve.cc:11966
0x772baf gfc_resolve_blocks(gfc_code*, gfc_namespace*)
        ../../gcc/fortran/resolve.cc:10965
0x772f08 gfc_resolve_code(gfc_code*, gfc_namespace*)
        ../../gcc/fortran/resolve.cc:11956
0x775c97 resolve_codes
        ../../gcc/fortran/resolve.cc:17609
0x775d5e gfc_resolve(gfc_namespace*)
        ../../gcc/fortran/resolve.cc:17644

Reply via email to