Re: [C++ Patch] PR 67216 (false is still a null pointer constant)

2015-08-17 Thread Jason Merrill
On 08/17/2015 02:40 PM, Paolo Carlini wrote: the bug is very clear: in C++11 we reject the testcase because null_ptr_cst_p returns 'true' for 'false', whereas [conv.ptr] is carefully worded in terms of integer literals not boolean literals. The obvious fix, using == INTEGER_TYPE instead of

Re: [C++ Patch] PR 67216 (false is still a null pointer constant)

2015-08-17 Thread Paolo Carlini
Hi, On 08/17/2015 08:50 PM, Jason Merrill wrote: On 08/17/2015 02:40 PM, Paolo Carlini wrote: the bug is very clear: in C++11 we reject the testcase because null_ptr_cst_p returns 'true' for 'false', whereas [conv.ptr] is carefully worded in terms of integer literals not boolean literals. The

[C++ Patch] PR 67216 (false is still a null pointer constant)

2015-08-17 Thread Paolo Carlini
Hi, the bug is very clear: in C++11 we reject the testcase because null_ptr_cst_p returns 'true' for 'false', whereas [conv.ptr] is carefully worded in terms of integer literals not boolean literals. The obvious fix, using == INTEGER_TYPE instead of CP_INTEGRAL_TYPE_P, appears to work well.

Re: [C++ Patch] PR 67216 (false is still a null pointer constant)

2015-08-17 Thread Jason Merrill
On 08/17/2015 02:52 PM, Paolo Carlini wrote: On 08/17/2015 08:50 PM, Jason Merrill wrote: OK. I wonder if we can also drop the STRIP_NOPs on the C++11 path. You are not alone ;) No, not trivially, without we ICE on pr51313.C. Hmm, that testcase is ill-formed. We ought to reject it, though

Re: [C++ Patch] PR 67216 (false is still a null pointer constant)

2015-08-17 Thread Paolo Carlini
Hi, On 08/17/2015 08:59 PM, Jason Merrill wrote: On 08/17/2015 02:52 PM, Paolo Carlini wrote: On 08/17/2015 08:50 PM, Jason Merrill wrote: OK. I wonder if we can also drop the STRIP_NOPs on the C++11 path. You are not alone ;) No, not trivially, without we ICE on pr51313.C. Hmm, that

Re: [C++ Patch] PR 67216 (false is still a null pointer constant)

2015-08-17 Thread Jason Merrill
On 08/17/2015 03:20 PM, Paolo Carlini wrote: On 08/17/2015 08:59 PM, Jason Merrill wrote: On 08/17/2015 02:52 PM, Paolo Carlini wrote: On 08/17/2015 08:50 PM, Jason Merrill wrote: OK. I wonder if we can also drop the STRIP_NOPs on the C++11 path. You are not alone ;) No, not trivially,

Re: [C++ Patch] PR 67216 (false is still a null pointer constant)

2015-08-17 Thread Jason Merrill
+ if (TREE_CODE (type) == INTEGER_TYPE) + { + if (TREE_CODE (t) == INTEGER_CST integer_zerop (t) + !TREE_OVERFLOW (t)) + return true; + } Let's fold those conditions together. :) OK. Jason

Re: [C++ Patch] PR 67216 (false is still a null pointer constant)

2015-08-17 Thread Paolo Carlini
Hi, On 08/17/2015 09:26 PM, Jason Merrill wrote: On 08/17/2015 03:20 PM, Paolo Carlini wrote: On 08/17/2015 08:59 PM, Jason Merrill wrote: On 08/17/2015 02:52 PM, Paolo Carlini wrote: On 08/17/2015 08:50 PM, Jason Merrill wrote: OK. I wonder if we can also drop the STRIP_NOPs on the C++11