You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From the spec I was unable to read out the exact behavior of setInvalid, however
from this snippet I can infer that assignments to an invalid header are void.
What I am little confused about is the erasure of the first assignment.
At this point the header was still valid, does setInvalid free or zero the data stored at the header reference? Or is the behavior undefined? If it is undefined, should the compiler make the assumption that all previous assignments are void? Couldn't this behaviour differ based on the backend?
The text was updated successfully, but these errors were encountered:
After the execution of hdr.h.setInvalid() reading a field in hdr.h will return an undefined value. Therefore it's safe for the compiler to eliminate the assignment to hdr.h.a.
Regarding the question "Couldn't this behaviour differ based on the backend?" Yes, the behavior could differ. But since the language specification says that reading fields in h returns an undefined value, the front-end is free to apply program transformations that do not preserve the values in those fields, even if some specific backends might implement hdr.h.setInvalid(); hdr.h.setValid() as a no-op.
I am trying to understand the exact implications of
setValid
andsetInvalid
Let's assume I have the following sequence of operations:
which after a FrontEnd pass turns into:
From the spec I was unable to read out the exact behavior of
setInvalid
, howeverfrom this snippet I can infer that assignments to an invalid header are void.
What I am little confused about is the erasure of the first assignment.
At this point the header was still valid, does
setInvalid
free or zero the data stored at the header reference? Or is the behavior undefined? If it is undefined, should the compiler make the assumption that all previous assignments are void? Couldn't this behaviour differ based on the backend?The text was updated successfully, but these errors were encountered: