fold-const.c (fold_read_from_constant_string): Convert result to requested type.
authorUlrich Weigand <uweigand@de.ibm.com>
Sat, 22 May 2004 00:27:23 +0000 (00:27 +0000)
committerUlrich Weigand <uweigand@gcc.gnu.org>
Sat, 22 May 2004 00:27:23 +0000 (00:27 +0000)
* fold-const.c (fold_read_from_constant_string): Convert result to
requested type.

From-SVN: r82120

gcc/ChangeLog
gcc/fold-const.c

index 519605859bd3374ea8345ede5d90e36363427443..a0e205e337c45e2ba58fb6482e87d891309f47c5 100644 (file)
@@ -1,3 +1,8 @@
+2004-05-21  Ulrich Weigand  <uweigand@de.ibm.com>
+
+       * fold-const.c (fold_read_from_constant_string): Convert result to
+       requested type.
+
 2004-05-21  Richard Henderson  <rth@redhat.com>
 
        * gimplify.c (mostly_copy_tree_r): Don't attempt to copy decls.
index 2c89c5b3d8d5b1a44e38cb6533b617395295ea04..ba683ad3f2bb57fd40a68f1c4063fb6a24c83a08 100644 (file)
@@ -9692,8 +9692,9 @@ fold_read_from_constant_string (tree exp)
          && (GET_MODE_CLASS (TYPE_MODE (TREE_TYPE (TREE_TYPE (string))))
              == MODE_INT)
          && (GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (TREE_TYPE (string)))) == 1))
-       return build_int_2 ((TREE_STRING_POINTER (string)
-                            [TREE_INT_CST_LOW (index)]), 0);
+       return fold_convert (TREE_TYPE (exp),
+                            build_int_2 ((TREE_STRING_POINTER (string)
+                                         [TREE_INT_CST_LOW (index)]), 0));
     }
   return NULL;
 }