On 8/9/19 8:52 AM, Peter Maydell wrote: >> @@ -195,7 +195,10 @@ class MultiField: >> """Class representing a compound instruction field""" >> def __init__(self, subs, mask): >> self.subs = subs >> - self.sign = subs[0].sign >> + if len(subs): >> + self.sign = subs[0].sign >> + else: >> + self.sign = 0 >> self.mask = mask >> >> def __str__(self): > Is this change to MultiField left over from the previous > implementation ? I was expecting a zero-length MultiField > to now be a bug in this python script (ie we should never > try to create one). >
Oops, yes. The error is emitted here: > + if len(subs) == 0: > + if func: > + f = ParameterField(func) > + else: > + error(lineno, 'field with no value') and tested: > +++ b/tests/decode/err_field6.decode > @@ -0,0 +1,5 @@ > +# This work is licensed under the terms of the GNU LGPL, version 2 or later. > +# See the COPYING.LIB file in the top-level directory. > + > +# Diagnose no bits in field > +%field