aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Hainque <hainque@adacore.com>2009-08-24 21:23:22 +0000
committerOlivier Hainque <hainque@gcc.gnu.org>2009-08-24 21:23:22 +0000
commitc767899ef26cac6092786591518ff9e5a54dbe04 (patch)
tree30ea226563257ca2559d6f9e7614fcc3b8ea38f8
parentdf58e64872d2ba904d38bd8a5bdf65527fa817da (diff)
downloadgcc-c767899ef26cac6092786591518ff9e5a54dbe04.zip
gcc-c767899ef26cac6092786591518ff9e5a54dbe04.tar.gz
gcc-c767899ef26cac6092786591518ff9e5a54dbe04.tar.bz2
convert.c (convert_to_integer): Don't assume an input pointer is POINTER_SIZE wide.
* convert.c (convert_to_integer): Don't assume an input pointer is POINTER_SIZE wide. Fetch from the type instead. From-SVN: r151060
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/convert.c9
2 files changed, 11 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 420b313..2d03118 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2009-08-24 Olivier Hainque <hainque@adacore.com>
+
+ * convert.c (convert_to_integer): Don't assume an input pointer is
+ POINTER_SIZE wide. Fetch from the type instead.
+
2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* configure.ac (AC_PREREQ): Bump to 2.64.
diff --git a/gcc/convert.c b/gcc/convert.c
index f7ddfc9..a833418 100644
--- a/gcc/convert.c
+++ b/gcc/convert.c
@@ -530,10 +530,13 @@ convert_to_integer (tree type, tree expr)
if (integer_zerop (expr))
return build_int_cst (type, 0);
- /* Convert to an unsigned integer of the correct width first,
- and from there widen/truncate to the required type. */
+ /* Convert to an unsigned integer of the correct width first, and from
+ there widen/truncate to the required type. Some targets support the
+ coexistence of multiple valid pointer sizes, so fetch the one we need
+ from the type. */
expr = fold_build1 (CONVERT_EXPR,
- lang_hooks.types.type_for_size (POINTER_SIZE, 0),
+ lang_hooks.types.type_for_size
+ (TYPE_PRECISION (intype), 0),
expr);
return fold_convert (type, expr);