Bug 66100 - [6 Regression] ICE in simplify_bound
Summary: [6 Regression] ICE in simplify_bound
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 6.0
: P3 normal
Target Milestone: 6.0
Assignee: Mikael Morin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-05-11 05:20 UTC by Joost VandeVondele
Modified: 2015-05-13 09:47 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2015-05-11 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joost VandeVondele 2015-05-11 05:20:31 UTC
> cat bug.f90
MODULE qs_integrate_potential_low
  INTEGER, PARAMETER :: dp = 8
  TYPE cell_type
    REAL(KIND=8) :: h_inv(3,3)
  END TYPE
  TYPE(cell_type), POINTER                 :: cell
  REAL(KIND=dp), DIMENSION(3)              :: rp
  CONTAINS
    SUBROUTINE integrate_general_opt()
    REAL(KIND=dp) :: gp(3)
    INTEGER :: ng
      gp=MATMUL(cell%h_inv,rp)*ng
    END SUBROUTINE integrate_general_opt
END MODULE qs_integrate_potential_low

with 

gcc version 6.0.0 20150511 (experimental) [trunk revision 222989] (GCC) 

> gfortran -O1 bug.f90
f951: internal compiler error: in simplify_bound, at fortran/simplify.c:3467
0x659389 simplify_bound
	../../gcc/gcc/fortran/simplify.c:3463
0x5f7fa1 do_simplify
	../../gcc/gcc/fortran/intrinsic.c:4149
0x605618 gfc_intrinsic_func_interface(gfc_expr*, int)
	../../gcc/gcc/fortran/intrinsic.c:4403
0x5edf62 gfc_simplify_expr(gfc_expr*, int)
	../../gcc/gcc/fortran/expr.c:1837
0x708365 get_array_inq_function
	../../gcc/gcc/fortran/frontend-passes.c:2018
0x70d5a9 scalarized_expr
	../../gcc/gcc/fortran/frontend-passes.c:2657
0x70b8e2 inline_matmul_assign
	../../gcc/gcc/fortran/frontend-passes.c:3000
0x70bde9 gfc_code_walker(gfc_code**, int (*)(gfc_code**, int*, void*), int (*)(gfc_expr**, int*, void*), void*)
	../../gcc/gcc/fortran/frontend-passes.c:3188
0x70ce6b optimize_namespace
	../../gcc/gcc/fortran/frontend-passes.c:989
0x70ce38 optimize_namespace
	../../gcc/gcc/fortran/frontend-passes.c:995
0x70cfc3 gfc_run_passes(gfc_namespace*)
	../../gcc/gcc/fortran/frontend-passes.c:129
0x637bda gfc_parse_file()
	../../gcc/gcc/fortran/parse.c:5477
0x678ef5 gfc_be_parse_file
	../../gcc/gcc/fortran/f95-lang.c:228
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.
Comment 1 Thomas Koenig 2015-05-11 06:55:27 UTC
This is independent of matmul:

MODULE qs_integrate_potential_low
  INTEGER, PARAMETER :: dp = 8
  TYPE cell_type
    REAL(KIND=8) :: h_inv(3,3)
  END TYPE
  TYPE(cell_type), POINTER                 :: cell
  REAL(KIND=dp), DIMENSION(3)              :: rp
  CONTAINS
    SUBROUTINE integrate_general_opt()
    REAL(KIND=dp) :: gp(3)
    INTEGER :: ng
      print *,lbound(cell%h_inv)
    END SUBROUTINE integrate_general_opt
END MODULE qs_integrate_potential_low

This is an assert introduced in r222979.  Removing the assert makes the
code work, at least superficially (it will print out 1,1).

Mikael?
Comment 2 Mikael Morin 2015-05-11 21:04:22 UTC
Author: mikael
Date: Mon May 11 21:03:50 2015
New Revision: 223019

URL: https://gcc.gnu.org/viewcvs?rev=223019&root=gcc&view=rev
Log:
Fix fortran/66100 bound simplification ICE

        PR fortran/66100
gcc/fortran/
        * simplify.c (simplify_bound): Fix assert to accept subobject * arrays.
gcc/testsuite/
        * gfortran.dg/bound_simplification_6.f90: New.


Added:
    trunk/gcc/testsuite/gfortran.dg/bound_simplification_6.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/simplify.c
    trunk/gcc/testsuite/ChangeLog
Comment 3 Mikael Morin 2015-05-13 09:47:11 UTC
This should be fixed.