Re: C++ PATCH to fix ICE with vector expr folding (PR c++/83659)

2018-02-08 Thread Jakub Jelinek
On Wed, Feb 07, 2018 at 04:21:43PM -0500, Jason Merrill wrote: > On Wed, Feb 7, 2018 at 4:14 PM, Jakub Jelinek wrote: > > On Wed, Feb 07, 2018 at 03:52:39PM -0500, Jason Merrill wrote: > >> > E.g. the constexpr function uses > >> > same_type_ignoring_top_level_qualifiers_p > >>

Re: C++ PATCH to fix ICE with vector expr folding (PR c++/83659)

2018-02-08 Thread Jason Merrill
On Thu, Feb 8, 2018 at 6:55 AM, Jakub Jelinek wrote: > On Wed, Feb 07, 2018 at 04:21:43PM -0500, Jason Merrill wrote: >> On Wed, Feb 7, 2018 at 4:14 PM, Jakub Jelinek wrote: >> > On Wed, Feb 07, 2018 at 03:52:39PM -0500, Jason Merrill wrote: >> >> > E.g. the

Re: C++ PATCH to fix ICE with vector expr folding (PR c++/83659)

2018-02-08 Thread Marek Polacek
On Thu, Feb 08, 2018 at 12:55:10PM +0100, Jakub Jelinek wrote: > On Wed, Feb 07, 2018 at 04:21:43PM -0500, Jason Merrill wrote: > > On Wed, Feb 7, 2018 at 4:14 PM, Jakub Jelinek wrote: > > > On Wed, Feb 07, 2018 at 03:52:39PM -0500, Jason Merrill wrote: > > >> > E.g. the

Re: C++ PATCH to fix ICE with vector expr folding (PR c++/83659)

2018-02-08 Thread Marek Polacek
On Thu, Feb 08, 2018 at 10:15:45AM +, Richard Sandiford wrote: > Jakub Jelinek writes: > > On Wed, Feb 07, 2018 at 03:23:25PM -0500, Jason Merrill wrote: > >> On Wed, Feb 7, 2018 at 2:48 PM, Jakub Jelinek wrote: > >> > On Wed, Feb 07, 2018 at 08:36:31PM

Re: C++ PATCH to fix ICE with vector expr folding (PR c++/83659)

2018-02-08 Thread Richard Sandiford
Jakub Jelinek writes: > On Wed, Feb 07, 2018 at 03:23:25PM -0500, Jason Merrill wrote: >> On Wed, Feb 7, 2018 at 2:48 PM, Jakub Jelinek wrote: >> > On Wed, Feb 07, 2018 at 08:36:31PM +0100, Marek Polacek wrote: >> >> > > That was my first patch, but it was

Re: C++ PATCH to fix ICE with vector expr folding (PR c++/83659)

2018-02-07 Thread Jakub Jelinek
On Wed, Feb 07, 2018 at 03:52:39PM -0500, Jason Merrill wrote: > > E.g. the constexpr function uses same_type_ignoring_top_level_qualifiers_p > > instead of == type comparisons, the COMPONENT_REF stuff, ... > > > For poly_* stuff, I think Richard S. wants to introduce it into the FEs at > > some

Re: C++ PATCH to fix ICE with vector expr folding (PR c++/83659)

2018-02-07 Thread Jakub Jelinek
On Wed, Feb 07, 2018 at 08:36:31PM +0100, Marek Polacek wrote: > > > That was my first patch, but it was rejected: > > > https://gcc.gnu.org/ml/gcc-patches/2018-01/msg00271.html > > > > Then should we update fold_indirect_ref_1 to use the new code? Is > > there a reason for them to stay out of

Re: C++ PATCH to fix ICE with vector expr folding (PR c++/83659)

2018-02-07 Thread Jason Merrill
On Wed, Feb 7, 2018 at 4:14 PM, Jakub Jelinek wrote: > On Wed, Feb 07, 2018 at 03:52:39PM -0500, Jason Merrill wrote: >> > E.g. the constexpr function uses same_type_ignoring_top_level_qualifiers_p >> > instead of == type comparisons, the COMPONENT_REF stuff, ... >> >> > For

