diff options
author | Richard Guenther <rguenther@suse.de> | 2008-03-27 17:09:54 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2008-03-27 17:09:54 +0000 |
commit | ffd837fe164a08ed4e3315009d61bb24c69fe04d (patch) | |
tree | 3800dd1b144c0ef8553b9904b57193e5438ca668 /gcc/fold-const.c | |
parent | 6b4e94bcaef89af9899da67f2dffc54496120535 (diff) | |
download | gcc-ffd837fe164a08ed4e3315009d61bb24c69fe04d.zip gcc-ffd837fe164a08ed4e3315009d61bb24c69fe04d.tar.gz gcc-ffd837fe164a08ed4e3315009d61bb24c69fe04d.tar.bz2 |
re PR tree-optimization/35716 (gfortran.dg/assign_6.f and gfortran.dg/g77/dnrm2.f)
2008-03-27 Richard Guenther <rguenther@suse.de>
PR middle-end/35716
* fold-const.c (fold_comparison): Restrict distinct decl
comparison folding to VAR_DECLs and PARM_DECLs. Do not
solely rely on operand_equal_p.
From-SVN: r133647
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index a7dcfc3f..fe78e6d 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -8584,14 +8584,18 @@ fold_comparison (enum tree_code code, tree type, tree op0, tree op1) of local binding decls or constants. */ else if (indirect_base0 && indirect_base1 /* We know that !operand_equal_p (base0, base1, 0) - because the if condition was false. */ + because the if condition was false. But make + sure two decls are not the same. */ + && base0 != base1 && TREE_CODE (arg0) == ADDR_EXPR && TREE_CODE (arg1) == ADDR_EXPR - && ((DECL_P (base0) + && (((TREE_CODE (base0) == VAR_DECL + || TREE_CODE (base0) == PARM_DECL) && (targetm.binds_local_p (base0) || CONSTANT_CLASS_P (base1))) || CONSTANT_CLASS_P (base0)) - && ((DECL_P (base1) + && (((TREE_CODE (base1) == VAR_DECL + || TREE_CODE (base1) == PARM_DECL) && (targetm.binds_local_p (base1) || CONSTANT_CLASS_P (base0))) || CONSTANT_CLASS_P (base1))) |