aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/dependency.c
AgeCommit message (Collapse)AuthorFilesLines
2006-12-21re PR fortran/30273 ([4.1 only] gfc_todo: Not Implemented: Unable to ↵Paul Thomas1-0/+1
determine rank of expression) 2006-12-21 Paul Thomas <pault@gcc.gnu.org> PR fortran/30273 * dependency.c (gfc_check_dependency): There is no dependency with EXPR_NULL so always return 0. 2006-12-21 Paul Thomas <pault@gcc.gnu.org> PR fortran/30273 * gfortran.dg/dependency_19.f90: New test. From-SVN: r120117
2006-12-17re PR fortran/30207 (ICE in gfc_dep_resolver with where (a < 0) a(:) = 1)Roger Sayle1-0/+53
2006-12-17 Roger Sayle <roger@eyesopen.com> Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/30207 * dependency.c (gfc_full_array_ref_p): New function to test whether the given array ref specifies the entire array. (gfc_dep_resolver): Use gfc_full_array_ref_p to analyze AR_FULL array refs against AR_SECTION array refs, and vice versa. * dependency.h (gfc_full_array_ref_p): Prototype here. * trans-array.c (gfc_conv_expr_descriptor): Use gfc_full_array_ref_p. * gfortran.fortran-torture/execute/where21.f90: New test. From-SVN: r119990
2006-05-21re PR fortran/25746 (Elemental assignment gives wrong result)Paul Thomas1-0/+4
2006-05-21 Paul Thomas <pault@gcc.gnu.org> PR fortran/25746 * interface.c (gfc_extend_assign): Use new code 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/25090 * resolve.c : Remove resolving_index_expr. (entry_parameter): Remove. (gfc_resolve_expr, resolve_charlen, resolve_fl_variable): Remove calls to entry_parameter and references to resolving_index_expr. 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. 2006-05-21 Paul Thomas <pault@gcc.gnu.org> PR fortran/25746 * gfortran.dg/elemental_subroutine_3.f90: New test. PR fortran/25090 * gfortran.dg/entry_dummy_ref_1.f90: Remove. PR fortran/27584 * gfortran.dg/associated_target_1.f90: New test. PR fortran/19015 * gfortran.dg/maxloc_shape_1.f90: New test. From-SVN: r113949
2006-04-06dependency.c (get_no_elements): Delete function.Roger Sayle1-121/+129
* dependency.c (get_no_elements): Delete function. (get_deps): Delete function. (transform_sections): Delete function. (gfc_check_section_vs_section): Significant rewrite. * gfortran.dg/dependency_18.f90: New test case. From-SVN: r112731
2006-04-01dependency.c (gfc_is_inside_range): Delete.Roger Sayle1-46/+101
* dependency.c (gfc_is_inside_range): Delete. (gfc_check_element_vs_section): Significant rewrite. * gfortran.dg/dependencency_17.f90: New test case. From-SVN: r112607
2006-04-01dependency.c (gfc_dep_compare_expr): Strip parentheses and unary plus ↵Roger Sayle1-14/+131
operators when comparing expressions. * dependency.c (gfc_dep_compare_expr): Strip parentheses and unary plus operators when comparing expressions. Handle comparisons of the form "X+C vs. X", "X vs. X+C", "X-C vs. X" and "X vs. X-C" where C is an integer constant. Handle comparisons of the form "P+Q vs. R+S" and "P-Q vs. R-S". Handle comparisons of integral extensions specially (increasing functions) so extend(A) > extend(B), when A>B. (gfc_check_element_vs_element): Move test later, so that we ignore the fact that "A < B" or "A > B" when A or B contains a forall index. * gfortran.dg/dependency_14.f90: New test case. * gfortran.dg/dependency_15.f90: Likewise. * gfortran.dg/dependency_16.f90: Likewise. From-SVN: r112605
2006-03-25dependency.c (gfc_check_dependency): Improve handling of pointers...Roger Sayle1-20/+34
* dependency.c (gfc_check_dependency): Improve handling of pointers; Two variables of different types can't have a dependency, and two variables with the same symbol are equal, even if pointers. * gfortran.dg/dependency_12.f90: New test case. From-SVN: r112377
2006-03-25gfortran.h (gfc_symbol): Add a new "forall_index" bit field.Roger Sayle1-2/+94
* gfortran.h (gfc_symbol): Add a new "forall_index" bit field. * match.c (match_forall_iterator): Set forall_index field on the iteration variable's symbol. * dependency.c (contains_forall_index_p): New function to traverse a gfc_expr to check whether it contains a variable with forall_index set in it's symbol. (gfc_check_element_vs_element): Return GFC_DEP_EQUAL for scalar constant expressions that don't variables used as FORALL indices. * gfortran.dg/dependency_9.f90: New (resurected) test case. From-SVN: r112373
2006-03-17gfortran.h (gfc_equiv_info): Add length field.Roger Sayle1-8/+30
* gfortran.h (gfc_equiv_info): Add length field. * trans-common.c (copy_equiv_list_to_ns): Set the length field. * dependency.c (gfc_are_equivalenced_arrays): Use both the offset and length fields to determine whether the two equivalenced symbols overlap in memory. * gfortran.dg/dependency_13.f90: New test case. From-SVN: r112162
2006-03-11dependency.c (gfc_dep_compare_expr): Allow unary and binary operators to ↵Roger Sayle1-0/+51
compare equal if their operands are equal. * dependency.c (gfc_dep_compare_expr) <EXPR_OP>: Allow unary and binary operators to compare equal if their operands are equal. <EXPR_FUNCTION>: Allow "constant" intrinsic conversion functions to compare equal, if their operands are equal. * gfortran.dg/dependency_10.f90: New test case. * gfortran.dg/dependency_11.f90: Likewise. From-SVN: r111970
2006-03-04dependency.c (gfc_check_element_vs_element): Revert last change.Roger Sayle1-7/+1
* dependency.c (gfc_check_element_vs_element): Revert last change. * gfortran.dg/dependency_9.f90: Remove for the time being. From-SVN: r111703
2006-03-03dependency.c (gfc_check_element_vs_element): Consider two unordered scalar ↵Roger Sayle1-1/+7
subscripts as (potentially) equal. * dependency.c (gfc_check_element_vs_element): Consider two unordered scalar subscripts as (potentially) equal. * gfortran.dg/dependency_9.f90: New test case. From-SVN: r111687
2006-03-03dependency.c (gfc_check_dependency): Call gfc_dep_resolver to check whether ↵Roger Sayle1-30/+20
two array references have a dependency. * dependency.c (gfc_check_dependency): Call gfc_dep_resolver to check whether two array references have a dependency. (gfc_check_element_vs_element): Assume lref and rref must be REF_ARRAYs. If gfc_dep_compare_expr returns -2, assume these references could potentially overlap. (gfc_dep_resolver): Whitespace and comment tweaks. Assume a dependency if the references have different depths. Rewrite final term to clarrify we only have a dependency for overlaps. * gfortran.dg/dependency_4.f90: New test case. * gfortran.dg/dependency_5.f90: New test case. * gfortran.dg/dependency_6.f90: New test case. * gfortran.dg/dependency_7.f90: New test case. * gfortran.dg/dependency_8.f90: New test case. From-SVN: r111686
2006-03-01re PR fortran/26393 (ICE with function returning variable lenght array)Paul Thomas1-0/+49
2006-03-01 Paul Thomas <pault@gcc.gnu.org> * iresolve.c (gfc_resolve_dot_product): Remove any difference in treatment of logical types. * trans-intrinsic.c (gfc_conv_intrinsic_dot_product): New function. PR fortran/26393 * trans-decl.c (gfc_get_symbol_decl): Extend condition that symbols must be referenced to include unreferenced symbols in an interface body. PR fortran/20938 * trans-array.c (gfc_conv_resolve_dependencies): Add call to gfc_are_equivalenced_arrays. * symbol.c (gfc_free_equiv_infos, gfc_free_equiv_lists): New functions. (gfc_free_namespace): Call them. * trans-common.c (copy_equiv_list_to_ns): New function. (add_equivalences): Call it. * gfortran.h: Add equiv_lists to gfc_namespace and define gfc_equiv_list and gfc_equiv_info. * dependency.c (gfc_are_equivalenced_arrays): New function. (gfc_check_dependency): Call it. * dependency.h: Prototype for gfc_are_equivalenced_arrays. 2006-03-01 Paul Thomas <pault@gcc.gnu.org> * gfortran.dg/logical_dot_product.f90: New test. PR fortran/26393 * gfortran.dg/used_interface_ref.f90: New test. PR fortran/20938 * gfortran.dg/dependency_2.f90: New test. * gfortran.fortran-torture/execute/where17.f90: New test. * gfortran.fortran-torture/execute/where18.f90: New test. * gfortran.fortran-torture/execute/where19.f90: New test. * gfortran.fortran-torture/execute/where20.f90: New test. From-SVN: r111616
2006-03-01dependency.c (gfc_is_same_range): Compare the stride...Roger Sayle1-23/+45
* dependency.c (gfc_is_same_range): Compare the stride, lower and upper bounds when testing array reference ranges for equality. (gfc_check_dependency): Fix indentation whitespace. (gfc_check_element_vs_element): Likewise. (gfc_dep_resolver): Likewise. From-SVN: r111601
2006-02-24re PR fortran/24519 (gfortran slow because of incomplete dependency checking)Paul Thomas1-4/+8
2006-02-24 Paul Thomas <pault@gcc.gnu.org> PR fortran/24519 * dependency.c (gfc_is_same_range): Correct typo. (gfc_check_section_vs_section): Call gfc_is_same_range. PR fortran/25395 * trans-common.c (add_equivalences): Add a new flag that is set when an equivalence is seen that prevents more from being reset until the start of a new traversal of the list, thus ensuring completion of all the equivalences. 2006-02-24 Paul Thomas <pault@gcc.gnu.org> PR fortran/24519 * gfortran.dg/dependency_3.f90: New test. * gfortran.fortran-torture/execute/vect-3.f90: Remove two of the XFAILs. PR fortran/25395 * gfortran.dg/equiv_6.f90: New test. From-SVN: r111416
2006-02-05dependency.c (gfc_check_dependency): Remove unused vars and nvars arguments.Roger Sayle1-16/+25
* dependency.c (gfc_check_dependency): Remove unused vars and nvars arguments. Replace with an "identical" argument. A full array reference to the same symbol is a dependency if identical is true. * dependency.h (gfc_check_dependency): Update prototype. * trans-array.h (gfc_check_dependency): Delete duplicate prototype. * trans-stmt.c: #include dependency.h for gfc_check_dependency. (gfc_trans_forall_1): Update calls to gfc_check_dependency. (gfc_trans_where_2): Likewise. Remove unneeded variables. (gfc_trans_where_3): New function for simple non-dependent WHEREs. (gfc_trans_where): Call gfc_trans_where_3 to translate simple F90-style WHERE statements without internal dependencies. * Make-lang.in (trans-stmt.o): Depend upon dependency.h. From-SVN: r110625
2005-12-16dependency.c, [...]: Fix comment typos.Kazu Hirata1-1/+1
* dependency.c, resolve.c, trans-array.c: Fix comment typos. * gfortran.texi: Fix typos. From-SVN: r108624
2005-12-13Make-lang.in (fortran/trans-resolve.o): Depend on fortran/dependency.h.Richard Sandiford1-28/+104
gcc/fortran/ * Make-lang.in (fortran/trans-resolve.o): Depend on fortran/dependency.h. * gfortran.h (gfc_expr): Add an "inline_noncopying_intrinsic" flag. * dependency.h (gfc_get_noncopying_intrinsic_argument): Declare. (gfc_check_fncall_dependency): Change prototype. * dependency.c (gfc_get_noncopying_intrinsic_argument): New function. (gfc_check_argument_var_dependency): New function, split from gfc_check_fncall_dependency. (gfc_check_argument_dependency): New function. (gfc_check_fncall_dependency): Replace the expression parameter with separate symbol and argument list parameters. Generalize the function to handle dependencies for any type of expression, not just variables. Accept a further argument giving the intent of the expression being tested. Ignore intent(in) arguments if that expression is also intent(in). * resolve.c: Include dependency.h. (find_noncopying_intrinsics): New function. (resolve_function, resolve_call): Call it on success. * trans-array.h (gfc_conv_array_transpose): Declare. (gfc_check_fncall_dependency): Remove prototype. * trans-array.c (gfc_conv_array_transpose): New function. * trans-intrinsic.c (gfc_conv_intrinsic_function): Don't use the libcall handling if the expression is to be evaluated inline. Add a case for handling inline transpose()s. * trans-expr.c (gfc_trans_arrayfunc_assign): Adjust for the new interface provided by gfc_check_fncall_dependency. libgfortran/ * m4/matmul.m4: Use a different order in the special case of a transposed first argument. * generated/matmul_c4.c, generated/matmul_c8.c, generated/matmul_c10.c, * generated/matmul_c16.c, generated/matmul_i4.c, generated/matmul_i8.c, * generated/matmul_i10.c, generated/matmul_r4.c, generated/matmul_r8.c * generated/matmul_r10.c, generated/matmul_r16.c: Regenerated. Co-Authored-By: Victor Leikehman <LEI@il.ibm.com> From-SVN: r108459
2005-09-16re PR fortran/23906 (inappropriate branch condition in function ↵Paul Brook1-2/+2
"transform_sections" in "dependency.c") 2005-09-16 Paul Brook <paul@codesourcery.com> PR fortran/23906 fortran/ * dependency.c (transform_sections): Divide by correct value. Elaborate comment. testsuite/ * gfortran.dg/dependency_1.f90: New test. From-SVN: r104339
2005-09-09re PR fortran/19239 ([4.0 only] gfortran ICE on vector subscript expressions)Richard Sandiford1-27/+41
PR fortran/19239 * Makefile.in (fortran/trans-expr.o): Depend on dependency.h. * dependency.h (gfc_ref_needs_temporary_p): Declare. * dependency.c (gfc_ref_needs_temporary_p): New function. (gfc_check_fncall_dependency): Use it instead of inlined check. By so doing, take advantage of the fact that character substrings within an array reference also need a temporary. * trans.h (GFC_SS_VECTOR): Adjust comment. * trans-array.c (gfc_free_ss): Remove GFC_SS_VECTOR case. (gfc_set_vector_loop_bounds): New function. (gfc_add_loop_ss_code): Call it after evaluating the subscripts of a GFC_SS_SECTION. Deal with the GFC_SS_VECTOR case by evaluating the vector expression and caching its descriptor for use within the loop. (gfc_conv_array_index_ref, gfc_conv_vector_array_index): Delete. (gfc_conv_array_index_offset): Handle scalar, vector and range dimensions as separate cases of a switch statement. In the vector case, use the loop variable to calculate a vector index and use the referenced element as the dimension's index. Perform bounds checking on this final index. (gfc_conv_section_upper_bound): Return null for vector indexes. (gfc_conv_section_startstride): Give vector indexes a start value of 0 and a stride of 1. (gfc_conv_ss_startstride): Adjust for new GFC_SS_VECTOR representation. (gfc_conv_expr_descriptor): Expand comments. Generalize the handling of the !want_pointer && !direct_byref case. Use gfc_ref_needs_temporary_p to decide whether the variable case needs a temporary. (gfc_walk_variable_expr): Handle DIMEN_VECTOR by creating a GFC_SS_VECTOR index. * trans-expr.c: Include dependency.h. (gfc_trans_arrayfunc_assign): Fail if the target needs a temporary. 2005-09-09 Richard Sandiford <richard@codesourcery.com> PR fortran/21104 * trans.h (gfc_interface_sym_mapping, gfc_interface_mapping): Moved from trans-expr.c. (gfc_init_interface_mapping, gfc_free_interface_mapping) (gfc_add_interface_mapping, gfc_finish_interface_mapping) (gfc_apply_interface_mapping): Declare. * trans-array.h (gfc_set_loop_bounds_from_array_spec): Declare. (gfc_trans_allocate_temp_array): Add pre and post block arguments. * trans-array.c (gfc_set_loop_bounds_from_array_spec): New function. (gfc_trans_allocate_array_storage): Replace loop argument with separate pre and post blocks. (gfc_trans_allocate_temp_array): Add pre and post block arguments. Update call to gfc_trans_allocate_array_storage. (gfc_trans_array_constructor, gfc_conv_loop_setup): Adjust for new interface to gfc_trans_allocate_temp_array. * trans-expr.c (gfc_interface_sym_mapping, gfc_interface_mapping): Moved to trans.h. (gfc_init_interface_mapping, gfc_free_interface_mapping) (gfc_add_interface_mapping, gfc_finish_interface_mapping) (gfc_apply_interface_mapping): Make extern. (gfc_conv_function_call): Build an interface mapping for array return values too. Call gfc_set_loop_bounds_from_array_spec. Adjust call to gfc_trans_allocate_temp_array so that code is added to SE rather than LOOP. From-SVN: r104077
2005-06-25Update FSF address.Kelley Cook1-2/+2
From-SVN: r101310
2005-02-23gfortran.h (gfc_expr): Move 'operator'...Tobias Schlüter1-3/+3
* gfortran.h (gfc_expr): Move 'operator', 'op1', 'op2', and 'uop' fields into new struct 'op' inside the 'value' union. * arith.c (eval_intrinsic): Adapt all users. * dependency.c (gfc_check_dependency): Likewise. * dump-parse-tree.c (gfc_show_expr): Likewise. * expr.c (gfc_get_expr): Don't clear removed fields. (free_expr0, gfc_copy_expr, gfc_type_convert_binary, gfc_is_constant_expr, simplify_intrinsic_op, check_init_expr, check_intrinsic_op): Adapt to new field names. * interface.c (gfc_extend_expr): Likewise. Also explicitly nullify 'esym' and 'isym' fields of new function call. * iresolve.c (gfc_resolve_dot_product, gfc_resolve_matmul): Adapt to renamed structure fields. * matchexp.c (build_node, match_level_1, match_expr): Likewise. * module.c (mio_expr): Likewise. * resolve.c (resolve_operator): Likewise. (gfc_find_forall_index): Likewise. Only look through operands if dealing with EXPR_OP * trans-array.c (gfc_walk_op_expr): Adapt to renamed fields. * trans-expr.c (gfc_conv_unary_op, gfc_conv_power_op, gfc_conv_concat_op, gfc_conv_expr_op): Likewise. From-SVN: r95471
2005-01-23data.c, [...]: Fix comment typos.Kazu Hirata1-2/+2
* data.c, dependency.c, f95-lang.c, io.c, trans-array.c, trans-decl.c, trans-expr.c, trans-intrinsic.c, trans-io.c, trans-stmt.c, trans-types.c, trans.h: Fix comment typos. Follow spelling conventions. From-SVN: r94111
2004-09-16array.c, [...]: Fix comment typos.Kazu Hirata1-1/+1
* array.c, data.c, decl.c, dependency.c, error.c, f95-lang.c, interface.c, intrinsic.c, io.c, misc.c, module.c, parse.h, resolve.c, scanner.c, trans-array.c, trans-array.h, trans-common.c, trans-const.h, trans-decl.c, trans-expr.c, trans-intrinsic.c, trans-stmt.c, trans-types.c, trans.c, trans.h: Fix comment typos. Follow spelling conventions. From-SVN: r87605
2004-09-08array.c: Don't include assert.h.Paul Brook1-12/+11
* array.c: Don't include assert.h. * data.c: Don't include assert.h. Replace assert and abort with gcc_assert and gcc_unreachable. * dependency.c: Ditto. * f95-lang.c: Ditto. * iresolve.c: Ditto. * resolve.c: Ditto. * simplify.c: Ditto. * symbol.c: Ditto. * trans-array.c: Ditto. * trans-common.c: Ditto. * trans-const.c: Ditto. * trans-decl.c: Ditto. * trans-expr.c: Ditto. * trans-intrinsic.c: Ditto. * trans-io.c: Ditto. * trans-stmt.c: Ditto. * trans-types.c: Ditto. * trans.c: Ditto. From-SVN: r87187
2004-05-14Make-lang.in, [...]: Update copyright years and boilerplate.Tobias Schlüter1-12/+12
* Make-lang.in, arith.c, arith.h, array.c, bbt.c, check.c, decl.c, dependency.c, dependency.h, dump-parse-tree.c, error.c, expr.c, f95-lang.c, gfortran.h, interface.c, intrinsic.c, intrinsic.h, io.c, iresolve.c, lang-specs.h, match.c, match.h, matchexp.c, misc.c, module.c, options.c, parse.c, parse.h, primary.c, resolve.c, scanner.c, simplify.c, st.c, symbol.c, trans-array.c, trans-array.h, trans-common.c, trans-const.c, trans-const.h, trans-decl.c, trans-expr.c, trans-intrinsic.c, trans-io.c, trans-stmt.c, trans-stmt.h, trans-types.c, trans-types.h, trans.c, trans.h: Update copyright years and boilerplate. * data.c: Likewise, also removed two whitespace-only lines. * gfortranspec.c, lang.opt: Update copyright years. From-SVN: r81839
2004-05-13Merge tree-ssa-20020619-branch into mainline.Diego Novillo1-0/+679
From-SVN: r81764