]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
convert.c (convert_to_integer): Don't assume an input pointer is POINTER_SIZE wide.
authorOlivier Hainque <hainque@adacore.com>
Mon, 24 Aug 2009 21:23:22 +0000 (21:23 +0000)
committerOlivier Hainque <hainque@gcc.gnu.org>
Mon, 24 Aug 2009 21:23:22 +0000 (21:23 +0000)
        * convert.c (convert_to_integer): Don't assume an input pointer is
        POINTER_SIZE wide.  Fetch from the type instead.

From-SVN: r151060

gcc/ChangeLog
gcc/convert.c

index 420b313d634ea93da7aafe6d2bf2dbc3c42dc5e9..2d031187c420d48f1951df269c77dd1af9e7f224 100644 (file)
@@ -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.
index f7ddfc956fc0517031b4f9872a680348aa6b96b2..a833418d273a377d8c61711bd8df09ce16631333 100644 (file)
@@ -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);