Skip to content

Commit

Permalink
softfloat: fix crash on int conversion of SNaN
Browse files Browse the repository at this point in the history
Signed-off-by: Stef O'Rear <[email protected]>
Reviewed-by: Alex Bennée <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
  • Loading branch information
sorear authored and pm215 committed Mar 9, 2018
1 parent d9bbfea commit cffad42
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions fpu/softfloat.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit cffad42

Please sign in to comment.