Changed between 20171022 and 20171029 : $ cat z1.f90 program p integer, parameter :: a(0) = 1 print *, dot_product(a, a) end $ gfortran-8-20171022 -static-libgfortran z1.f90 $ a.out 0 $ $ gfortran-8-20180121 -c z1.f90 z1.f90:3:0: print *, dot_product(a, a) internal compiler error: in gfc_conv_intrinsic_dot_product, at fortran/trans-intrinsic.c:4403 0x787a5d gfc_conv_intrinsic_dot_product ../../gcc/fortran/trans-intrinsic.c:4403 0x79affa gfc_conv_intrinsic_function(gfc_se*, gfc_expr*) ../../gcc/fortran/trans-intrinsic.c:8889 0x77ae55 gfc_conv_function_expr ../../gcc/fortran/trans-expr.c:6731 0x77b3f2 gfc_conv_expr(gfc_se*, gfc_expr*) ../../gcc/fortran/trans-expr.c:7863 0x781ab8 gfc_conv_expr_reference(gfc_se*, gfc_expr*) ../../gcc/fortran/trans-expr.c:7998 0x7a1226 gfc_trans_transfer(gfc_code*) ../../gcc/fortran/trans-io.c:2576 0x747d37 trans_code ../../gcc/fortran/trans.c:2028 0x79ecf7 build_dt ../../gcc/fortran/trans-io.c:2028 0x747d57 trans_code ../../gcc/fortran/trans.c:2000 0x76ef29 gfc_generate_function_code(gfc_namespace*) ../../gcc/fortran/trans-decl.c:6451 0x6fecd0 translate_all_program_units ../../gcc/fortran/parse.c:6103 0x6fecd0 gfc_parse_file() ../../gcc/fortran/parse.c:6306 0x74520f gfc_be_parse_file ../../gcc/fortran/f95-lang.c:204
I have a patch.
Author: kargl Date: Fri Jan 26 19:33:16 2018 New Revision: 257104 URL: https://gcc.gnu.org/viewcvs?rev=257104&root=gcc&view=rev Log: 2018-01-26 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/83998 * simplify.c (compute_dot_product): Initialize result to INTEGER(1) 0 or .false. The summation does the correct type conversion. (gfc_simplify_dot_product): Special case zero-sized arrays. 2018-01-26 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/83998 * gfortran.dg/dot_product_4.f90 Added: trunk/gcc/testsuite/gfortran.dg/dot_product_4.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/simplify.c trunk/gcc/testsuite/ChangeLog
Fixed on trunk. Thanks for the byg report.