diff options
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.fortran-torture/compile/vrp_1.f90 | 17 | ||||
-rw-r--r-- | gcc/tree-vrp.c | 16 |
4 files changed, 35 insertions, 9 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c2a16cb..1505a08 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2006-10-24 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/29567 + * tree-vrp.c (register_edge_assert_for_1): Fix wrong logic + for TRUTH_NOT_EXPR. Clarify comments. + 2006-10-24 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> * builtins.c (fold_builtin_exponent): Evaluate constant arguments diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1af046d..9136286 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2006-10-24 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/29567 + * gfortran.fortran-torture/compile/vrp_1.f90: New testcase. + 2006-10-23 Zdenek Dvorak <dvorakz@suse.cz> PR tree-optimization/14784 diff --git a/gcc/testsuite/gfortran.fortran-torture/compile/vrp_1.f90 b/gcc/testsuite/gfortran.fortran-torture/compile/vrp_1.f90 new file mode 100644 index 0000000..a8d0c29 --- /dev/null +++ b/gcc/testsuite/gfortran.fortran-torture/compile/vrp_1.f90 @@ -0,0 +1,17 @@ + SUBROUTINE STONUM(STRVAR,LENGTH) + CHARACTER STRVAR*(*) , CHK + LOGICAL MEND , NMARK , MMARK , EMARK + NMARK = .FALSE. + MMARK = .FALSE. + DO WHILE ( .NOT.MEND ) + IF ( CHK.GE.'0' .AND. CHK.LE.'9' ) THEN + IF ( CHK.EQ.'E' ) THEN + NMARK = .TRUE. + ELSEIF ( .NOT.MMARK .AND. CHK.EQ.'*' .AND. .NOT.NMARK ) & + & THEN + MMARK = .TRUE. + ENDIF + ENDIF + ENDDO + END + diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index 6d220fb..88c1d30 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -2777,7 +2777,7 @@ static bool register_edge_assert_for_1 (tree op, enum tree_code code, edge e, block_stmt_iterator bsi) { - bool invert, retval = false; + bool retval = false; tree op_def, rhs, val; /* We only care about SSA_NAMEs. */ @@ -2804,11 +2804,11 @@ register_edge_assert_for_1 (tree op, enum tree_code code, if (TREE_CODE (op_def) != MODIFY_EXPR) return retval; - invert = (code == EQ_EXPR ? true : false); rhs = TREE_OPERAND (op_def, 1); if (COMPARISON_CLASS_P (rhs)) { + bool invert = (code == EQ_EXPR ? true : false); tree op0 = TREE_OPERAND (rhs, 0); tree op1 = TREE_OPERAND (rhs, 1); @@ -2848,15 +2848,14 @@ register_edge_assert_for_1 (tree op, enum tree_code code, } else if (TREE_CODE (rhs) == TRUTH_NOT_EXPR) { - invert = !invert; - /* Recurse, flipping the tense of INVERT. */ + /* Recurse, flipping CODE. */ + code = invert_tree_comparison (code, false); retval |= register_edge_assert_for_1 (TREE_OPERAND (rhs, 0), - invert, e, bsi); + code, e, bsi); } else if (TREE_CODE (rhs) == SSA_NAME) { - /* Recurse through the copy, the tense of INVERT remains - unchanged. */ + /* Recurse through the copy. */ retval |= register_edge_assert_for_1 (rhs, code, e, bsi); } else if (TREE_CODE (rhs) == NOP_EXPR @@ -2864,8 +2863,7 @@ register_edge_assert_for_1 (tree op, enum tree_code code, || TREE_CODE (rhs) == VIEW_CONVERT_EXPR || TREE_CODE (rhs) == NON_LVALUE_EXPR) { - /* Recurse through the type conversion, the tense of INVERT - remains unchanged. */ + /* Recurse through the type conversion. */ retval |= register_edge_assert_for_1 (TREE_OPERAND (rhs, 0), code, e, bsi); } |