aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index db41564..1c29ad5 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -1596,8 +1596,10 @@ fold_convert (t, arg1)
{
if (REAL_VALUE_ISNAN (TREE_REAL_CST (arg1)))
{
- t = arg1;
- TREE_TYPE (arg1) = type;
+ /* We make a copy of ARG1 so that we don't modify an
+ existing constant tree. */
+ t = copy_node (arg1);
+ TREE_TYPE (t) = type;
return t;
}