aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Koenig <tkoenig@gcc.gnu.org>2012-09-22 10:32:51 +0000
committerThomas Koenig <tkoenig@gcc.gnu.org>2012-09-22 10:32:51 +0000
commit840171d2d112512ecdfb18558864bf203a483091 (patch)
treed28780de150087a52f20c89fad117dd77b374031
parenta2383b317b9d082d5d8d1661d61adc3d902efa83 (diff)
downloadgcc-840171d2d112512ecdfb18558864bf203a483091.zip
gcc-840171d2d112512ecdfb18558864bf203a483091.tar.gz
gcc-840171d2d112512ecdfb18558864bf203a483091.tar.bz2
re PR fortran/54599 (Issues found in gfortran by the Coverity Scan)
2012-09-22 Thomas König <tkoenig@gcc.gnu.org> PR fortran/54599 * dependency.c (gfc_dep_compare_expr): Clarify logic, remove dead code. From-SVN: r191640
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/dependency.c33
2 files changed, 18 insertions, 21 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 6679a15..983d305 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+2012-09-22 Thomas König <tkoenig@gcc.gnu.org>
+
+ PR fortran/54599
+ * dependency.c (gfc_dep_compare_expr): Clarify logic,
+ remove dead code.
+
2012-09-20 Tobias Burnus <burnus@net-b.de>
PR fortran/54599
diff --git a/gcc/fortran/dependency.c b/gcc/fortran/dependency.c
index 165ab4f..7c9525a 100644
--- a/gcc/fortran/dependency.c
+++ b/gcc/fortran/dependency.c
@@ -395,30 +395,21 @@ gfc_dep_compare_expr (gfc_expr *e1, gfc_expr *e2)
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)
+ if (l != 0)
return l;
- if (l == 0)
- {
- /* Watch out for 'A ' // x vs. 'A' // x. */
- gfc_expr *e1_left = e1->value.op.op1;
- gfc_expr *e2_left = e2->value.op.op1;
-
- if (e1_left->expr_type == EXPR_CONSTANT
- && e2_left->expr_type == EXPR_CONSTANT
- && e1_left->value.character.length
- != e2_left->value.character.length)
- return -2;
- else
- return r;
- }
+ /* Left expressions of // compare equal, but
+ watch out for 'A ' // x vs. 'A' // x. */
+ gfc_expr *e1_left = e1->value.op.op1;
+ gfc_expr *e2_left = e2->value.op.op1;
+
+ if (e1_left->expr_type == EXPR_CONSTANT
+ && e2_left->expr_type == EXPR_CONSTANT
+ && e1_left->value.character.length
+ != e2_left->value.character.length)
+ return -2;
else
- {
- if (l != 0)
- return l;
- else
- return r;
- }
+ return r;
}
/* Compare X vs. X-C, for INTEGER only. */