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

            Bug ID: 86059
           Summary: ICE in reduce_binary_ac, at fortran/arith.c:1308 (and
                    others)
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gs...@t-online.de
  Target Milestone: ---

Extracted from pr86045 comment 1, loosely related to pr66193.
Invalid code with null(), affects gfortran down to at least 4.8.


$ cat zn1.f90
program p
   real :: z(1) = [real :: null()] + 2.0
end

$ cat zn2.f90
program p
   real :: z(1) = [real :: null()] + [real :: 2]
end

$ cat zn3.f90
program p
   real :: z(1) = 1.0 + [real :: null()]
end

$ cat zn4.f90
program p
   real :: z(1) = [real :: 1] + [real :: null()]
end

$ cat zn5.f90
program p
   real :: z(2) = [real :: null()] + [real :: null()]
end


$ gfortran-9-20180603 -c zn1.f90
f951: internal compiler error: Segmentation fault
0xba15af crash_signal
        ../../gcc/toplev.c:325
0x675138 reduce_binary_ac
        ../../gcc/fortran/arith.c:1308
0x6750d2 reduce_binary_ac
        ../../gcc/fortran/arith.c:1295
0x67531c reduce_binary
        ../../gcc/fortran/arith.c:1421
0x675b3b eval_intrinsic
        ../../gcc/fortran/arith.c:1596
0x675d9e eval_intrinsic_f3
        ../../gcc/fortran/arith.c:1733
0x6ac645 simplify_intrinsic_op
        ../../gcc/fortran/expr.c:1133
0x6ac645 gfc_simplify_expr(gfc_expr*, int)
        ../../gcc/fortran/expr.c:1984
0x70f44f resolve_operator
        ../../gcc/fortran/resolve.c:4162
0x70f44f gfc_resolve_expr(gfc_expr*)
        ../../gcc/fortran/resolve.c:6716
0x6ab92f gfc_reduce_init_expr(gfc_expr*)
        ../../gcc/fortran/expr.c:2773
0x6ae431 gfc_match_init_expr(gfc_expr**)
        ../../gcc/fortran/expr.c:2821
0x69bfb9 variable_decl
        ../../gcc/fortran/decl.c:2681
0x69bfb9 gfc_match_data_decl()
        ../../gcc/fortran/decl.c:5880
0x6f6fb9 match_word_omp_simd
        ../../gcc/fortran/parse.c:93
0x6fa6ae match_word
        ../../gcc/fortran/parse.c:376
0x6fa6ae decode_statement
        ../../gcc/fortran/parse.c:376
0x6fc5d4 next_free
        ../../gcc/fortran/parse.c:1230
0x6fc5d4 next_statement
        ../../gcc/fortran/parse.c:1462
0x6fe3ec parse_spec
        ../../gcc/fortran/parse.c:3670

Reply via email to