From b804abd61de2fd28ffe754bd136aba96a0bfb931 Mon Sep 17 00:00:00 2001 From: Danylo Piliaiev Date: Tue, 16 Mar 2021 21:04:02 +0200 Subject: [PATCH] freedreno/isa: assert if field's range is out of bitset's range Also, update outdated comment along the way. Signed-off-by: Danylo Piliaiev Part-of: --- src/freedreno/isa/isa.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/freedreno/isa/isa.py b/src/freedreno/isa/isa.py index 995823ab1cf..d7d148443e5 100644 --- a/src/freedreno/isa/isa.py +++ b/src/freedreno/isa/isa.py @@ -458,6 +458,12 @@ class ISA(object): for field_name, field in case.fields.items(): if field.type == 'float': assert field.get_size() == 32 or field.get_size() == 16 + + if not isinstance(field, BitSetDerivedField): + assert field.high < bitset.get_size(), \ + "{}.{}: invalid bit range: [{}, {}] is not in [{}, {}]".format( + bitset_name, field_name, field.low, field.high, 0, bitset.get_size() - 1) + if field.type in builtin_types: continue if field.type in self.enums: @@ -481,4 +487,4 @@ class ISA(object): # TODO we should probably be able to look at the contexts where # an expression is evaluated and verify that it doesn't have any - # references that would be unresolved at evaluation time \ No newline at end of file + # {VARNAME} references that would be unresolved at evaluation time \ No newline at end of file