On 01/05/2017 05:15 AM, Richard Biener wrote:
On Thu, Jan 5, 2017 at 5:06 AM, Alexandre Oliva <aol...@redhat.com>
wrote:
On Jan 4, 2017, Alexandre Oliva <aol...@redhat.com> wrote:
I'll prepare and post a patch anyway, but do we want to make it
standard practice?
Here it is.
simplify_transformation_to_array had the nested loop unrolled 7
times, which is reasonable given that it iterates over arrays of
size GFC_MAX_DIMENSIONS == 7.
The problem is that the last iteration increments the index, tests
that it's less than result->rank, and then accesses the arrays
with the incremented index.
We did not optimize out that part in the 7th iteration, so VRP
flagged the unreachable code as accessing arrays past the end.
It couldn't possibly know that we'd never reach that part, since
the test was on result->rank, and it's not obvious (for the
compiler) that result->rank <= GFC_MAX_DIMENSIONS.
Even an assert to that effect before the enclosing loop didn't
avoid the warning turned to error, though; I suppose there might be
some aliasing at play, because moving the assert into the loop
does. An assert on the index itself would also work, even more
efficiently, but we're just silencing the warning instead.
Regstrapped on x86_64-linux-gnu and i686-linux-gnu. Ok to
install?
Reasonable -- I'll leave it for others to comment on that "standard
practice" part (it'll be the first case of using this IIRC).
I thought I'd seen this stuff elsewhere, but that could have just as
easily been within glibc.
It's a fair amount of clutter. But I won't object.
jeff