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

            Bug ID: 92993
           Summary: ICE in maybe_canonicalize_comparison_1, at
                    fold-const.c:8845
           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: ---

With an interface mismatch, down to at least version 5 :


$ cat z1.f90
function f(x)
   integer, intent(in) :: x
   integer :: f
   f = x
end
program p
   interface
      function f(x)
         integer, intent(in) :: x
         integer, pointer :: f
      end
   end interface
   integer :: a(2) = [1, 2]
   if ( a(2) /= f(a(2)) ) stop
end


$ gfortran-10-20191215 -c z1.f90
z1.f90:8:6:

    8 |       function f(x)
      |      1
Warning: Interface mismatch in global procedure 'f' at (1): POINTER attribute
mismatch in function result
z1.f90:14:0:

   14 |    if ( a(2) /= f(a(2)) ) stop
      |
internal compiler error: Segmentation fault
0xb8147f crash_signal
        ../../gcc/toplev.c:328
0x8d2884 maybe_canonicalize_comparison_1
        ../../gcc/fold-const.c:8845
0x8d2f05 maybe_canonicalize_comparison
        ../../gcc/fold-const.c:8935
0x8d2f05 fold_comparison
        ../../gcc/fold-const.c:9354
0x8c7516 fold_binary_loc(unsigned int, tree_code, tree_node*, tree_node*,
tree_node*)
        ../../gcc/fold-const.c:11144
0x8cccfa fold_build2_loc(unsigned int, tree_code, tree_node*, tree_node*,
tree_node*)
        ../../gcc/fold-const.c:12883
0x707469 gfc_conv_expr_op
        ../../gcc/fortran/trans-expr.c:3627
0x707469 gfc_conv_expr(gfc_se*, gfc_expr*)
        ../../gcc/fortran/trans-expr.c:8653
0x70a013 gfc_conv_expr_val(gfc_se*, gfc_expr*)
        ../../gcc/fortran/trans-expr.c:8710
0x7421e9 gfc_trans_if_1
        ../../gcc/fortran/trans-stmt.c:1442
0x749cca gfc_trans_if(gfc_code*)
        ../../gcc/fortran/trans-stmt.c:1480
0x6d6cc7 trans_code
        ../../gcc/fortran/trans.c:1952
0x700124 gfc_generate_function_code(gfc_namespace*)
        ../../gcc/fortran/trans-decl.c:6801
0x6891b6 translate_all_program_units
        ../../gcc/fortran/parse.c:6302
0x6891b6 gfc_parse_file()
        ../../gcc/fortran/parse.c:6541
0x6d365f gfc_be_parse_file
        ../../gcc/fortran/f95-lang.c:210

Reply via email to