Hi, the following code crashes gfortran: program gfcbug21 implicit none type t integer :: i end type t type (t), parameter :: u = t (1) integer, parameter :: idx_list(1) = (/ 1 /) ! gfortran dies here: integer :: j(1) = transfer (u, idx_list) print *, j end program gfcbug21 I get: gfcbug21.f90: In function 'MAIN__': gfcbug21.f90:10: internal compiler error: in gfc_conv_array_initializer, at fortran/trans-array.c:2946 (For the record: this works with Intel's ifc 7.1 but crashes ifort 8.1) Cheers, -ha
Confirmed. Maybe related to PR15975.
Fixed for 4.0.0.
Woops I must have used the wrong file to test with.
Related to PR 17298.
The problem here is that we did not reduce transfer to a constant. Hmm, the problem is fully transfer which is why this fully related to PR 17298. Looks like we don't currently handle transfer that well.
transfer could be converted over to use VIEW_CONVERT_EXPR of the constant but then again this is in non trans part of the fortran front-end.
Harald, The date at which you submitted this is an insult to my sensibilities; I hope that you appreciate the progress that we have made elsewhere and forgive us slowness in responding to this? That said, I have been trying to bring initializers up the the 19th century, at least, and TRANSFER is the only missing transformational function. So, I will do what a man has to do and will square up the the grind of writing gfc_simplify_transfer. I might be a little while..... Paul
Subject: Bug 18769 Author: pault Date: Tue Jun 20 04:30:48 2006 New Revision: 114802 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=114802 Log: 2006-06-20 Paul Thomas <pault@gcc.gnu.org> PR fortran/25049 PR fortran/25050 * check.c (non_init_transformational): New function. (find_substring_ref): New function to signal use of disallowed transformational intrinsic in an initialization expression. (gfc_check_all_any): Call previous if initialization expr. (gfc_check_count): The same. (gfc_check_cshift): The same. (gfc_check_dot_product): The same. (gfc_check_eoshift): The same. (gfc_check_minloc_maxloc): The same. (gfc_check_minval_maxval): The same. (gfc_check_gfc_check_product_sum): The same. (gfc_check_pack): The same. (gfc_check_spread): The same. (gfc_check_transpose): The same. (gfc_check_unpack): The same. PR fortran/18769 *intrinsic.c (add_functions): Add gfc_simplify_transfer. *intrinsic.h : Add prototype for gfc_simplify_transfer. *simplify.c (gfc_simplify_transfer) : New function to act as placeholder for eventual implementation. Emit error for now. PR fortran/16206 * expr.c (find_array_element): Eliminate condition on length of offset. Add bounds checking. Rearrange exit. Return try and put gfc_constructor result as an argument. (find_array_section): New function. (find_substring_ref): New function. (simplify_const_ref): Add calls to previous. (simplify_parameter_variable): Return on NULL expr. (gfc_simplify_expr): Only call gfc_expand_constructor for full arrays. PR fortran/20876 * match.c (gfc_match_forall): Add missing locus to gfc_code. 2006-06-20 Paul Thomas <pault@gcc.gnu.org> PR libfortran/28005 * m4/matmul.m4: aystride = 1 does not uniquely detect the presence of a temporary transpose; an array element in the first dimension produces the same signature. Detect this using the rank of a and add specific code. * generated/matmul_r4.c: Regenerate. * generated/matmul_r8.c: Regenerate. * generated/matmul_r10.c: Regenerate. * generated/matmul_r16.c: Regenerate. * generated/matmul_c4.c: Regenerate. * generated/matmul_c8.c: Regenerate. * generated/matmul_c10.c: Regenerate. * generated/matmul_c16.c: Regenerate. * generated/matmul_i4.c: Regenerate. * generated/matmul_i8.c: Regenerate. * generated/matmul_i16.c: Regenerate. 2006-06-20 Paul Thomas <pault@gcc.gnu.org> PR fortran/16206 * gfortran.dg/array_initializer_1.f90: New test. PR fortran/28005 * gfortran.dg/matmul_3.f90: New test. Added: trunk/gcc/testsuite/gfortran.dg/array_initializer_1.f90 trunk/gcc/testsuite/gfortran.dg/matmul_3.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/check.c trunk/gcc/fortran/expr.c trunk/gcc/fortran/intrinsic.c trunk/gcc/fortran/intrinsic.h trunk/gcc/fortran/match.c trunk/gcc/fortran/simplify.c trunk/gcc/testsuite/ChangeLog trunk/libgfortran/ChangeLog trunk/libgfortran/generated/matmul_c10.c trunk/libgfortran/generated/matmul_c16.c trunk/libgfortran/generated/matmul_c4.c trunk/libgfortran/generated/matmul_c8.c trunk/libgfortran/generated/matmul_i16.c trunk/libgfortran/generated/matmul_i4.c trunk/libgfortran/generated/matmul_i8.c trunk/libgfortran/generated/matmul_r10.c trunk/libgfortran/generated/matmul_r16.c trunk/libgfortran/generated/matmul_r4.c trunk/libgfortran/generated/matmul_r8.c trunk/libgfortran/m4/matmul.m4
Subject: Bug 18769 Author: pault Date: Fri Jun 23 04:46:50 2006 New Revision: 114925 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=114925 Log: 2006-06-23 Paul Thomas <pault@gcc.gnu.org> PR fortran/25049 PR fortran/25050 * check.c (non_init_transformational): New function. (find_substring_ref): New function to signal use of disallowed transformational intrinsic in an initialization expression. (gfc_check_all_any): Call previous if initialization expr. (gfc_check_count): The same. (gfc_check_cshift): The same. (gfc_check_dot_product): The same. (gfc_check_eoshift): The same. (gfc_check_minloc_maxloc): The same. (gfc_check_minval_maxval): The same. (gfc_check_gfc_check_product_sum): The same. (gfc_check_pack): The same. (gfc_check_spread): The same. (gfc_check_transpose): The same. (gfc_check_unpack): The same. PR fortran/18769 *intrinsic.c (add_functions): Add gfc_simplify_transfer. *intrinsic.h : Add prototype for gfc_simplify_transfer. *simplify.c (gfc_simplify_transfer) : New function to act as placeholder for eventual implementation. Emit error for now. PR fortran/16206 * expr.c (find_array_element): Eliminate condition on length of offset. Add bounds checking. Rearrange exit. Return try and put gfc_constructor result as an argument. (find_array_section): New function. (find_substring_ref): New function. (simplify_const_ref): Add calls to previous. (simplify_parameter_variable): Return on NULL expr. (gfc_simplify_expr): Only call gfc_expand_constructor for full arrays. PR fortran/20876 * match.c (gfc_match_forall): Add missing locus to gfc_code. 2006-06-23 Paul Thomas <pault@gcc.gnu.org> PR fortran/16206 * gfortran.dg/array_initializer_1.f90: New test. Added: branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/array_initializer_1.f90 Modified: branches/gcc-4_1-branch/gcc/fortran/ChangeLog branches/gcc-4_1-branch/gcc/fortran/check.c branches/gcc-4_1-branch/gcc/fortran/expr.c branches/gcc-4_1-branch/gcc/fortran/intrinsic.c branches/gcc-4_1-branch/gcc/fortran/intrinsic.h branches/gcc-4_1-branch/gcc/fortran/match.c branches/gcc-4_1-branch/gcc/fortran/simplify.c branches/gcc-4_1-branch/gcc/testsuite/ChangeLog
Now for the hard work of writing simplify_transfer! Paul
Subject: Bug number PR18769 A patch for this bug has been added to the patch tracker. The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2006-06/msg00934.html
Paul, should this be closed?
Jerry, See comment #10. The 'problem' is to take the gmp/mpfr representations of the values in the constructor expression, write them out to form the source, read then back in binary as the destination, convert the array into gmp/mpfr values and pop the values into a constructor array. It is actually simple enough but tedious; with one thing or another I have not gotten round to it. One of the key points will be to get the numeric representation right, so bits will have to be borrowed from all over (arith.c? trans-xxx.c?) to get the gmp/mpfr to the gfc type+kind's and back again. I was sort of hoping that Steve would take an interest because he is exceeding clued up on such matters. However, he and I both have been busy. *sigh* If you want to be guided.... you would be very welcome. Paul
Oh, It was comment 11 that threw me off. Thats why I asked. Let me think about takingthis on before I do so.
Jerry, I was not entirely serious - if you want to take it on, great, but... it's a pain in the beeehind! Paul
I was just looking at the gfc_simplify_transfer function, and it appears it isn't called for the original test program. Any idea why?
Subject: Bug 18769 Author: pault Date: Wed May 16 05:40:51 2007 New Revision: 124759 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=124759 Log: 2007-05-16 Brooks Moses <brooks.moses@codesourcery.com> PR fortran/18769 PR fortran/30881 PR fortran/31194 PR fortran/31216 PR fortran/31427 * target-memory.c: New file. * target-memory.h: New file. * simplify.c: Add #include "target-memory.h". (gfc_simplify_transfer): Implement constant- folding for TRANSFER intrinsic. * Make-lang.in: Add dependencies on new target-memory.* files. 2007-05-16 Paul Thomas <pault@gcc.gnu.org> PR fortran/18769 PR fortran/30881 PR fortran/31194 PR fortran/31216 PR fortran/31427 * transfer_simplify_1.f90: New test. * transfer_simplify_2.f90: New test. Added: trunk/gcc/fortran/target-memory.c trunk/gcc/fortran/target-memory.h trunk/gcc/testsuite/gfortran.dg/transfer_simplify_1.f90 trunk/gcc/testsuite/gfortran.dg/transfer_simplify_2.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/Make-lang.in trunk/gcc/fortran/simplify.c trunk/gcc/testsuite/ChangeLog
Fixed on trunk Paul and Brooks