Re: wi::max_value() of a boolean is not 1

2017-08-21 Thread Richard Sandiford
Richard Biener writes: > On August 21, 2017 5:43:08 PM GMT+02:00, Aldy Hernandez > wrote: >>The attached patch fixes the problem by sign extending before >>constructing the wide int. It does so while constructing the >>hwi_with_prec object, since the int_traits >>container has is_sign_extended

Re: wi::max_value() of a boolean is not 1

2017-08-21 Thread Richard Biener
On August 21, 2017 5:43:08 PM GMT+02:00, Aldy Hernandez wrote: >The attached patch fixes the problem by sign extending before >constructing the wide int. It does so while constructing the >hwi_with_prec object, since the int_traits >container has is_sign_extended=true, so I assume the underlyi

Re: wi::max_value() of a boolean is not 1

2017-08-21 Thread Aldy Hernandez
The attached patch fixes the problem by sign extending before constructing the wide int. It does so while constructing the hwi_with_prec object, since the int_traits container has is_sign_extended=true, so I assume the underlying hwi_with_prec must be stored with sign extension. Is this what yo

Re: wi::max_value() of a boolean is not 1

2017-08-20 Thread Richard Biener
On August 20, 2017 10:46:54 AM GMT+02:00, Aldy Hernandez wrote: >Hi folks. > >Calling wi::max_value() of a boolean_type creates a wide_int with all >bits set, not just the least significant bit. > >tree type = boolean_type_node; >wide_int x = wi::max_value (TYPE_PRECISION (type), TYPE_SIGN (type

wi::max_value() of a boolean is not 1

2017-08-20 Thread Aldy Hernandez
Hi folks. Calling wi::max_value() of a boolean_type creates a wide_int with all bits set, not just the least significant bit. tree type = boolean_type_node; wide_int x = wi::max_value (TYPE_PRECISION (type), TYPE_SIGN (type)); (gdb) print x.dump() [0x], precision = 1 However,