diff mbox

wide-int, builtins

Message ID 00D90F91-3770-45C0-B2CA-2199799F7F68@comcast.net
State New
Headers show

Commit Message

Mike Stump Nov. 26, 2013, 12:45 a.m. UTC
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.
diff mbox

Patch

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++)
     {