Message ID | 20180305084111.GM2450@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Richard W.M. Jones <rjones@redhat.com> writes: > The attached patch is also needed to avoid crashes during various > math-heavy test suites. > > Rich. > > -- <snip> > From: Stef O'Rear <sorear2@gmail.com> > Date: Sat, 3 Mar 2018 03:46:00 -0800 > Subject: [PATCH] softfloat: fix crash on int conversion of SNaN > > Signed-off-by: Stef O'Rear <sorear2@gmail.com> > --- > fpu/softfloat.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/fpu/softfloat.c b/fpu/softfloat.c > index e7fb0d357a..1da1db377e 100644 > --- a/fpu/softfloat.c > +++ b/fpu/softfloat.c > @@ -1342,6 +1342,8 @@ static int64_t round_to_int_and_pack(FloatParts in, int rmode, > switch (p.cls) { > case float_class_snan: > case float_class_qnan: > + case float_class_dnan: > + case float_class_msnan: > return max; > case float_class_inf: > return p.sign ? min : max; > @@ -1430,6 +1432,8 @@ static uint64_t round_to_uint_and_pack(FloatParts in, int rmode, uint64_t max, > switch (p.cls) { > case float_class_snan: > case float_class_qnan: > + case float_class_dnan: > + case float_class_msnan: > s->float_exception_flags = orig_flags | float_flag_invalid; > return max; > case float_class_inf: Obviously I wasn't exercising the NaN exit paths enough and we added the return_nan() common code fairly late in the series. Reviewed-by: Alex Bennée <alex.bennee@linaro.org> -- Alex Bennée
On Mon, Mar 5, 2018 at 9:41 PM, Richard W.M. Jones <rjones@redhat.com> wrote: > > The attached patch is also needed to avoid crashes during various > math-heavy test suites. > Thanks. I missed your email. I've integrated this and the other outstanding patches into the `riscv-all` branch in the riscv repo here. - https://github.com/riscv/riscv-qemu/commits/riscv-all This also triggered aborts on riscv-tests, which is all the more reason to get riscv-tests running in the CI so we spot these things early. Thanks, Michael. Rich. > > From: Stef O'Rear <address@hidden> > > Date: Sat, 3 Mar 2018 03:46:00 -0800 > > Subject: [PATCH] softfloat: fix crash on int conversion of SNaN > > >> Signed-off-by: Stef O'Rear <address@hidden> > > Signed-off-by: Michael Clark <mjc@sifive.com> > --- > > fpu/softfloat.c | 4 ++++ > > 1 file changed, 4 insertions(+) > > >> diff --git a/fpu/softfloat.c b/fpu/softfloat.c > > index e7fb0d357a..1da1db377e 100644 > > --- a/fpu/softfloat.c > > +++ b/fpu/softfloat.c > > @@ -1342,6 +1342,8 @@ static int64_t round_to_int_and_pack(FloatParts in, >> int rmode, > > switch (p.cls) { > > case float_class_snan: > > case float_class_qnan: > > + case float_class_dnan: > > + case float_class_msnan: > > return max; > > case float_class_inf: > > return p.sign ? min : max; > > @@ -1430,6 +1432,8 @@ static uint64_t round_to_uint_and_pack(FloatParts >> in, int rmode, uint64_t max, > > switch (p.cls) { > > case float_class_snan: > > case float_class_qnan: > > + case float_class_dnan: > > + case float_class_msnan: > > s->float_exception_flags = orig_flags | float_flag_invalid; > > return max; > > case float_class_inf: > > -- > > 2.15.1 > > >
On 5 March 2018 at 08:41, Richard W.M. Jones <rjones@redhat.com> wrote: > > The attached patch is also needed to avoid crashes during various > math-heavy test suites. Applied to master, thanks. FYI, sending patches as attachments in the middle of a long thread on something else is a good way to cause them to get lost. Luckily Michael ran into the same bug again and that reminded me to fish this one out. thanks -- PMM
On Fri, Mar 09, 2018 at 04:43:34PM +0000, Peter Maydell wrote: > On 5 March 2018 at 08:41, Richard W.M. Jones <rjones@redhat.com> wrote: > > > > The attached patch is also needed to avoid crashes during various > > math-heavy test suites. > > Applied to master, thanks. > > FYI, sending patches as attachments in the middle of a long > thread on something else is a good way to cause them to get > lost. Luckily Michael ran into the same bug again and that > reminded me to fish this one out. Yup sorry I thought that the patch had been separately submitted, but apparently it never was. Rich.
diff --git a/fpu/softfloat.c b/fpu/softfloat.c index e7fb0d357a..1da1db377e 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -1342,6 +1342,8 @@ static int64_t round_to_int_and_pack(FloatParts in, int rmode, switch (p.cls) { case float_class_snan: case float_class_qnan: + case float_class_dnan: + case float_class_msnan: return max; case float_class_inf: return p.sign ? min : max; @@ -1430,6 +1432,8 @@ static uint64_t round_to_uint_and_pack(FloatParts in, int rmode, uint64_t max, switch (p.cls) { case float_class_snan: case float_class_qnan: + case float_class_dnan: + case float_class_msnan: s->float_exception_flags = orig_flags | float_flag_invalid; return max; case float_class_inf: