diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-01-16 12:36:38 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-01-16 12:36:38 +0000 |
commit | e216a9a3bc6ad3296d31f457da83c50bac029edc (patch) | |
tree | 6751b799774ee191126a39fcea165f308b606f08 /gcc/fold-const.c | |
parent | 113c4c5ebda13008acb3e98d10d449aceb80a034 (diff) | |
download | gcc-e216a9a3bc6ad3296d31f457da83c50bac029edc.tar.gz |
2010-01-16 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 155960
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@155962 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index e1126219689..9d249cc3b2f 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -326,13 +326,17 @@ add_double_with_sign (unsigned HOST_WIDE_INT l1, HOST_WIDE_INT h1, HOST_WIDE_INT h; l = l1 + l2; - h = h1 + h2 + (l < l1); + h = (HOST_WIDE_INT) ((unsigned HOST_WIDE_INT) h1 + + (unsigned HOST_WIDE_INT) h2 + + (l < l1)); *lv = l; *hv = h; if (unsigned_p) - return (unsigned HOST_WIDE_INT) h < (unsigned HOST_WIDE_INT) h1; + return ((unsigned HOST_WIDE_INT) h < (unsigned HOST_WIDE_INT) h1 + || (h == h1 + && l < l1)); else return OVERFLOW_SUM_SIGN (h1, h2, h); } @@ -8942,6 +8946,19 @@ fold_unary_loc (location_t loc, enum tree_code code, tree type, tree op0) } return NULL_TREE; + case INDIRECT_REF: + /* Fold *&X to X if X is an lvalue. */ + if (TREE_CODE (op0) == ADDR_EXPR) + { + tree op00 = TREE_OPERAND (op0, 0); + if ((TREE_CODE (op00) == VAR_DECL + || TREE_CODE (op00) == PARM_DECL + || TREE_CODE (op00) == RESULT_DECL) + && !TREE_READONLY (op00)) + return op00; + } + return NULL_TREE; + default: return NULL_TREE; } /* switch (code) */ |