mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-04-19 07:51:08 +00:00
[qfcc] Handle pointer dereferences in offset casts
Offset casts are used heavily in geometric algebra, but doing an offset cast on a dereferenced pointer (array index) doesn't work well for assignments. Fixes yet another bug in my test scene :)
This commit is contained in:
parent
62221b2735
commit
389571cbbe
1 changed files with 9 additions and 1 deletions
|
@ -178,7 +178,15 @@ alias_expr (const type_t *type, const expr_t *e, int offset)
|
|||
neg = true;
|
||||
e = neg_expr (e);
|
||||
}
|
||||
e = new_offset_alias_expr (type, e, offset);
|
||||
if (e->type == ex_uexpr && e->expr.op == '.') {
|
||||
auto offs = new_int_expr (offset);
|
||||
auto ptr = e->expr.e1;
|
||||
ptr = offset_pointer_expr (ptr, edag_add_expr (offs));
|
||||
ptr = cast_expr (pointer_type (type), ptr);
|
||||
e = unary_expr ('.', ptr);
|
||||
} else {
|
||||
e = new_offset_alias_expr (type, e, offset);
|
||||
}
|
||||
if (neg) {
|
||||
e = edag_add_expr (e);
|
||||
e = neg_expr (e);
|
||||
|
|
Loading…
Reference in a new issue