getting the right boolean type
Janne Blomqvist
blomqvist.janne@gmail.com
Thu Nov 9 15:39:00 GMT 2017
On Thu, Nov 9, 2017 at 4:44 PM, Andrew MacLeod <amacleod@redhat.com> wrote:
> I'm a little confused. In gimple I need to do a comparison between 2
> values, and I create a boolean_type_node result.
> I then combine it with an existing condition, but fortran is crapping out on
> me because the boolean_type I created is not
> compatible with the boolean type is has already created for a different
> condition:
>
> Its not exactly this situation, but the idea is similar:
>
> _65 = _37 != 0; <<-- in the IL
> _77 = _34 != 0; <<-- Im creating this
>
> and something like
>
> (_65 != _77)
>
> Craps out on me because the types are incompatible.
>
> The expression created by fortran assigned to _65 is of type:
> logical(kind=4)
> and mine, _77 created with boolean_type_node, is logical(kind=1)
>
> I was under the impression that using boolean_type_node would give me the
> right kind of boolean for that language, but apparently I was mistaken.
>
> If I don't have the context of the type of _65, how am I suppose to get the
> right boolean type for _77 when I create it? I don't want to cast it to the
> right logical kind, Id like to just get it right. I haven't stumbled
> across any hooks or other obvious thing...
Potentially relevant patches that have changed stuff here in the past
year: https://gcc.gnu.org/ml/gcc-patches/2016-12/msg01197.html ,
committed as r243830, and
https://gcc.gnu.org/ml/gcc-patches/2017-11/msg00575.html committed as
r254526.
But yeah, as Richard said, Fortran has logical types of different
sizes, you need to convert one to the other when comparing.
--
Janne Blomqvist
More information about the Gcc
mailing list