basic VRP min/max range overflow question

Robert Dewar dewar@adacore.com
Mon Jul 18 16:44:00 GMT 2005


Sebastian Pop wrote:

> I don't really see what a false positive could be in this case.  In
> the patch that I have proposed, the warning is triggered every time
> the flag -Wloop-bound-estimated is used and the loop optimizer
> triggers the estimation of loop bounds for a parametric loop, as in
> the following:
> 
> void foo (int N)
> {
>   int i;
>   int A[123];
> 
>   for (i = 0; i < N; i++)
>     A[i] = ...
> }
> 
> The warning would say something like "<file>:<line> undefined behavior
> if loop runs more than 122 iterations: access over allocated data
> bounds".

and that is called a false positive if in fact the loop does
not overrun. this sounds very dubious to me



More information about the Gcc mailing list