[prev in list] [next in list] [prev in thread] [next in thread]
List: gcc-patches
Subject: Re: [PATCH] Fix PR/8268: implement compile time array subscript checking
From: Andrew Pinski <pinskia () physics ! uc ! edu>
Date: 2006-12-06 23:35:24
Message-ID: 200612062335.kB6NZOk9013168 () localhost ! localdomain
[Download RAW message or body]
>
>
> Hi,
>
> The patch below implements PR/8268, which seems to be the one major diagnostic
> we're missing compared to icc (at least one openSUSE contributor regularly
> rebuilds all of the openSUSE distribution with icc just to report those
> warnings as bugs to us ;) ).
>
> bootstrapped and regtested with no additional failures many times on
> i686-suse-linux.
>
> Ok? Do we need the extra -Warray-bounds?
Your documentation for the warning is incorrect as
you say:
> +This option is only active when @option{-O1} or higher is active. It warns
> +about constant subscripts in array accesses that are out of bounds.
But that is wrong as it is actived only with -O1 -ftree-vrp or -O2 and higher
with VRP still turned on.
Second I would not just set it for the C family of languages:
> --- c-opts.c (revision 119391)
> +++ c-opts.c (working copy)
> @@ -396,6 +396,7 @@ c_common_handle_option (size_t scode, co
> warn_strict_aliasing = value;
> warn_string_literal_comparison = value;
> warn_always_true = value;
> + warn_array_bounds = value;
Third how well does the current VRP implentation handle:
int v[10]={0};
void f(void)
{
int n = 99;
int i;
if (n <= 0)
return;
if (n > 0)
{
i = 1;
do {
/* _Bool t = i <= 0;
_Bool t1 = i > n;
_Bool t2 = t || t1;
if (t2) __builtin_abort (); */
v[i] = i*i;
i++;
} while (i != n);
}
}
As far as I know VRP current does not get the above correctly,
that is change n to a nonconstant and uncomment the bounds checking
code.
Thanks,
Andrew Pinski
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic