source: etc/campbell/dev-notes/2013-01-14-expr-eval-order.txt @ 2580

Last change on this file since 2580 was 2580, checked in by campbell, 7 years ago

Note on ptr + int vs int + ptr.

File size: 940 bytes
Line 
1Ilias noticed a small issue in the Clight to Cminor translation:
2
3For a pointer expr p and integer expr i, in Clight
4
5  p + i   and   i + p
6
7produce the execution traces in left to right order (recall that there may be
8cost labels in p and i if there are ?: expressions involved), but our current
9Clight to Cminor code was always turning them into p + i, changing the order
10of the trace.
11
12In a practical sense this is irrelevant: we don't observe such fine details in
13the trace ordering in the sense that any guarantees about time are made (at
14best) at the statement level.  An invasive fix would be to make the traces use
15sets of cost labels.
16
17We're rather constrained in terms of simple fixes because we translate exprs
18to exprs which forbids the use of temporary variables to reorder the exprs.
19Our best choice of approach at the moment is to split the addp front-end
20operator into addpi and addip operators, then deal with it later on.
Note: See TracBrowser for help on using the repository browser.