On 2023-10-23 14:06, Martin Uecker wrote:
We should aim for a good integration with the BDOS pass, so
that it can propagate the information further, e.g. the
following should work:
struct { int L; char buf[] __counted_by(L) } x;
x.L = N;
x.buf = ...;
char *p = &x->f;
__bdos(p) -> N
So we need to be smart on how we provide the size
information for x->f to the backend.
This would also be desirable for the language extension.
This is essentially why there need to be frontend rules constraining
reordering and reachability semantics of x.L, thus restricting DSE and
reordering for it. This is not really a __bdos/__bos question, because
that bit is trivial; if the structure is visible, the value is simply
x.L. This is also why adding a reference to x.L in __bos/__bdos is not
sufficient or even possible in, e.g. the above case you note.
Thanks,
Sid