LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* minor bug in invalid exception patch
@ 2008-10-22  6:24 David Miller
  2008-10-23  5:10 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: David Miller @ 2008-10-22  6:24 UTC (permalink / raw)
  To: galak; +Cc: linux-kernel


While looking over some recent changes to op-common.h I found
a minor error in:

commit 48d6c64311ddb6417b901639530ccbc47bdc7635
Author: Kumar Gala <galak@kernel.crashing.org>
Date:   Fri Jun 27 09:39:00 2008 -0500

    math-emu: Add support for reporting exact invalid exception

that I didn't catch in my initial review :)  Sorry.

Specifically:

@@ -490,11 +490,15 @@ do {							\
     break;						\
 							\
   case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_INF):		\
+    R##_s = _FP_NANSIGN_##fs;				\
+    R##_c = FP_CLS_NAN;					\
+    _FP_FRAC_SET_##wc(R, _FP_NANFRAC_##fs);		\
+    FP_SET_EXCEPTION(FP_EX_INVALID | FP_EX_INVALID_IDI);\
   case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_ZERO):	\
     R##_s = _FP_NANSIGN_##fs;				\
     R##_c = FP_CLS_NAN;					\
     _FP_FRAC_SET_##wc(R, _FP_NANFRAC_##fs);		\
-    FP_SET_EXCEPTION(FP_EX_INVALID);			\
+    FP_SET_EXCEPTION(FP_EX_INVALID | FP_EX_INVALID_ZDZ);\
     break;						\
 							\
   default:						\

That first case statement code block falls through to
the next one, which is probably not as you intended.

Seems there is a missing break there.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: minor bug in invalid exception patch
  2008-10-22  6:24 minor bug in invalid exception patch David Miller
@ 2008-10-23  5:10 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2008-10-23  5:10 UTC (permalink / raw)
  To: galak; +Cc: linux-kernel

From: David Miller <davem@davemloft.net>
Date: Tue, 21 Oct 2008 23:24:21 -0700 (PDT)

> Specifically:
> 
> @@ -490,11 +490,15 @@ do {							\
>      break;						\
>  							\
>    case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_INF):		\
> +    R##_s = _FP_NANSIGN_##fs;				\
> +    R##_c = FP_CLS_NAN;					\
> +    _FP_FRAC_SET_##wc(R, _FP_NANFRAC_##fs);		\
> +    FP_SET_EXCEPTION(FP_EX_INVALID | FP_EX_INVALID_IDI);\
>    case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_ZERO):	\
>      R##_s = _FP_NANSIGN_##fs;				\
>      R##_c = FP_CLS_NAN;					\
>      _FP_FRAC_SET_##wc(R, _FP_NANFRAC_##fs);		\
> -    FP_SET_EXCEPTION(FP_EX_INVALID);			\
> +    FP_SET_EXCEPTION(FP_EX_INVALID | FP_EX_INVALID_ZDZ);\
>      break;						\
>  							\
>    default:						\
> 
> That first case statement code block falls through to
> the next one, which is probably not as you intended.
> 
> Seems there is a missing break there.

I'm going to commit the following to fix this:

--------------------

math-emu: Fix thinko in _FP_DIV

In commit 48d6c64311ddb6417b901639530ccbc47bdc7635 ("math-emu: Add
support for reporting exact invalid exception") code was added to
set the new FP_EX_INVALID_{IDI,ZDZ} exception flag bits.

However there is a missing break statement for the
_FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_INF) switch case, the
code just falls into _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_ZERO)
which then proceeds to overwrite all of the settings.

Fix by adding the missing break.

Signed-off-by: David S. Miller <davem@davemloft.net>
---
 include/math-emu/op-common.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/math-emu/op-common.h b/include/math-emu/op-common.h
index bc50aa0..f456534 100644
--- a/include/math-emu/op-common.h
+++ b/include/math-emu/op-common.h
@@ -503,6 +503,8 @@ do {							\
     R##_c = FP_CLS_NAN;					\
     _FP_FRAC_SET_##wc(R, _FP_NANFRAC_##fs);		\
     FP_SET_EXCEPTION(FP_EX_INVALID | FP_EX_INVALID_IDI);\
+    break;						\
+							\
   case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_ZERO):	\
     R##_s = _FP_NANSIGN_##fs;				\
     R##_c = FP_CLS_NAN;					\
-- 
1.5.6.5


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-10-23  5:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-22  6:24 minor bug in invalid exception patch David Miller
2008-10-23  5:10 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).