Re: [PATCH] tree-sra: fix compare_access_positions qsort comparator

2017-09-25 Thread Alexander Monakov
On Mon, 25 Sep 2017, Martin Jambor wrote: > --- a/gcc/tree-sra.c > +++ b/gcc/tree-sra.c > @@ -1542,19 +1542,20 @@ compare_access_positions (const void *a, const void > *b) > && TREE_CODE (f2->type) != COMPLEX_TYPE > && TREE_CODE (f2->type) != VECTOR_TYPE) > return -

Re: [PATCH] tree-sra: fix compare_access_positions qsort comparator

2017-09-25 Thread Martin Jambor
On Thu, Sep 21, 2017 at 08:27:31PM +0300, Alexander Monakov wrote: > Hi, > > The compare_access_positions qsort comparator lacks transitivity, although > somewhat surprisingly this issue didn't manifest on 64-bit x86 bootstraps. > The first invalid comparison step is here (tree-sra.c:1545): > >

Re: [PATCH] tree-sra: fix compare_access_positions qsort comparator

2017-09-25 Thread Alexander Monakov
On Thu, 21 Sep 2017, Richard Sandiford wrote: > LGTM FWIW, but isn't there also the problem that the TYPE_PRECISION > test fails to stabilise the sort if you have two integral types with > the same precision? Yes, but that's a pre-existing issue, so I didn't change it in the patch. I think GCC bro

Re: [PATCH] tree-sra: fix compare_access_positions qsort comparator

2017-09-21 Thread Richard Sandiford
Alexander Monakov writes: > diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c > index 163b7a2d03b..4f9a8802aeb 100644 > --- a/gcc/tree-sra.c > +++ b/gcc/tree-sra.c > @@ -1542,19 +1542,17 @@ compare_access_positions (const void *a, const void > *b) > && TREE_CODE (f2->type) != COMPLEX_TYPE

[PATCH] tree-sra: fix compare_access_positions qsort comparator

2017-09-21 Thread Alexander Monakov
Hi, The compare_access_positions qsort comparator lacks transitivity, although somewhat surprisingly this issue didn't manifest on 64-bit x86 bootstraps. The first invalid comparison step is here (tree-sra.c:1545): /* Put the integral type with the bigger precision first. */ else if