This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

c_common_type_for_mode: pass precision, not mode


I found this with an internal port, so if someone suggests a port with
a pointer mode that doesn't match any "normal" integer type modes I
can test it officially.

I'm also unsure whether the mode's bitsize or precision is the
appropriate value to pass.  Consider, for example, using a fractional
int mode for Pmode.

2004-12-15  DJ Delorie  <dj@redhat.com>

	* c-common.c (c_common_type_for_mode): Pass the mode's precision
	to make_[un]signed_type, not the mode itself.

Index: c-common.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-common.c,v
retrieving revision 1.594
diff -p -U3 -r1.594 c-common.c
--- c-common.c	13 Dec 2004 17:14:56 -0000	1.594
+++ c-common.c	16 Dec 2004 03:36:30 -0000
@@ -1619,10 +1619,14 @@ c_common_type_for_mode (enum machine_mod
     return void_type_node;
 
   if (mode == TYPE_MODE (build_pointer_type (char_type_node)))
-    return unsignedp ? make_unsigned_type (mode) : make_signed_type (mode);
+    return (unsignedp
+	    ? make_unsigned_type (GET_MODE_PRECISION (mode))
+	    : make_signed_type (GET_MODE_PRECISION (mode)));
 
   if (mode == TYPE_MODE (build_pointer_type (integer_type_node)))
-    return unsignedp ? make_unsigned_type (mode) : make_signed_type (mode);
+    return (unsignedp
+	    ? make_unsigned_type (GET_MODE_PRECISION (mode))
+	    : make_signed_type (GET_MODE_PRECISION (mode)));
 
   if (VECTOR_MODE_P (mode))
     {


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]