https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77461
Bug ID: 77461 Summary: SUM intrinsic passed array of HUGE values triggers ICE Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: lkrupp at gcc dot gnu.org Target Milestone: --- As seen on comp.lang.fortran, this file: double precision, parameter :: x = huge(1d0) print*, sum((/x,-x/)) print*, sum((/x,x,-x,-x/)) print*, sum((/x,-x,1d0/)) print*, sum((/1d0,x,-x/)) end triggers this ICE: Error: Arithmetic overflow at (1) f951: internal compiler error: Segmentation fault 0xba326f crash_signal ../../gcc_trunk/gcc/toplev.c:336 0x5de47b gfc_zero_size_array ../../gcc_trunk/gcc/fortran/arith.c:1657 0x5de47b reduce_binary0 ../../gcc_trunk/gcc/fortran/arith.c:1671 0x5de47b eval_intrinsic_f3 ../../gcc_trunk/gcc/fortran/arith.c:1720 0x6815eb simplify_transformation_to_scalar ../../gcc_trunk/gcc/fortran/simplify.c:491 0x61d2b1 do_simplify ../../gcc_trunk/gcc/fortran/intrinsic.c:4268 0x626f0b gfc_intrinsic_func_interface(gfc_expr*, int) ../../gcc_trunk/gcc/fortran/intrinsic.c:4617 0x66d72f resolve_unknown_f ../../gcc_trunk/gcc/fortran/resolve.c:2718 0x66d72f resolve_function ../../gcc_trunk/gcc/fortran/resolve.c:3020 0x66d72f gfc_resolve_expr(gfc_expr*) ../../gcc_trunk/gcc/fortran/resolve.c:6356 0x67217d gfc_resolve_code(gfc_code*, gfc_namespace*) ../../gcc_trunk/gcc/fortran/resolve.c:10543 0x671ca3 gfc_resolve_blocks(gfc_code*, gfc_namespace*) ../../gcc_trunk/gcc/fortran/resolve.c:9594 0x672356 gfc_resolve_code(gfc_code*, gfc_namespace*) ../../gcc_trunk/gcc/fortran/resolve.c:10533 0x6746e7 resolve_codes ../../gcc_trunk/gcc/fortran/resolve.c:15681 0x6747ae gfc_resolve(gfc_namespace*) ../../gcc_trunk/gcc/fortran/resolve.c:15716 0x65f754 resolve_all_program_units ../../gcc_trunk/gcc/fortran/parse.c:5875 0x65f754 gfc_parse_file() ../../gcc_trunk/gcc/fortran/parse.c:6127 0x6a1632 gfc_be_parse_file ../../gcc_trunk/gcc/fortran/f95-lang.c:198 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions. gfortran -v reports: Target: x86_64-pc-linux-gnu Configured with: ../gcc_trunk/configure --disable-multilib \ --enable-languages=fortran Thread model: posix gcc version 7.0.0 20160902 (experimental) (GCC)