This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: wide-int, builtins
- From: Mike Stump <mikestump at comcast dot net>
- To: Richard Biener <richard dot guenther at gmail dot com>
- Cc: "gcc-patches at gcc dot gnu dot org Patches" <gcc-patches at gcc dot gnu dot org>, Kenneth Zadeck <zadeck at naturalbridge dot com>
- Date: Mon, 25 Nov 2013 16:45:31 -0800
- Subject: Re: wide-int, builtins
- Authentication-results: sourceware.org; auth=none
- References: <58802500-F4DF-43AE-B185-757CC1DD32CA at comcast dot net> <CAFiYyc39YxPm4N9Krp7hM67RZ7xxh1-eu2NWGdy9-uM1iKHhCA at mail dot gmail dot com>
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++)
{