Re: [C++ Patch/RFC] PR 43906

2014-08-06 Thread Jason Merrill
OK, thanks. Jason

Re: [C++ Patch/RFC] PR 43906

2014-08-06 Thread Paolo Carlini
Hi, On 08/06/2014 05:19 PM, Jason Merrill wrote: On 08/05/2014 10:48 AM, Paolo Carlini wrote: + && (VOID_TYPE_P (TREE_TYPE (type1)) + || comptypes (TYPE_MAIN_VARIANT (TREE_TYPE (type0)), + TYPE_MAIN_VARIANT (TREE_TYPE (type1)), + C

Re: [C++ Patch/RFC] PR 43906

2014-08-06 Thread Jason Merrill
On 08/05/2014 10:48 AM, Paolo Carlini wrote: + && (VOID_TYPE_P (TREE_TYPE (type1)) + || comptypes (TYPE_MAIN_VARIANT (TREE_TYPE (type0)), +TYPE_MAIN_VARIANT (TREE_TYPE (type1)), +COMPARE_

Re: [C++ Patch/RFC] PR 43906

2014-08-05 Thread Paolo Carlini
Hi, On 08/05/2014 02:32 PM, Jason Merrill wrote: On 08/05/2014 08:10 AM, Paolo Carlini wrote: .. a clarification. As I tried to briefly explain yesterday, this kind of change means that: extern void z(); void il() { if (z != (void*)0) z(); } doesn't trigger anymore the pedwarn at beginning of

Re: [C++ Patch/RFC] PR 43906

2014-08-05 Thread Jason Merrill
On 08/05/2014 08:10 AM, Paolo Carlini wrote: .. a clarification. As I tried to briefly explain yesterday, this kind of change means that: extern void z(); void il() { if (z != (void*)0) z(); } doesn't trigger anymore the pedwarn at beginning of composite_pointer_type about the comparison itself

Re: [C++ Patch/RFC] PR 43906

2014-08-05 Thread Paolo Carlini
.. a clarification. As I tried to briefly explain yesterday, this kind of change means that: extern void z(); void il() { if (z != (void*)0) z(); } doesn't trigger anymore the pedwarn at beginning of composite_pointer_type about the comparison itself, for the simple reason that we don't call

Re: [C++ Patch/RFC] PR 43906

2014-08-05 Thread Paolo Carlini
Hi, On 08/05/2014 03:58 AM, Jason Merrill wrote: On 08/04/2014 07:01 PM, Paolo Carlini wrote: In fact I wondered about that a few minutes after sending my message... And this is what I figured out: normally we have hard errors from composite_pointer_type (eg, try scalar types, class types), eve

Re: [C++ Patch/RFC] PR 43906

2014-08-04 Thread Jason Merrill
On 08/04/2014 07:01 PM, Paolo Carlini wrote: In fact I wondered about that a few minutes after sending my message... And this is what I figured out: normally we have hard errors from composite_pointer_type (eg, try scalar types, class types), even for null values. The only exception I have been a

Re: [C++ Patch/RFC] PR 43906

2014-08-04 Thread Paolo Carlini
Hi, On 08/04/2014 10:45 PM, Jason Merrill wrote: On 08/04/2014 12:24 PM, Paolo Carlini wrote: + || (TYPE_PTR_P (type1) && VOID_TYPE_P (TREE_TYPE (type1)) Why check for VOID_TYPE_P? I'd think we would want to warn about comparing to other null pointer values as well. In fact I wond

Re: [C++ Patch/RFC] PR 43906

2014-08-04 Thread Jason Merrill
On 08/04/2014 12:24 PM, Paolo Carlini wrote: + || (TYPE_PTR_P (type1) && VOID_TYPE_P (TREE_TYPE (type1)) Why check for VOID_TYPE_P? I'd think we would want to warn about comparing to other null pointer values as well. Jason

[C++ Patch/RFC] PR 43906

2014-08-04 Thread Paolo Carlini
Hi, I suppose we can quickly resolve, one way or another, this rather old issue. Considering: extern void z(); void h() { if ( z != (void*)0 ); } we -Waddress warn in C and we don't in C++, due to the rather subtle differences between null_pointer_constant_p and null_ptr_cst_p. I believe we