Re: C++ PATCH to fix ICE with vector expr folding (PR c++/83659)

2018-02-07 Thread Jason Merrill
On Wed, Feb 7, 2018 at 3:32 PM, Jakub Jelinek wrote: > On Wed, Feb 07, 2018 at 03:23:25PM -0500, Jason Merrill wrote: >> On Wed, Feb 7, 2018 at 2:48 PM, Jakub Jelinek wrote: >> > On Wed, Feb 07, 2018 at 08:36:31PM +0100, Marek Polacek wrote: >> >> > > That was

Re: C++ PATCH to fix ICE with vector expr folding (PR c++/83659)

2018-02-07 Thread Jakub Jelinek
On Wed, Feb 07, 2018 at 03:23:25PM -0500, Jason Merrill wrote: > On Wed, Feb 7, 2018 at 2:48 PM, Jakub Jelinek wrote: > > On Wed, Feb 07, 2018 at 08:36:31PM +0100, Marek Polacek wrote: > >> > > That was my first patch, but it was rejected: > >> > >

Re: C++ PATCH to fix ICE with vector expr folding (PR c++/83659)

2018-02-07 Thread Jason Merrill
On Wed, Feb 7, 2018 at 2:48 PM, Jakub Jelinek wrote: > On Wed, Feb 07, 2018 at 08:36:31PM +0100, Marek Polacek wrote: >> > > That was my first patch, but it was rejected: >> > > https://gcc.gnu.org/ml/gcc-patches/2018-01/msg00271.html >> > >> > Then should we update

Re: C++ PATCH to fix ICE with vector expr folding (PR c++/83659)

2018-02-07 Thread Marek Polacek
On Wed, Feb 07, 2018 at 01:23:49PM -0500, Jason Merrill wrote: > On Wed, Feb 7, 2018 at 12:54 PM, Marek Polacek wrote: > > On Wed, Feb 07, 2018 at 12:26:04PM -0500, Jason Merrill wrote: > >> On Fri, Jan 26, 2018 at 6:22 PM, Jakub Jelinek wrote: > >> > On

Re: C++ PATCH to fix ICE with vector expr folding (PR c++/83659)

2018-02-07 Thread Jason Merrill
On Wed, Feb 7, 2018 at 12:54 PM, Marek Polacek wrote: > On Wed, Feb 07, 2018 at 12:26:04PM -0500, Jason Merrill wrote: >> On Fri, Jan 26, 2018 at 6:22 PM, Jakub Jelinek wrote: >> > On Fri, Jan 26, 2018 at 02:11:19PM +0100, Richard Biener wrote: >> >> >>

Re: C++ PATCH to fix ICE with vector expr folding (PR c++/83659)

2018-02-07 Thread Marek Polacek
On Wed, Feb 07, 2018 at 12:26:04PM -0500, Jason Merrill wrote: > On Fri, Jan 26, 2018 at 6:22 PM, Jakub Jelinek wrote: > > On Fri, Jan 26, 2018 at 02:11:19PM +0100, Richard Biener wrote: > >> >> POINTER_PLUS_EXPR offets are to be interpreted as signed (ptrdiff_t) > >> >> so

Re: C++ PATCH to fix ICE with vector expr folding (PR c++/83659)

2018-02-07 Thread Jason Merrill
On Fri, Jan 26, 2018 at 6:22 PM, Jakub Jelinek wrote: > On Fri, Jan 26, 2018 at 02:11:19PM +0100, Richard Biener wrote: >> >> POINTER_PLUS_EXPR offets are to be interpreted as signed (ptrdiff_t) >> >> so using uhwi and then performing an unsigned division is wrong code. >> >>

Re: C++ PATCH to fix ICE with vector expr folding (PR c++/83659)

