summaryrefslogtreecommitdiff
path: root/gcc/convert.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2005-02-16 13:54:30 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2005-02-16 13:54:30 +0000
commitc831d6fb28bc16f59d6676007fe0ee2bf9ab639e (patch)
treea0e729b4caa91a35b874138ae8a236e49b023751 /gcc/convert.c
parent6d3d2e2a1129555735bbbea993a852b24ad02785 (diff)
downloadgcc-c831d6fb28bc16f59d6676007fe0ee2bf9ab639e.tar.gz
PR middle-end/19857
* fold-const.c (fold): Don't optimize (T)(x & cst) to (T)x & (T)cst if (T)cst overflows. * convert.c (convert_to_integer) <case POINTER_TYPE>: Pass TYPE_UNSIGNED (type) as type_for_size's UNSIGNEDP argument. * gcc.dg/tree-ssa/20050215-1.c: New test. * gcc.c-torture/execute/20050215-1.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@95106 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/convert.c')
-rw-r--r--gcc/convert.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/convert.c b/gcc/convert.c
index 005d3e2089b..f1a38c2d240 100644
--- a/gcc/convert.c
+++ b/gcc/convert.c
@@ -387,7 +387,8 @@ convert_to_integer (tree type, tree expr)
expr = integer_zero_node;
else
expr = fold (build1 (CONVERT_EXPR,
- lang_hooks.types.type_for_size (POINTER_SIZE, 0),
+ lang_hooks.types.type_for_size
+ (POINTER_SIZE, TYPE_UNSIGNED (type)),
expr));
return convert_to_integer (type, expr);