Bug 107820 - ICE in match_mult_operand, at fortran/matchexp.cc:296
Summary: ICE in match_mult_operand, at fortran/matchexp.cc:296
Status: RESOLVED DUPLICATE of bug 107721
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 13.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2022-11-22 17:43 UTC by G. Steinmetz
Modified: 2023-01-30 00:28 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2022-11-22 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description G. Steinmetz 2022-11-22 17:43:40 UTC
Affects versions down to at least r5 :


$ cat z1.f90
program p
   print *, [real :: ([3])] ** 20
end

$ cat z2.f90
program p
   print *, [real :: (3)] ** 20
   print *, 3.0 ** 20
end


$ gfortran-13-20221120 z2.f90 && ./a.out
   3.48678451E+09
   3.48678451E+09


$ gfortran-13-20221120 -c z1.f90
z1.f90:2:23:

    2 |    print *, [real :: ([3])] ** 20
      |                       1
Error: Result of exponentiation at (1) exceeds the range of INTEGER(4)
f951: internal compiler error: Segmentation fault
0xf37d3f crash_signal
        ../../gcc/toplev.cc:314
0x83abfc match_mult_operand
        ../../gcc/fortran/matchexp.cc:296
0x83ad98 match_add_operand
        ../../gcc/fortran/matchexp.cc:356
0x83afec match_level_2
        ../../gcc/fortran/matchexp.cc:480
0x83b142 match_level_3
        ../../gcc/fortran/matchexp.cc:551
0x83b234 match_level_4
        ../../gcc/fortran/matchexp.cc:599
0x83b234 match_and_operand
        ../../gcc/fortran/matchexp.cc:693
0x83b422 match_or_operand
        ../../gcc/fortran/matchexp.cc:722
0x83b4f2 match_equiv_operand
        ../../gcc/fortran/matchexp.cc:765
0x83b5c4 match_level_5
        ../../gcc/fortran/matchexp.cc:811
0x83a991 gfc_match_expr(gfc_expr**)
        ../../gcc/fortran/matchexp.cc:870
0x822089 match_io_element
        ../../gcc/fortran/io.cc:3668
0x8249ba match_io_list
        ../../gcc/fortran/io.cc:3716
0x824dbe match_io
        ../../gcc/fortran/io.cc:4394
0x8288ba gfc_match_print()
        ../../gcc/fortran/io.cc:4450
0x85abf1 match_word
        ../../gcc/fortran/parse.cc:67
0x860853 decode_statement
        ../../gcc/fortran/parse.cc:539
0x860c8a next_free
        ../../gcc/fortran/parse.cc:1402
0x860c8a next_statement
        ../../gcc/fortran/parse.cc:1634
0x863414 parse_spec
        ../../gcc/fortran/parse.cc:4006
Comment 1 anlauf 2022-11-22 19:22:43 UTC
Confirmed.

I think this is a dup of pr107721 (lost typespec).
Comment 2 Jerry DeLisle 2023-01-29 21:59:07 UTC
(In reply to anlauf from comment #1)
> Confirmed.
> 
> I think this is a dup of pr107721 (lost typespec).

This variation is a hint:

program p
   print *, [real :: ([3])] ** 2 !0
end

$ gfc z1.f90 
f951: internal compiler error: free_expr0(): Bad expr type
Comment 3 Jerry DeLisle 2023-01-30 00:28:53 UTC
Marking as a duplicate. Side note, the problem goes away when not in a print statement.

*** This bug has been marked as a duplicate of bug 107721 ***