[Bug fortran/28167] ICE: in fold_binary, at fold-const.c:8239 (temporary character array?)
--- Comment #7 from pault at gcc dot gnu dot org 2006-07-06 15:35 --- Subject: Bug 28167 Author: pault Date: Thu Jul 6 15:35:24 2006 New Revision: 115222 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=115222 Log: 2006-07-06 Paul Thomas [EMAIL PROTECTED] PR fortran/28174 * trans-array.c (gfc_conv_expr_descriptor): When building temp, ensure that the substring reference uses a new charlen. * trans-expr.c (gfc_conv_aliased_arg): Add the formal intent to the argument list, lift the treatment of missing string lengths from the above and implement the use of the intent. (gfc_conv_function_call): Add the extra argument to the call to the above. PR fortran/28167 * trans-array.c (get_array_ctor_var_strlen): Treat a constant substring reference. * array.c (gfc_resolve_character_array_constructor): Remove static attribute and add the gfc_ prefix, make use of element charlens for the expression and pick up constant string lengths for expressions that are not themselves constant. * gfortran.h : resolve_character_array_constructor prototype added. * resolve.c (gfc_resolve_expr): Call resolve_character_array_ constructor again after expanding the constructor, to ensure that the character length is passed to the expression. 2006-07-06 Paul Thomas [EMAIL PROTECTED] PR fortran/28174 * gfortran.dg/actual_array_substr_2.f90: New test. PR fortran/28167 * gfortran.dg/actual_array_constructor_2.f90: New test. Modified: branches/gcc-4_1-branch/gcc/fortran/ChangeLog branches/gcc-4_1-branch/gcc/fortran/array.c branches/gcc-4_1-branch/gcc/fortran/gfortran.h branches/gcc-4_1-branch/gcc/fortran/resolve.c branches/gcc-4_1-branch/gcc/fortran/trans-array.c branches/gcc-4_1-branch/gcc/fortran/trans-expr.c branches/gcc-4_1-branch/gcc/testsuite/ChangeLog -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28167
[Bug fortran/28167] ICE: in fold_binary, at fold-const.c:8239 (temporary character array?)
--- Comment #8 from pault at gcc dot gnu dot org 2006-07-06 15:38 --- Fixed on trunk and 4.1 Paul -- pault at gcc dot gnu dot org changed: What|Removed |Added Status|NEW |RESOLVED Resolution||FIXED http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28167
[Bug fortran/28167] ICE: in fold_binary, at fold-const.c:8239 (temporary character array?)
--- Comment #5 from pault at gcc dot gnu dot org 2006-07-04 20:16 --- Subject: Bug 28167 Author: pault Date: Tue Jul 4 20:15:52 2006 New Revision: 115182 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=115182 Log: 2006-07-04 Paul Thomas [EMAIL PROTECTED] PR fortran/28174 * trans-array.c (gfc_conv_expr_descriptor): When building temp, ensure that the substring reference uses a new charlen. * trans-expr.c (gfc_conv_aliased_arg): Add the formal intent to the argument list, lift the treatment of missing string lengths from the above and implement the use of the intent. (gfc_conv_function_call): Add the extra argument to the call to the above. PR fortran/28167 * trans-array.c (get_array_ctor_var_strlen): Treat a constant substring reference. * array.c (gfc_resolve_character_array_constructor): Remove static attribute and add the gfc_ prefix, make use of element charlens for the expression and pick up constant string lengths for expressions that are not themselves constant. * gfortran.h : resolve_character_array_constructor prototype added. * resolve.c (gfc_resolve_expr): Call resolve_character_array_ constructor again after expanding the constructor, to ensure that the character length is passed to the expression. 2006-07-04 Paul Thomas [EMAIL PROTECTED] PR fortran/28174 * gfortran.dg/actual_array_substr_2.f90: New test. PR fortran/28167 * gfortran.dg/actual_array_constructor_2.f90: New test. Added: trunk/gcc/testsuite/gfortran.dg/actual_array_constructor_2.f90 trunk/gcc/testsuite/gfortran.dg/actual_array_substr_2.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/array.c trunk/gcc/fortran/gfortran.h trunk/gcc/fortran/resolve.c trunk/gcc/fortran/trans-array.c trunk/gcc/fortran/trans-expr.c -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28167
[Bug fortran/28167] ICE: in fold_binary, at fold-const.c:8239 (temporary character array?)
--- Comment #6 from pault at gcc dot gnu dot org 2006-07-04 20:36 --- Subject: Bug 28167 Author: pault Date: Tue Jul 4 20:36:15 2006 New Revision: 115187 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=115187 Log: 2006-07-04 Paul Thomas [EMAIL PROTECTED] PR fortran/28174 * gfortran.dg/actual_array_substr_2.f90: New test. PR fortran/28167 * gfortran.dg/actual_array_constructor_2.f90: New test. Modified: trunk/gcc/testsuite/ChangeLog -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28167
[Bug fortran/28167] ICE: in fold_binary, at fold-const.c:8239 (temporary character array?)
--- Comment #4 from pault at gcc dot gnu dot org 2006-06-28 22:00 --- Created an attachment (id=11776) -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=11776action=view) Fixes the problem and some The attached patch fixes the PR and fixes character valued functions in array constructors. This works: character(4), dimension(4) :: c1, c2 integer m m = 4 ! Test the original problem call foo ((/( 'a',i=1,m )/), c2) if (any(c2(:)(1:1) .ne. (/'a','a','a','a'/))) call abort () ! Now get a bit smarter call foo ((/abcd, efgh, ijkl, mnop/), c1) ! worked before call foo ((/(c1(i), i = m,1,-1)/), c2)! was broken if (any(c2(4:1:-1) .ne. c1)) call abort () ! gfc_todo: Not Implemented: complex character array constructors ! call foo ((/(c1(i)(2:3), i = 1,4)/), c2) ! Check functions in the constructor call foo ((/(achar(64+i)//achar(68+i)//achar(72+i)// achar(76+i),i=1,4 )/), c1) ! was broken if (any (c1 .ne. (/AEIM,BFJN,CGKO,DHLP/))) call abort () contains subroutine foo (chr1, chr2) character(*), dimension(:) :: chr1, chr2 chr2 = chr1 end subroutine foo end Paul PS Do not worry - I had not forgotten PR28174! -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28167
[Bug fortran/28167] ICE: in fold_binary, at fold-const.c:8239 (temporary character array?)
--- Comment #3 from paul dot richard dot thomas at cea dot fr 2006-06-27 14:17 --- I believe that a frontend problem is involved, even if it is only part of the story. This exhibits the same symptoms as Harald's testcase: call foo ( (/( 'a',i=1,2 )/) ) end but this works fine: call foo ( (/'a', 'b'/) ) end Both expand the constructor just fine. However the second makes just one call to resolve_expr and leaves with a value for the string length. The first calls resolve_expr twice and has lost the string length between the first and second calls. I am blowed if I can see where this happens for the moment but I am looking furiously! Paul -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28167
[Bug fortran/28167] ICE: in fold_binary, at fold-const.c:8239 (temporary character array?)
--- Comment #1 from anlauf at gmx dot de 2006-06-26 07:53 --- Created an attachment (id=11755) -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=11755action=view) Testcase -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28167
[Bug fortran/28167] ICE: in fold_binary, at fold-const.c:8239 (temporary character array?)
--- Comment #2 from rguenth at gcc dot gnu dot org 2006-06-26 08:24 --- Confirmed. We end up in gfc_trans_create_temp_array size = fold_build2 (MULT_EXPR, gfc_array_index_type, size, TYPE_SIZE_UNIT (gfc_get_element_type (type))); with type being a record type 'struct array1_unknown', so TYPE_SIZE_UNIT (gfc_get_element_type (type)) returns zero. gfc_get_element_type (type) returns charD.14[1:] (!??), so maybe the fix is to use TYPE_SIZE_UNIT (TREE_TYPE (... ))) here. (This doesn't fix it, we also pass size == 0 to the MULT_EXPR, so we'll end up with a size of zero here) So maybe the bug is that size and nelem are both zero... who knows ;) -- rguenth at gcc dot gnu dot org changed: What|Removed |Added Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Keywords||ice-on-valid-code Last reconfirmed|-00-00 00:00:00 |2006-06-26 08:24:32 date|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28167