2018-01-26 Thread Jakub Jelinek
On Fri, Jan 26, 2018 at 02:11:19PM +0100, Richard Biener wrote: > >> POINTER_PLUS_EXPR offets are to be interpreted as signed (ptrdiff_t) > >> so using uhwi and then performing an unsigned division is wrong code. > >> See mem_ref_offset how to deal with this (ugh - poly-ints...). Basically > >>

Re: C++ PATCH to fix ICE with vector expr folding (PR c++/83659)

2018-01-26 Thread Richard Biener
On Thu, Jan 25, 2018 at 3:45 PM, Jakub Jelinek wrote: > On Fri, Jan 05, 2018 at 09:52:36AM +0100, Richard Biener wrote: >> On Wed, Jan 3, 2018 at 5:31 PM, Marek Polacek wrote: >> > Here we are crashing because cxx_fold_indirect_ref got a POINTER_PLUS_EXPR >>

Re: C++ PATCH to fix ICE with vector expr folding (PR c++/83659)

2018-01-25 Thread Jakub Jelinek
On Fri, Jan 05, 2018 at 09:52:36AM +0100, Richard Biener wrote: > On Wed, Jan 3, 2018 at 5:31 PM, Marek Polacek wrote: > > Here we are crashing because cxx_fold_indirect_ref got a POINTER_PLUS_EXPR > > with offset > signed HOST_WIDE_INT and we tried to convert it to sHWI. > >

Re: C++ PATCH to fix ICE with vector expr folding (PR c++/83659)

2018-01-05 Thread Richard Biener
On Wed, Jan 3, 2018 at 5:31 PM, Marek Polacek wrote: > Here we are crashing because cxx_fold_indirect_ref got a POINTER_PLUS_EXPR > with offset > signed HOST_WIDE_INT and we tried to convert it to sHWI. > > The matching code in fold_indirect_ref_1 uses uHWIs so I've followed

Re: C++ PATCH to fix ICE with vector expr folding (PR c++/83659)

2018-01-03 Thread Marek Polacek
On Wed, Jan 03, 2018 at 11:45:55AM -0500, Nathan Sidwell wrote: > On 01/03/2018 11:31 AM, Marek Polacek wrote: > > Here we are crashing because cxx_fold_indirect_ref got a POINTER_PLUS_EXPR > > with offset > signed HOST_WIDE_INT and we tried to convert it to sHWI. > > > > The matching code in

Re: C++ PATCH to fix ICE with vector expr folding (PR c++/83659)

2018-01-03 Thread Marek Polacek
On Wed, Jan 03, 2018 at 05:40:32PM +, Richard Sandiford wrote: > Marek Polacek writes: > > Here we are crashing because cxx_fold_indirect_ref got a POINTER_PLUS_EXPR > > with offset > signed HOST_WIDE_INT and we tried to convert it to sHWI. > > > > The matching code in

Re: C++ PATCH to fix ICE with vector expr folding (PR c++/83659)

2018-01-03 Thread Richard Sandiford
Marek Polacek writes: > Here we are crashing because cxx_fold_indirect_ref got a POINTER_PLUS_EXPR > with offset > signed HOST_WIDE_INT and we tried to convert it to sHWI. > > The matching code in fold_indirect_ref_1 uses uHWIs so I've followed suit. > But that code now also

Re: C++ PATCH to fix ICE with vector expr folding (PR c++/83659)

2018-01-03 Thread Nathan Sidwell
On 01/03/2018 11:31 AM, Marek Polacek wrote: Here we are crashing because cxx_fold_indirect_ref got a POINTER_PLUS_EXPR with offset > signed HOST_WIDE_INT and we tried to convert it to sHWI. The matching code in fold_indirect_ref_1 uses uHWIs so I've followed suit. But that code now also uses

C++ PATCH to fix ICE with vector expr folding (PR c++/83659)

2018-01-03 Thread Marek Polacek
Here we are crashing because cxx_fold_indirect_ref got a POINTER_PLUS_EXPR with offset > signed HOST_WIDE_INT and we tried to convert it to sHWI. The matching code in fold_indirect_ref_1 uses uHWIs so I've followed suit. But that code now also uses poly_uint64 and I'm not sure if any of the