Compilation error involving comparison and logical operator

Dibyendu Majumdar mobile@majumdar.org.uk
Thu Jan 1 00:00:00 GMT 2015


Hi Dave,

I am getting an error in an expression such as this:

int bvalue_0_2;
bvalue_0_2 = &base[(int)0]->tt_ == (int)1 && &base[(int)0]->value_.b == (int)0;

Of course the expression above really is:

bvalue_0_2 = ((&base[(int)0]->tt_ == (int)1) &&
(&base[(int)0]->value_.b == (int)0));

The error I get is this:

libgccjit.so: error: gcc_jit_block_add_assignment: mismatching types:
assignment to bvalue_0_2 (type: int) from &base[(int)0]->tt_ == (int)0
(type: bool)

I notice that the error message doesn't show the full expression above
- is this just an issue with the dump or is there a problem with the
expression evaluation?

Also, I am confused by the error as I am not sure if this means I need
to store the result of the expression in a bool value. In fact if I do
that then:

libgccjit.so: error: gcc_jit_block_add_assignment: mismatching types:
assignment to bvalue_0_2 (type: bool) from &base[(int)0]->tt_ ==
(int)1 && &base[(int)0]->value_.b == (int)0 (type: int)

Now the full expression is shown but the error is different.
I will send you dumps tomorrow for this but if you could let me know
what the rules are for assigning boolean values to variables that
would be great.

Thanks and Regards

Dibyendu



More information about the Jit mailing list