diff options
author | Mark Shinwell <shinwell@codesourcery.com> | 2006-06-04 16:28:55 +0000 |
---|---|---|
committer | Mark Shinwell <shinwell@gcc.gnu.org> | 2006-06-04 16:28:55 +0000 |
commit | 63b4819753c735449a0915e62928fa6374cd70c3 (patch) | |
tree | 8043b65180715166e17c85119e10cb873f903255 /gcc/fold-const.c | |
parent | 7ec434b841e8120aad467db3efb249f536f5b819 (diff) | |
download | gcc-63b4819753c735449a0915e62928fa6374cd70c3.zip gcc-63b4819753c735449a0915e62928fa6374cd70c3.tar.gz gcc-63b4819753c735449a0915e62928fa6374cd70c3.tar.bz2 |
tree.h: Declare folding_initializer.
gcc:
* tree.h: Declare folding_initializer.
* builtins.c (fold_builtin_constant_p): Give definite answer
if folding inside an initializer.
* fold-const.c: Define folding_initializer.
(START_FOLD_INIT): Save and then set folding_initializer.
(END_FOLD_INIT): Restore folding_initializer.
gcc/testsuite:
* gcc.c-torture/compile/builtin_constant_p.c: New test.
From-SVN: r114358
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 3c8575e..6f19704 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -59,6 +59,10 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA #include "langhooks.h" #include "md5.h" +/* Non-zero if we are folding constants inside an initializer; zero + otherwise. */ +int folding_initializer = 0; + /* The following constants represent a bit based encoding of GCC's comparison operators. This encoding simplifies transformations on relational comparison operators, such as AND and OR. */ @@ -11708,16 +11712,19 @@ fold_build3_stat (enum tree_code code, tree type, tree op0, tree op1, tree op2 int saved_trapping_math = flag_trapping_math;\ int saved_rounding_math = flag_rounding_math;\ int saved_trapv = flag_trapv;\ + int saved_folding_initializer = folding_initializer;\ flag_signaling_nans = 0;\ flag_trapping_math = 0;\ flag_rounding_math = 0;\ - flag_trapv = 0 + flag_trapv = 0;\ + folding_initializer = 1; #define END_FOLD_INIT \ flag_signaling_nans = saved_signaling_nans;\ flag_trapping_math = saved_trapping_math;\ flag_rounding_math = saved_rounding_math;\ - flag_trapv = saved_trapv + flag_trapv = saved_trapv;\ + folding_initializer = saved_folding_initializer; tree fold_build1_initializer (enum tree_code code, tree type, tree op) |