Skip to content

Commit

Permalink
Improve proving of byte alignment of opaque fields
Browse files Browse the repository at this point in the history
Ref. eng/recordflux/RecordFlux#1563
  • Loading branch information
treiher committed Mar 21, 2024
1 parent c7959f5 commit 74bffa6
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions rflx/model/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -1903,12 +1903,16 @@ def _prove_field_positions(
t = self.types[f]
if isinstance(t, mty.Opaque):
element_size = t.element_size
start_aligned = expr.Not(
expr.Equal(
expr.Mod(self._target_first(last), element_size),
expr.Number(1),
last.location,
start_aligned = expr.NotEqual(
expr.Mod(
expr.Add(
self._target_first(last),
expr.Number(-1),
).simplified(),
element_size,
),
expr.Number(0),
last.location,
)

path_message = " -> ".join([p.target.name for p in path])
Expand Down

0 comments on commit 74bffa6

Please sign in to comment.