[Bug fortran/27411] crashes in sra_walk_expr and emit_move_insn (fixed in trunk)
--- Comment #9 from pault at gcc dot gnu dot org 2006-05-28 19:47 --- Subject: Bug 27411 Author: pault Date: Sun May 28 19:46:22 2006 New Revision: 114173 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=114173 Log: 2006-05-28 Paul Thomas [EMAIL PROTECTED] PR fortran/25082 * resolve.c (resolve_code): Add error condition that the return expression must be scalar. PR fortran/27411 * matchexp.c (gfc_get_parentheses): New function. (match_primary): Remove inline code and call above. * gfortran.h: Provide prototype for gfc_get_parentheses. * resolve.c (resolve_array_ref): Call the above, when start is a derived type variable array reference. PR fortran/27613 * primary.c (gfc_match_rvalue): Test if symbol represents a direct recursive function reference. Error if array valued, go to function0 otherwise. PR fortran/25746 * interface.c (gfc_extend_assign): Use new EXEC_ASSIGN_CALL. * gfortran.h : Put EXEC_ASSIGN_CALL in enum. * trans-stmt.c (gfc_conv_elemental_dependencies): New function. (gfc_trans_call): Call it. Add new boolian argument to flag need for dependency checking. Assert intent OUT and IN for arg1 and arg2. (gfc_trans_forall_1): Use new code EXEC_ASSIGN_CALL. trans-stmt.h : Modify prototype of gfc_trans_call. trans.c (gfc_trans_code): Add call for EXEC_ASSIGN_CALL. st.c (gfc_free_statement): Free actual for EXEC_ASSIGN_CALL. * dependency.c (gfc_check_fncall_dependency): Don't check other against itself. PR fortran/27584 * check.c (gfc_check_associated): Replace NULL assert with an error message, since it is possible to generate bad code that has us fall through to here.. PR fortran/19015 * iresolve.c (maxloc, minloc): If DIM is not present, pass the rank of ARRAY as the shape of the result. Otherwise, pass the shape of ARRAY, less the dimension DIM. (maxval, minval): The same, when DIM is present, otherwise no change. PR fortran/27709 * resolve.c (find_array_spec): Add gfc_symbol, derived, and use to track repeated component references. PR fortran/27155 PR fortran/27449 * trans-intrinsic.c (gfc_conv_intrinsic_array_transfer): Use se-string_length throughout and use memcpy to populate the expression returned to the scalarizer. (gfc_size_in_bytes): New function. * trans-intrinsic.c (gfc_conv_associated): If pointer in first arguments has zero array length of zero string length, return false. 2006-05-28 Paul Thomas [EMAIL PROTECTED] PR fortran/25082 * gfortran.dg/scalar_return_1.f90: New test. PR fortran/27411 * gfortran.dg/derived_comp_array_ref_1.f90: New test. PR fortran/25746 * gfortran.dg/elemental_subroutine_3.f90: New test. PR fortran/27584 * gfortran.dg/associated_target_1.f90: New test. PR fortran/19015 * gfortran.dg/maxloc_shape_1.f90: New test. PR fortran/27613 * gfortran.dg/recursive_reference_1.f90: New test. PR fortran/27709 * gfortran.dg/spec_expr_4.f90: New test. PR fortran/27155 * gfortran.dg/transfer_array_intrinsic_4.f90: New test. * gfortran.dg/associated_2.f90: New test. 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/gfortran.h branches/gcc-4_1-branch/gcc/fortran/interface.c branches/gcc-4_1-branch/gcc/fortran/iresolve.c branches/gcc-4_1-branch/gcc/fortran/matchexp.c branches/gcc-4_1-branch/gcc/fortran/primary.c branches/gcc-4_1-branch/gcc/fortran/resolve.c branches/gcc-4_1-branch/gcc/fortran/st.c branches/gcc-4_1-branch/gcc/fortran/trans-intrinsic.c branches/gcc-4_1-branch/gcc/fortran/trans-stmt.c branches/gcc-4_1-branch/gcc/fortran/trans-stmt.h branches/gcc-4_1-branch/gcc/fortran/trans.c branches/gcc-4_1-branch/gcc/testsuite/ChangeLog -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27411
[Bug fortran/27411] crashes in sra_walk_expr and emit_move_insn (fixed in trunk)
--- Comment #10 from pault at gcc dot gnu dot org 2006-05-28 19:51 --- Subject: Bug 27411 Author: pault Date: Sun May 28 19:50:51 2006 New Revision: 114174 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=114174 Log: 2006-05-28 Paul Thomas [EMAIL PROTECTED] PR fortran/25082 * gfortran.dg/scalar_return_1.f90: New test. PR fortran/27411 * gfortran.dg/derived_comp_array_ref_1.f90: New test. PR fortran/25746 * gfortran.dg/elemental_subroutine_3.f90: New test. PR fortran/27584 * gfortran.dg/associated_target_1.f90: New test. PR fortran/19015 * gfortran.dg/maxloc_shape_1.f90: New test. PR fortran/27613 * gfortran.dg/recursive_reference_1.f90: New test. PR fortran/27709 * gfortran.dg/spec_expr_4.f90: New test. PR fortran/27155 * gfortran.dg/transfer_array_intrinsic_4.f90: New test. * gfortran.dg/associated_2.f90: New test. Added: branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/associated_2.f90 branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/associated_target_1.f90 branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/derived_comp_array_ref_1.f90 branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/elemental_subroutine_3.f90 branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/maxloc_shape_1.f90 branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/recursive_reference_1.f90 branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/scalar_return_1.f90 branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/spec_expr_4.f90 branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/transfer_array_intrinsic_4.f90 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27411
[Bug fortran/27411] crashes in sra_walk_expr and emit_move_insn
--- Comment #11 from pault at gcc dot gnu dot org 2006-05-28 19:52 --- Fixed in trunk and 4.1 Paul -- pault at gcc dot gnu dot org changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution||FIXED Summary|crashes in sra_walk_expr and|crashes in sra_walk_expr and |emit_move_insn (fixed in|emit_move_insn |trunk) | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27411
[Bug fortran/27411] crashes in sra_walk_expr and emit_move_insn
--- Comment #5 from reichelt at gcc dot gnu dot org 2006-05-18 10:04 --- Paul, in your patch, you added the wrong PR number (PR24711 instead of PR27411). Would you mind changing the ChangeLog entries? Are you going to fix this bug on the 4.1 branch, too, or can we close the PR? -- reichelt at gcc dot gnu dot org changed: What|Removed |Added CC||reichelt at gcc dot gnu dot ||org AssignedTo|unassigned at gcc dot gnu |pault at gcc dot gnu dot org |dot org | Status|NEW |ASSIGNED http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27411
[Bug fortran/27411] crashes in sra_walk_expr and emit_move_insn
--- Comment #6 from reichelt at gcc dot gnu dot org 2006-05-18 10:08 --- Btw, you also added the wrong PR number for PR 18003 in the ChangeLog entries and the testcase (namely PR18803), would you mind fixing this as well? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27411
[Bug fortran/27411] crashes in sra_walk_expr and emit_move_insn
--- Comment #7 from tobi at gcc dot gnu dot org 2006-05-18 16:36 --- Paul, you didn't ask yourself to the CC lsit, so you missed Volker's comments. -- tobi at gcc dot gnu dot org changed: What|Removed |Added CC||tobi at gcc dot gnu dot org, ||pault at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27411
[Bug fortran/27411] crashes in sra_walk_expr and emit_move_insn
--- Comment #8 from paulthomas2 at wanadoo dot fr 2006-05-18 20:03 --- Subject: Re: crashes in sra_walk_expr and emit_move_insn tobi at gcc dot gnu dot org wrote: --- Comment #7 from tobi at gcc dot gnu dot org 2006-05-18 16:36 --- Paul, you didn't ask yourself to the CC lsit, so you missed Volker's comments. Drat! Thanks Tobi. I'll attend to it asap - probably during the weekend. Thanks to Volker, as well ( as Tobi will testify, I do tend a bit on the careless side) Paul -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27411
[Bug fortran/27411] crashes in sra_walk_expr and emit_move_insn
--- Comment #4 from patchapp at dberlin dot org 2006-05-15 19:35 --- Subject: Bug number PR27411 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-05/msg00252.html -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27411
[Bug fortran/27411] crashes in sra_walk_expr and emit_move_insn
--- Comment #3 from paul dot thomas at jet dot uk 2006-05-05 06:26 --- The patch below fixes the problem by enclosing the expression for the array reference outputs%signal_number in parentheses(You can verify that this does the right thing by doing it explicitly in the fortran.). This turns the temporary, used in the scalarizer loop, from the structure into its integer component, signal_number. I did contemplate doing clever stuff with tree_ssa, a bit further down stream, but this is much simpler and works. I will do all the good things with assigning this PR to myself and submitting the patch, when I am back at base. Richard, which email address do you prefer in the attribution to you, in the testscase? Paul Index: gcc/fortran/matchexp.c === --- gcc/fortran/matchexp.c (révision 113499) +++ gcc/fortran/matchexp.c (copie de travail) @@ -123,6 +123,26 @@ } +/* Call the INTRINSIC_PARENTHESES function. This is both + used explicitly, as below, or by resolve.c to generate + temporaries. */ +gfc_expr * +gfc_get_parentheses (gfc_expr *e) +{ + gfc_expr *e2; + + e2 = gfc_get_expr(); + e2-expr_type = EXPR_OP; + e2-ts = e-ts; + e2-rank = e-rank; + e2-where = e-where; + e2-value.op.operator = INTRINSIC_PARENTHESES; + e2-value.op.op1 = e; + e2-value.op.op2 = NULL; + return e2; +} + + /* Match a primary expression. */ static match @@ -167,19 +187,8 @@ if(!gfc_numeric_ts(e-ts)) *result = e; else -{ - gfc_expr *e2 = gfc_get_expr(); +*result = gfc_get_parentheses (e); - e2-expr_type = EXPR_OP; - e2-ts = e-ts; - e2-rank = e-rank; - e2-where = where; - e2-value.op.operator = INTRINSIC_PARENTHESES; - e2-value.op.op1 = e; - e2-value.op.op2 = NULL; - *result = e2; -} - if (m != MATCH_YES) { gfc_free_expr (*result); Index: gcc/fortran/gfortran.h === --- gcc/fortran/gfortran.h (révision 113499) +++ gcc/fortran/gfortran.h (copie de travail) @@ -1940,6 +1940,9 @@ void gfc_free_data (gfc_data *); void gfc_free_case_list (gfc_case *); +/* matchexp.c -- FIXME too? */ +gfc_expr *gfc_get_parentheses (gfc_expr *); + /* openmp.c */ void gfc_free_omp_clauses (gfc_omp_clauses *); void gfc_resolve_omp_directive (gfc_code *, gfc_namespace *); Index: gcc/fortran/resolve.c === --- gcc/fortran/resolve.c (révision 113499) +++ gcc/fortran/resolve.c (copie de travail) @@ -2284,6 +2284,7 @@ resolve_array_ref (gfc_array_ref * ar) { int i, check_scalar; + gfc_expr *e; for (i = 0; i ar-dimen; i++) { @@ -2295,9 +2296,11 @@ return FAILURE; if (gfc_resolve_index (ar-stride[i], check_scalar) == FAILURE) return FAILURE; + + e = ar-start[i]; if (ar-dimen_type[i] == DIMEN_UNKNOWN) - switch (ar-start[i]-rank) + switch (e-rank) { case 0: ar-dimen_type[i] = DIMEN_ELEMENT; @@ -2305,11 +2308,15 @@ case 1: ar-dimen_type[i] = DIMEN_VECTOR; + if (e-expr_type == EXPR_VARIABLE + e-symtree-n.sym-ts.type == BT_DERIVED) + ar-start[i] = gfc_get_parentheses (e); + break; default: gfc_error (Array index at %L is an array of rank %d, - ar-c_where[i], ar-start[i]-rank); + ar-c_where[i], e-rank); return FAILURE; } } @@ -4363,6 +4370,7 @@ code-loc); break; } + goto call; } -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27411
[Bug fortran/27411] crashes in sra_walk_expr and emit_move_insn
--- Comment #2 from paul dot thomas at jet dot uk 2006-05-04 09:50 --- (In reply to comment #1) Confirmed, this is a front-end issue. we have: struct calc_signal_type D.904; D.904 = (*(struct calc_signal_type[0:] *) outputs-data)[outputs-dim[0].stride * NON_LVALUE_EXPR S.4]; (*D.896)[(NON_LVALUE_EXPR S.4 + D.900) * D.903 + D.897].used = (*used.0)[D.904 * D.902 + D.895]; but really D.904 should be an integer and there should be a COMPONET_REF to signal_number there. The parse tree is ok though: ASSIGN activate_gd_calcs:outputs(FULL) % used activate_gd_calcs:used(activate_gd_calcs:outputs(FULL) % signal_number) So this is a bug in the trans* functions. I am seeing this problem of incorrect casting in several failing testcases for the allocatable component patch that Erik and I are working on. None of them generate the ICE and this has made the problem very hard to pinpoint. For example, several of the varying string testsuite crash because trans-io is being fed characters, when an integer is expected, or a string comparison is producing a pointer to one of the strings, instead of a logical. This case helps a lot. Thanks, Richard. Paul -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27411
[Bug fortran/27411] crashes in sra_walk_expr and emit_move_insn
--- Comment #1 from pinskia at gcc dot gnu dot org 2006-05-04 04:50 --- Confirmed, this is a front-end issue. we have: struct calc_signal_type D.904; D.904 = (*(struct calc_signal_type[0:] *) outputs-data)[outputs-dim[0].stride * NON_LVALUE_EXPR S.4]; (*D.896)[(NON_LVALUE_EXPR S.4 + D.900) * D.903 + D.897].used = (*used.0)[D.904 * D.902 + D.895]; but really D.904 should be an integer and there should be a COMPONET_REF to signal_number there. The parse tree is ok though: ASSIGN activate_gd_calcs:outputs(FULL) % used activate_gd_calcs:used(activate_gd_calcs:outputs(FULL) % signal_number) So this is a bug in the trans* functions. -- pinskia 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-05-04 04:50:51 date|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27411