Bug 83998 - [8 Regression] ICE in gfc_conv_intrinsic_dot_product, at fortran/trans-intrinsic.c:4403
Summary: [8 Regression] ICE in gfc_conv_intrinsic_dot_product, at fortran/trans-intrin...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 8.0
: P4 normal
Target Milestone: 8.0
Assignee: kargls
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-01-23 17:47 UTC by G. Steinmetz
Modified: 2018-01-26 19:34 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2018-01-23 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description G. Steinmetz 2018-01-23 17:47:21 UTC
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
Comment 1 kargls 2018-01-23 23:46:26 UTC
I have a patch.
Comment 2 kargls 2018-01-26 19:33:48 UTC
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
Comment 3 kargls 2018-01-26 19:34:34 UTC
Fixed on trunk.  Thanks for the byg report.