getting the right boolean type
Richard Biener
richard.guenther@gmail.com
Thu Nov 9 15:16:00 GMT 2017
On Thu, Nov 9, 2017 at 3: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...
>
> I feel like I am missing something obvious... :-P
You should already know the boolean type from the existing comparison in the IL.
That is, you shouldn't generate conditions out of thin air, do you? That is,
there isn't a "single" boolean type a random hook would tell you.
Richard.
> Andrew
>
More information about the Gcc
mailing list