diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 28e261605e276f003e4075837ae74d3a372884ce..ad825fc52fad5bde0f140e929654793d2a0350f0 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2006-05-02  Zdenek Dvorak <dvorakz@suse.cz>
+
+	* tree.c (unsigned_type_for, signed_type_for): Make sure a type
+	of the correct signedness is returned.
+
 2006-05-02  Jeff Law  <law@redhat.com>
 
 	PR tree-optimization/27364
diff --git a/gcc/tree.c b/gcc/tree.c
index 48b4c655faa4fef79d8fe386c84784aa31d7d2eb..81803481710c3a520cb41c24100f9663f3368585 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -6990,7 +6990,7 @@ tree
 unsigned_type_for (tree type)
 {
   if (POINTER_TYPE_P (type))
-    return size_type_node;
+    return lang_hooks.types.unsigned_type (size_type_node);
   return lang_hooks.types.unsigned_type (type);
 }
 
@@ -6999,6 +6999,8 @@ unsigned_type_for (tree type)
 tree
 signed_type_for (tree type)
 {
+  if (POINTER_TYPE_P (type))
+    return lang_hooks.types.signed_type (size_type_node);
   return lang_hooks.types.signed_type (type);
 }