aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2010-02-10 11:54:14 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2010-02-10 11:54:14 +0000
commitd977cb9cfd0543fcda482c0400806dd1e987d4d5 (patch)
tree6113ddc6064eef820caaf65171d7e8681efc3368 /gcc/tree.c
parent563cb662c833b2233b5682bcc55e99cf584de1a4 (diff)
downloadgcc-d977cb9cfd0543fcda482c0400806dd1e987d4d5.zip
gcc-d977cb9cfd0543fcda482c0400806dd1e987d4d5.tar.gz
gcc-d977cb9cfd0543fcda482c0400806dd1e987d4d5.tar.bz2
re PR c/43007 (No longer folds (unsigned int) ((long long unsigned int) spi_bias / 1008))
2010-02-10 Richard Guenther <rguenther@suse.de> PR c/43007 * tree.c (get_unwidened): Handle constants. * convert.c (convert_to_integer): Handle TRUNC_DIV_EXPR. * gcc.c-torture/execute/20100209-1.c: New testcase. * gcc.dg/fold-div-3.c: Likewise. From-SVN: r156653
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 5d44841..c51cca7 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -7623,6 +7623,14 @@ get_unwidened (tree op, tree for_type)
}
}
+ /* If we finally reach a constant see if it fits in for_type and
+ in that case convert it. */
+ if (for_type
+ && TREE_CODE (win) == INTEGER_CST
+ && TREE_TYPE (win) != for_type
+ && int_fits_type_p (win, for_type))
+ win = fold_convert (for_type, win);
+
return win;
}