diff options
author | Nathan Sidwell <nathan@gcc.gnu.org> | 2004-08-19 10:36:07 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2004-08-19 10:36:07 +0000 |
commit | 89b0433e3a1f0a9ae590c1be5a6ba4b9aa690ae0 (patch) | |
tree | ba738aa254abf741ddc0722884b43575c2331ca6 /gcc/fold-const.c | |
parent | abc145a322be89c774fdcae8c883685d7943028a (diff) | |
download | gcc-89b0433e3a1f0a9ae590c1be5a6ba4b9aa690ae0.zip gcc-89b0433e3a1f0a9ae590c1be5a6ba4b9aa690ae0.tar.gz gcc-89b0433e3a1f0a9ae590c1be5a6ba4b9aa690ae0.tar.bz2 |
tree.h (TYPE_CACHED_VALUES_P): New.
* tree.h (TYPE_CACHED_VALUES_P): New.
(TYPE_CACHED_VALUES): New.
(TYPE_ORIG_SIZE_TYPE): Adjust.
* tree.def (INTEGER_CST): Update documentation.
* tree.c: Inlcude params.h.
(build_int_cst): Cache small values.
(build_type_copy): Do not copy the value cache.
* c-common.c (c_common_nodes_and_builtins): Add comment, remove
unneeded zeroing.
* c-typeck.c (build_c_cast): Add comment about OVERFLOW setting.
* expmed.c (const_mult_add_overflow_p): Clear type copy's value
cache.
* fold-const.c (force_fit_type): Copy value when setting
overflows.
(int_const_binop): Likewise.
* stor-layout.c: Include params.h
(set_sizetype): Create values cache.
(fixup_unsigned_type): Set UNSIGNED_P before caching any values.
* params.def (PARAM_INTEGER_SHARE_LIMIT): New.
* params.h (INTEGER_SHARE_LIMIT): New.
* Makefile.in (tree.o, stor-layout.o): Depend on PARAMS_H.
* cp/decl.c (finish_enum): Do not copy value node early, copy
later.
* cp/lex.c (cxx_init): Force null_node to be unique.
* java/parse.h (JAVA_RADIX10_FLAG): Rename to ...
(JAVA_NOT_RADIX10_FLAG): ... here. Invert meaning.
* java/lex.c (do_java_lex): Adjust.
(error_if_numeric_overflow): Likewise.
From-SVN: r86247
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 319e455..092712b 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -268,18 +268,21 @@ force_fit_type (tree t, int overflowable, if (overflowed || overflowed_const || low != TREE_INT_CST_LOW (t) || high != TREE_INT_CST_HIGH (t)) { + t = build_int_cst (TREE_TYPE (t), low, high); + if (overflowed || overflowable < 0 || (overflowable > 0 && sign_extended_type)) { + t = copy_node (t); TREE_OVERFLOW (t) = 1; TREE_CONSTANT_OVERFLOW (t) = 1; } else if (overflowed_const) - TREE_CONSTANT_OVERFLOW (t) = 1; - - TREE_INT_CST_LOW (t) = low; - TREE_INT_CST_HIGH (t) = high; + { + t = copy_node (t); + TREE_CONSTANT_OVERFLOW (t) = 1; + } } return t; @@ -1425,11 +1428,16 @@ int_const_binop (enum tree_code code, tree arg1, tree arg2, int notrunc) /* Propagate overflow flags ourselves. */ if (((!uns || is_sizetype) && overflow) | TREE_OVERFLOW (arg1) | TREE_OVERFLOW (arg2)) - TREE_OVERFLOW (t) = 1; - - if (TREE_OVERFLOW (t) | TREE_CONSTANT_OVERFLOW (arg1) - | TREE_CONSTANT_OVERFLOW (arg2)) - TREE_CONSTANT_OVERFLOW (t) = 1; + { + t = copy_node (t); + TREE_OVERFLOW (t) = 1; + TREE_CONSTANT_OVERFLOW (t) = 1; + } + else if (TREE_CONSTANT_OVERFLOW (arg1) | TREE_CONSTANT_OVERFLOW (arg2)) + { + t = copy_node (t); + TREE_CONSTANT_OVERFLOW (t) = 1; + } } else t = force_fit_type (t, 1, |