[PATCH] Use signed boolean type for boolean vectors
Ilya Enkovich
enkovich.gnu@gmail.com
Wed Oct 28 15:31:00 GMT 2015
2015-10-28 18:21 GMT+03:00 Richard Biener <richard.guenther@gmail.com>:
> On Wed, Oct 28, 2015 at 2:13 PM, Ilya Enkovich <enkovich.gnu@gmail.com> wrote:
>> Hi,
>>
>> Testing boolean vector conversions I found several runtime regressions
>> and investigation showed it's due to incorrect conversion caused by
>> unsigned boolean type. When boolean vector is represented as an
>> integer vector on target it's a signed integer actually. Unsigned
>> boolean type was chosen due to possible single bit values, but for
>> multiple bit values it causes wrong casting. The easiest way to fix
>> it is to use signed boolean value. The following patch does this and
>> fixes my problems with conversion. Bootstrapped and tested on
>> x86_64-unknown-linux-gnu. Is it OK?
>
> Hmm. Actually formally the "boolean" vectors were always 0 or -1
> (all bits set). That is also true for a signed boolean with precision 1
> but with higher precision what makes sure to sign-extend 'true'?
>
> So it's far from an obvious change, esp as you don't change the
> precision == 1 case. [I still think we should have precision == 1
> for all boolean types]
>
> Richard.
>
For 1 bit precision signed type value 1 is out of range, right? This might break
in many place due to used 1 as true value.
Ilya
More information about the Gcc-patches
mailing list