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: wide-int, builtins


On Nov 25, 2013, at 2:43 AM, Richard Biener <richard.guenther@gmail.com> wrote:
> On Sat, Nov 23, 2013 at 8:20 PM, Mike Stump <mikestump@comcast.net> wrote:
>> Richi has asked the we break the wide-int patch so that the individual port and front end maintainers can review their parts without have to go through the entire patch.    This patch covers the builtins code.
> 
> -  HOST_WIDE_INT c[2];
>   HOST_WIDE_INT ch;
>   unsigned int i, j;
> +  HOST_WIDE_INT tmp[MAX_BITSIZE_MODE_ANY_INT / HOST_BITS_PER_WIDE_INT];
> +  unsigned int len = (GET_MODE_PRECISION (mode) + HOST_BITS_PER_WIDE_INT - 1)
> +    / HOST_BITS_PER_WIDE_INT;
> +
> +  for (i = 0; i < len; i++)
> +    tmp[i] = 0;
> 
>   gcc_assert (GET_MODE_CLASS (mode) == MODE_INT);
> 
> The assert should be moved before accessing the mode precision.

> Ok with moving the assert.

Here is what I checked in, thanks:

Committed revision 205373.

Index: gcc/builtins.c
===================================================================
--- gcc/builtins.c	(revision 205364)
+++ gcc/builtins.c	(working copy)
@@ -679,14 +679,15 @@ c_readstr (const char *str, enum machine
   HOST_WIDE_INT ch;
   unsigned int i, j;
   HOST_WIDE_INT tmp[MAX_BITSIZE_MODE_ANY_INT / HOST_BITS_PER_WIDE_INT];
+
+  gcc_assert (GET_MODE_CLASS (mode) == MODE_INT);
+
   unsigned int len = (GET_MODE_PRECISION (mode) + HOST_BITS_PER_WIDE_INT - 1)
     / HOST_BITS_PER_WIDE_INT;
 
   for (i = 0; i < len; i++)
     tmp[i] = 0;
 
-  gcc_assert (GET_MODE_CLASS (mode) == MODE_INT);
-
   ch = 1;
   for (i = 0; i < GET_MODE_SIZE (mode); i++)
     {


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