Fix a equality check typo.

Fixes bad code generation when assigning to vector.x in a function with no
parameters and the vector is the first local var.
This commit is contained in:
Bill Currie 2018-10-12 23:39:05 +09:00
parent 78e0a8dc52
commit 4828934e50
2 changed files with 15 additions and 1 deletions

View File

@ -239,7 +239,7 @@ static __attribute__((pure)) int
is_const_ptr (expr_t *e)
{
if ((e->type != ex_value || e->e.value->lltype != ev_pointer)
|| !(POINTER_VAL (e->e.value->v.pointer) > 0
|| !(POINTER_VAL (e->e.value->v.pointer) >= 0
&& POINTER_VAL (e->e.value->v.pointer) < 65536)) {
return 1;
}

View File

@ -8,6 +8,20 @@ foo (float x, float y, float z)
return v;
}
float w;
float h;
vector
bar (void)
{
vector pos;
pos.x = w;
pos.y = h;
pos.z = 0;
return pos;
}
int
main ()
{