This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[ping] Re: c_common_type_for_mode: pass precision, not mode
- From: DJ Delorie <dj at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 7 Jan 2005 22:34:23 -0500
- Subject: [ping] Re: c_common_type_for_mode: pass precision, not mode
- References: <200412160346.iBG3kv9q011598@greed.delorie.com>
http://gcc.gnu.org/ml/gcc-patches/2004-12/msg01186.html
> X-Sieve: CMU Sieve 2.2
> Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm
> Sender: gcc-patches-owner@gcc.gnu.org
> Date: Wed, 15 Dec 2004 22:46:58 -0500
> From: DJ Delorie <dj@redhat.com>
> X-RedHat-Spam-Score: 0
>
>
> 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))
> {
>