+2011-08-20 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/49638
+ * dependency.c (gfc_dep_compare_expr): Add new result value "-3".
+ (gfc_check_element_vs_section,gfc_check_element_vs_element): Handle
+ result value "-3".
+ * frontend-passes.c (optimize_comparison): Ditto.
+ * interface.c (gfc_check_typebound_override): Ditto.
+
2011-08-19 Mikael Morin <mikael.morin@sfr.fr>
PR fortran/50129
return -2;
}
-/* Compare two values. Returns 0 if e1 == e2, -1 if e1 < e2, +1 if e1 > e2,
- and -2 if the relationship could not be determined. */
+/* Compare two expressions. Return values:
+ * +1 if e1 > e2
+ * 0 if e1 == e2
+ * -1 if e1 < e2
+ * -2 if the relationship could not be determined
+ * -3 if e1 /= e2, but we cannot tell which one is larger. */
int
gfc_dep_compare_expr (gfc_expr *e1, gfc_expr *e2)
r = gfc_dep_compare_expr (e1->value.op.op2, e2->value.op.op2);
if (l == 0 && r == 0)
return 0;
- if (l == 0 && r != -2)
+ if (l == 0 && r > -2)
return r;
- if (l != -2 && r == 0)
+ if (l > -2 && r == 0)
return l;
if (l == 1 && r == 1)
return 1;
r = gfc_dep_compare_expr (e1->value.op.op2, e2->value.op.op1);
if (l == 0 && r == 0)
return 0;
- if (l == 0 && r != -2)
+ if (l == 0 && r > -2)
return r;
- if (l != -2 && r == 0)
+ if (l > -2 && r == 0)
return l;
if (l == 1 && r == 1)
return 1;
r = gfc_dep_compare_expr (e1->value.op.op2, e2->value.op.op2);
if (l == 0 && r == 0)
return 0;
- if (l != -2 && r == 0)
+ if (l > -2 && r == 0)
return l;
- if (l == 0 && r != -2)
+ if (l == 0 && r > -2)
return -r;
if (l == 1 && r == -1)
return 1;
l = gfc_dep_compare_expr (e1->value.op.op1, e2->value.op.op1);
r = gfc_dep_compare_expr (e1->value.op.op2, e2->value.op.op2);
- if (l == -2)
- return -2;
+ if (l <= -2)
+ return l;
if (l == 0)
{
if (e1_left->expr_type == EXPR_CONSTANT
&& e2_left->expr_type == EXPR_CONSTANT
&& e1_left->value.character.length
- != e2_left->value.character.length)
+ != e2_left->value.character.length)
return -2;
else
return r;
}
if (e1->expr_type != e2->expr_type)
- return -2;
+ return -3;
switch (e1->expr_type)
{
if (are_identical_variables (e1, e2))
return 0;
else
- return -2;
+ return -3;
case EXPR_OP:
/* Intrinsic operators are the same if their operands are the same. */
if (!start || !end)
return GFC_DEP_OVERLAP;
s = gfc_dep_compare_expr (start, end);
- if (s == -2)
+ if (s <= -2)
return GFC_DEP_OVERLAP;
/* Assume positive stride. */
if (s == -1)
if (contains_forall_index_p (r_start) || contains_forall_index_p (l_start))
return GFC_DEP_OVERLAP;
- if (i != -2)
+ if (i > -2)
return GFC_DEP_NODEP;
return GFC_DEP_EQUAL;
}
procedure, nopass :: b => b2 ! { dg-error "should have matching result types and ranks" }
procedure, nopass :: c => c2 ! { dg-warning "Possible character length mismatch" }
procedure, nopass :: d => d2 ! valid, check for commutativity (+,*)
- procedure, nopass :: e => e2 ! { dg-warning "Possible character length mismatch" }
+ procedure, nopass :: e => e2 ! { dg-error "Character length mismatch" }
end type
contains