On Sat, Jan 21, 2012 at 12:21 AM, Mike Stump <mikest...@comcast.net> wrote:
> unsigned builtins don't always work, as the type matching code can ignore the 
> signed/unsigned variants when searching for a type with a particular mode.  
> This patch fixes this problem.  If a type with same unsignededness exists, we 
> prefer it over a type with the same mode, but different unsignededness.
>
> Ok?

Why add a new loop?  It seems to be bogus to not check signedness in
the existing loop (mind that for
fixed-point types you need to check saturating/nonsaturating flag.

You miss a testcase where this fix matters.

Richard.

> 2012-01-20  Mike Stump  <mikest...@comcast.net>
>
>        * c-common.c (c_common_type_for_mode): Match signed/unsigned types
>        exactly.
>
> Index: c-common.c
> ===================================================================
> *** c-common.c  (revision 183357)
> --- c-common.c  (working copy)
> *************** c_common_type_for_mode (enum machine_mod
> *** 3089,3094 ****
> --- 3089,3099 ----
>      }
>
>    for (t = registered_builtin_types; t; t = TREE_CHAIN (t))
> +     if (TYPE_MODE (TREE_VALUE (t)) == mode
> +       && !!unsignedp == !!TYPE_UNSIGNED (TREE_VALUE (t)))
> +       return TREE_VALUE (t);
> +
> +   for (t = registered_builtin_types; t; t = TREE_CHAIN (t))
>      if (TYPE_MODE (TREE_VALUE (t)) == mode)
>        return TREE_VALUE (t);
>
>
>

Reply via email to