This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch master updated. glibc-2.20-75-g0022e68


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  0022e688d082761a1e15b19121303cafbdad33ec (commit)
      from  73e28d9c885fdfed91e6d70c4aab7e8e801818e3 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=0022e688d082761a1e15b19121303cafbdad33ec

commit 0022e688d082761a1e15b19121303cafbdad33ec
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Thu Oct 9 01:07:10 2014 +0000

    soft-fp: Fix _FP_TO_INT latent bug in overflow handling.
    
    This patch fixes a latent bug in _FP_TO_INT regarding handling of
    arguments with maximum exponent (infinities and NaNs).  If the maximum
    exponent is below that calculated as an overflow threshold, such
    values would incorrectly be treated as normal values for the purposes
    of the conversion.  This could not occur for any of the conversions
    actually occurring in glibc, libgcc or the Linux kernel (the maximum
    exponent for float is, just, big enough to ensure overflow for
    unsigned __int128), but would apply if soft-fp were used for IEEE
    binary16.  Appropriate checks are inserted to ensure that the maximum
    exponent is always treated as an overflowing exponent, and never as a
    normal one.
    
    Tested for powerpc-nofpu that the disassembly of installed shared
    libraries is unchanged by this patch.
    
    	* soft-fp/op-common.h (_FP_TO_INT): Ensure maximum exponent is
    	treated as invalid conversion, not as normal exponent.

diff --git a/ChangeLog b/ChangeLog
index f95e3ed..18d1cbc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2014-10-09  Joseph Myers  <joseph@codesourcery.com>
 
+	* soft-fp/op-common.h (_FP_TO_INT): Ensure maximum exponent is
+	treated as invalid conversion, not as normal exponent.
+
 	* soft-fp/op-common.h (_FP_CMP_CHECK_NAN): New macro.
 	(_FP_CMP): Add extra argument EX.  Call _FP_CMP_CHECK_NAN.
 	(_FP_CMP_EQ): Likewise.
diff --git a/soft-fp/op-common.h b/soft-fp/op-common.h
index e62558e..e0a108a 100644
--- a/soft-fp/op-common.h
+++ b/soft-fp/op-common.h
@@ -1368,7 +1368,9 @@
 	  else								\
 	    FP_SET_EXCEPTION (FP_EX_INEXACT);				\
 	}								\
-      else if (X##_e >= _FP_EXPBIAS_##fs + rsize - (rsigned > 0 || X##_s) \
+      else if (X##_e >= (_FP_EXPMAX_##fs < _FP_EXPBIAS_##fs + rsize	\
+			 ? _FP_EXPMAX_##fs				\
+			 : _FP_EXPBIAS_##fs + rsize - (rsigned > 0 || X##_s)) \
 	       || (!rsigned && X##_s))					\
 	{								\
 	  /* Overflow or converting to the most negative integer.  */	\
@@ -1385,7 +1387,10 @@
 		r = ~r;							\
 	    }								\
 									\
-	  if (rsigned && X##_s && X##_e == _FP_EXPBIAS_##fs + rsize - 1) \
+	  if (_FP_EXPBIAS_##fs + rsize - 1 < _FP_EXPMAX_##fs		\
+	      && rsigned						\
+	      && X##_s							\
+	      && X##_e == _FP_EXPBIAS_##fs + rsize - 1)			\
 	    {								\
 	      /* Possibly converting to most negative integer; check the \
 		 mantissa.  */						\

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

Summary of changes:
 ChangeLog           |    3 +++
 soft-fp/op-common.h |    9 +++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]