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]

Re: [PATCH] Fix type-mismatch in mips_gimplify_va_arg_expr


On Wed, Nov 19, 2008 at 11:47 PM, Adam Nemet <anemet@caviumnetworks.com> wrote:
> The testcase below fails type-checking with EABI32 as the type of OFF is
> unsigned char and the default type, build_int_cst uses is int.  This happens
> while building newlib in the combined tree.
>
> Since the type is unsigned char and the amount is always < UNITS_PER_WORD,
> it's safe to directly build the constant with type unsigned char.
>
> Tested with mipsisa64r2-elf with {,-mips32r2} and with type checking.  I
> compared the results to a clean build without type checking (release).
>
> OK to install?

Ok.

Thanks,
Richard.

> Adam
>
>        * config/mips/mips.c (mips_gimplify_va_arg_expr): Use -rsize
>        with the same type as the first operand of the AND expression.
>
> testsuite/
>        * gcc.c-torture/compile/20081119-1.c: New test.
>
> Index: config/mips/mips.c
> ===================================================================
> --- config/mips/mips.c  (revision 141996)
> +++ config/mips/mips.c  (working copy)
> @@ -5332,7 +5332,7 @@ mips_gimplify_va_arg_expr (tree valist,
>            {
>              /* [1] Emit code for: off &= -rsize.      */
>              t = build2 (BIT_AND_EXPR, TREE_TYPE (off), off,
> -                         build_int_cst (NULL_TREE, -rsize));
> +                         build_int_cst (TREE_TYPE (off), -rsize));
>              gimplify_assign (off, t, pre_p);
>            }
>          osize = rsize;
> Index: testsuite/gcc.c-torture/compile/20081119-1.c
> ===================================================================
> --- testsuite/gcc.c-torture/compile/20081119-1.c        (revision 0)
> +++ testsuite/gcc.c-torture/compile/20081119-1.c        (revision 0)
> @@ -0,0 +1,5 @@
> +unsigned long long
> +f (__builtin_va_list  ap)
> +{
> +  return __builtin_va_arg (ap, unsigned long long);
> +}
>


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