Re: C++ PATCH for c++/69379 (ICE with PTRMEM_CST wrapped in NOP_EXPR)

2016-01-27 Thread Jason Merrill
On 01/25/2016 03:00 PM, Marek Polacek wrote: It appears that handling the case when the types don't match is sufficient, at least all the tests pass, thus the following should be enough. OK. + "reinterpret_cast has different types"); Let's say "a reinterpret_cast

Re: C++ PATCH for c++/69379 (ICE with PTRMEM_CST wrapped in NOP_EXPR)

2016-01-25 Thread Jason Merrill
On 01/22/2016 05:07 PM, Marek Polacek wrote: On Fri, Jan 22, 2016 at 03:38:26PM -0500, Jason Merrill wrote: If we have a NOP_EXPR to the same type, we should strip it here. This helps for the unreduced testcases in the PR, but not for the reduced one, because for the reduced one, the types

Re: C++ PATCH for c++/69379 (ICE with PTRMEM_CST wrapped in NOP_EXPR)

2016-01-25 Thread Marek Polacek
On Mon, Jan 25, 2016 at 10:08:34AM -0500, Jason Merrill wrote: > On 01/22/2016 05:07 PM, Marek Polacek wrote: > >On Fri, Jan 22, 2016 at 03:38:26PM -0500, Jason Merrill wrote: > >>If we have a NOP_EXPR to the same type, we should strip it here. > > > >This helps for the unreduced testcases in the

Re: C++ PATCH for c++/69379 (ICE with PTRMEM_CST wrapped in NOP_EXPR)

2016-01-22 Thread Jason Merrill
On 01/22/2016 12:20 PM, Marek Polacek wrote: On Thu, Jan 21, 2016 at 01:49:14PM -0500, Jason Merrill wrote: On 01/21/2016 01:25 PM, Marek Polacek wrote: The problem in this PR is that we have a PTRMEM_CST wrapped in NOP_EXPR and fold_convert can't digest that. Why didn't we fold away the

Re: C++ PATCH for c++/69379 (ICE with PTRMEM_CST wrapped in NOP_EXPR)

2016-01-22 Thread Marek Polacek
On Fri, Jan 22, 2016 at 03:38:26PM -0500, Jason Merrill wrote: > If we have a NOP_EXPR to the same type, we should strip it here. This helps for the unreduced testcases in the PR, but not for the reduced one, because for the reduced one, the types are not the same. One type is struct { void

Re: C++ PATCH for c++/69379 (ICE with PTRMEM_CST wrapped in NOP_EXPR)

2016-01-22 Thread Marek Polacek
On Thu, Jan 21, 2016 at 01:49:14PM -0500, Jason Merrill wrote: > On 01/21/2016 01:25 PM, Marek Polacek wrote: > >The problem in this PR is that we have a PTRMEM_CST wrapped in NOP_EXPR > >and fold_convert can't digest that. > > Why didn't we fold away the NOP_EXPR before calling fold_convert? I

C++ PATCH for c++/69379 (ICE with PTRMEM_CST wrapped in NOP_EXPR)

2016-01-21 Thread Marek Polacek
The problem in this PR is that we have a PTRMEM_CST wrapped in NOP_EXPR and fold_convert can't digest that. For the unreduced test in the PR, this occurs since rev 230508: we force a NOP_EXPR when converting to the same type in build_static_cast_1: if (result == expr && SCALAR_TYPE_P

Re: C++ PATCH for c++/69379 (ICE with PTRMEM_CST wrapped in NOP_EXPR)

2016-01-21 Thread Jason Merrill
On 01/21/2016 01:25 PM, Marek Polacek wrote: The problem in this PR is that we have a PTRMEM_CST wrapped in NOP_EXPR and fold_convert can't digest that. Why didn't we fold away the NOP_EXPR before calling fold_convert? I guess we shouldn't call fold_convert on an un-folded operand. Jason