current trunk : gfortran -c -O0 test.f90 test.f90: In function ‘pw_integral_a2b’: test.f90:251: internal compiler error: in gfc_conv_variable, at fortran/trans-expr.c:386 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions.
Created attachment 13664 [details] testcase
This blocks CP2K (PR 29975)
Confirmed on i686-darwin. I'll look into it during the week-end if noone beats me to it.
Reduced: MODULE kahan_sum INTEGER, PARAMETER :: dp=KIND(0.0D0) INTERFACE accurate_sum MODULE PROCEDURE kahan_sum_d1, kahan_sum_z1 END INTERFACE accurate_sum TYPE pw_grid_type REAL (KIND=dp), DIMENSION ( : ), POINTER :: gsq END TYPE pw_grid_type TYPE pw_type REAL (KIND=dp), DIMENSION ( : ), POINTER :: cr COMPLEX (KIND=dp), DIMENSION ( : ), POINTER :: cc TYPE ( pw_grid_type ), POINTER :: pw_grid END TYPE pw_type CONTAINS FUNCTION kahan_sum_d1(array,mask) RESULT(ks) REAL(KIND=dp), DIMENSION(:), INTENT(IN) :: array LOGICAL, DIMENSION(:), INTENT(IN), & OPTIONAL :: mask REAL(KIND=dp) :: ks END FUNCTION kahan_sum_d1 FUNCTION kahan_sum_z1(array,mask) RESULT(ks) COMPLEX(KIND=dp), DIMENSION(:), & INTENT(IN) :: array LOGICAL, DIMENSION(:), INTENT(IN), & OPTIONAL :: mask COMPLEX(KIND=dp) :: ks END FUNCTION kahan_sum_z1 FUNCTION pw_integral_a2b ( pw1, pw2 ) RESULT ( integral_value ) TYPE(pw_type), INTENT(IN) :: pw1, pw2 REAL(KIND=dp) :: integral_value integral_value = accurate_sum ( REAL ( CONJG ( pw1 % cc ( : ) ) & * pw2 % cc ( : ) ,KIND=dp) * pw1 % pw_grid % gsq ( : ) ) END FUNCTION pw_integral_a2b END MODULE
I believe that this is also caused by r125316. Paul
Patch reverted until Lee comes back, PR assigned to him.
Lee has submitted a new version of his patch, taking into account that testcase (and adding it to the testsuite). Thus, closing the bug.
Subject: Bug 32242 Author: lmillward Date: Mon Jul 16 19:12:44 2007 New Revision: 126689 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=126689 Log: PR fortran/32222 PR fortran/32238 PR fortran/32242 * trans-intrinsic.c (gfc_conv_intrinsic_function_args): Adjust to operate on a stack allocated array for the intrinsic arguments instead of creating a TREE_LIST. Add two new parameters for the array and the number of elements. Update all callers to allocate an array of the correct length to pass in. Update comment. (gfc_intrinsic_argument_list_length): New function. (gfc_conv_intrinsic_conversion): Call it. (gfc_conv_intrinsic_mnimax): Likewise. (gfc_conv_intrinsic_merge): Likewise. (gfc_conv_intrinsic_lib_function): Call it. Use new CALL_EXPR constructors. (gfc_conv_intrinsic_cmplx): Likewise. (gfc_conv_intrinsic_ctime): Likewise. (gfc_covn_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_ishftc): Likewise. (gfc_conv_intrinsic_index): Likewise. (gfc_conv_intrinsic_scan): Likewise. (gfc_conv_intrinsic_verify): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_aint): Use new CALL_EXPR constructors. (gfc_conv_intrinsic_exponent): Likewise. (gfc_conv_intrinsic_bound): Likewise. (gfc_conv_intrinsic_abs): Likewise. (gfc_conv_intrinsic_mod): Likewise. (gfc_conv_intrinsic_sign): Likewise. (gfc_conv_intrinsic_len): Likewise. (gfc_conv_intrinsic_adjust): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. * gfortran.dg/cmplx_intrinsic_1.f90: New test. PR fortran/32238 * gfortran.dg/pr32238.f90: New test. PR fortran/32222 * gfortran.dg/pr32222.f90: New test. PR fortran/32242 * gfortran.dg/pr32242.f90: New test. Added: trunk/gcc/testsuite/gfortran.dg/cmplx_intrinsic_1.f90 trunk/gcc/testsuite/gfortran.dg/pr32222.f90 trunk/gcc/testsuite/gfortran.dg/pr32238.f90 trunk/gcc/testsuite/gfortran.dg/pr32242.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/trans-intrinsic.c trunk/gcc/testsuite/ChangeLog