aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2011-04-22 19:29:54 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2011-04-22 19:29:54 +0000
commit1df5b0db1cc49d434c5d1ac2dc6a71daf0066d0e (patch)
tree5b1871d95abd14f902e5fe5fd747753ee79e843e /gcc/tree.c
parentae01169c6918a8ba506c908372bcd4e01fd34714 (diff)
downloadgcc-1df5b0db1cc49d434c5d1ac2dc6a71daf0066d0e.zip
gcc-1df5b0db1cc49d434c5d1ac2dc6a71daf0066d0e.tar.gz
gcc-1df5b0db1cc49d434c5d1ac2dc6a71daf0066d0e.tar.bz2
tree.c (build_int_cst): Properly create canonicalized integer constants.
2011-04-22 Richard Guenther <rguenther@suse.de> * tree.c (build_int_cst): Properly create canonicalized integer constants. (build_int_cst_type): Remove scary comments. From-SVN: r172871
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index b37b7f8..6f93fb1 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -1004,7 +1004,7 @@ copy_list (tree list)
}
-/* Create an INT_CST node with a LOW value sign extended. */
+/* Create an INT_CST node with a LOW value sign extended to TYPE. */
tree
build_int_cst (tree type, HOST_WIDE_INT low)
@@ -1013,17 +1013,10 @@ build_int_cst (tree type, HOST_WIDE_INT low)
if (!type)
type = integer_type_node;
- return build_int_cst_wide (type, low, low < 0 ? -1 : 0);
+ return double_int_to_tree (type, shwi_to_double_int (low));
}
-/* Create an INT_CST node with a LOW value in TYPE. The value is sign extended
- if it is negative. This function is similar to build_int_cst, but
- the extra bits outside of the type precision are cleared. Constants
- with these extra bits may confuse the fold so that it detects overflows
- even in cases when they do not occur, and in general should be avoided.
- We cannot however make this a default behavior of build_int_cst without
- more intrusive changes, since there are parts of gcc that rely on the extra
- precision of the integer constants. */
+/* Create an INT_CST node with a LOW value sign extended to TYPE. */
tree
build_int_cst_type (tree type, HOST_WIDE_INT low)