public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug math/7006] Bad left shift in _FP_FRAC_SRS_2 macro in soft-fp/op-2.h on SH-4
       [not found] <bug-7006-131@http.sourceware.org/bugzilla/>
@ 2011-07-03  8:34 ` aj at suse dot de
  2012-02-21  0:22 ` [Bug soft-fp/7006] " jsm28 at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: aj at suse dot de @ 2011-07-03  8:34 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=7006

Andreas Jaeger <aj at suse dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at redhat dot com
         AssignedTo|aj at suse dot de           |rth at redhat dot com

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug soft-fp/7006] Bad left shift in _FP_FRAC_SRS_2 macro in soft-fp/op-2.h on SH-4
       [not found] <bug-7006-131@http.sourceware.org/bugzilla/>
  2011-07-03  8:34 ` [Bug math/7006] Bad left shift in _FP_FRAC_SRS_2 macro in soft-fp/op-2.h on SH-4 aj at suse dot de
@ 2012-02-21  0:22 ` jsm28 at gcc dot gnu.org
  2012-03-06 21:42 ` jsm28 at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2012-02-21  0:22 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=7006

Joseph Myers <jsm28 at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |joseph at codesourcery dot
                   |                            |com
          Component|math                        |soft-fp

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug soft-fp/7006] Bad left shift in _FP_FRAC_SRS_2 macro in soft-fp/op-2.h on SH-4
       [not found] <bug-7006-131@http.sourceware.org/bugzilla/>
  2011-07-03  8:34 ` [Bug math/7006] Bad left shift in _FP_FRAC_SRS_2 macro in soft-fp/op-2.h on SH-4 aj at suse dot de
  2012-02-21  0:22 ` [Bug soft-fp/7006] " jsm28 at gcc dot gnu.org
@ 2012-03-06 21:42 ` jsm28 at gcc dot gnu.org
  2012-03-06 22:52 ` rth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2012-03-06 21:42 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=7006

Joseph Myers <jsm28 at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|rth at redhat dot com       |unassigned at sourceware
                   |                            |dot org

--- Comment #1 from Joseph Myers <jsm28 at gcc dot gnu.org> 2012-03-06 21:40:43 UTC ---
Confirmed still present in current sources.  The proposed fix seems reasonable.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug soft-fp/7006] Bad left shift in _FP_FRAC_SRS_2 macro in soft-fp/op-2.h on SH-4
       [not found] <bug-7006-131@http.sourceware.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2012-03-06 21:42 ` jsm28 at gcc dot gnu.org
@ 2012-03-06 22:52 ` rth at gcc dot gnu.org
  2013-06-17 22:42 ` jsm28 at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: rth at gcc dot gnu.org @ 2012-03-06 22:52 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=7006

Richard Henderson <rth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rth at gcc dot gnu.org

--- Comment #2 from Richard Henderson <rth at gcc dot gnu.org> 2012-03-06 22:51:34 UTC ---
In addition, the "sticky bit term" is

  (__builtin_constant_p(N) && (N) == 1                \
   ? X##_f0 & 1                                       \
   : (X##_f0 << (_FP_W_TYPE_SIZE - (N))) != 0));

which also must be zero for a zero shift.

The same pattern occurs in the _FP_FRAC_SRST_* macros.

All that said, when do we *ever* call the SRS macros
with a zero shift count?  Perhaps my poor grepping 
skills, but all I see is _FP_WFRACBITS_##fs and 
2*wfracbits, where wfracbits is _FP_WFRACBITS...

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug soft-fp/7006] Bad left shift in _FP_FRAC_SRS_2 macro in soft-fp/op-2.h on SH-4
       [not found] <bug-7006-131@http.sourceware.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2012-03-06 22:52 ` rth at gcc dot gnu.org
@ 2013-06-17 22:42 ` jsm28 at gcc dot gnu.org
  2013-06-21 19:02 ` jsm28 at gcc dot gnu.org
  2014-07-01 21:20 ` fweimer at redhat dot com
  6 siblings, 0 replies; 7+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2013-06-17 22:42 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=7006

--- Comment #3 from Joseph Myers <jsm28 at gcc dot gnu.org> ---
Indeed, I don't actually see how the _SRS macros can be called with a shift
count of 0.  In the interest of efficiency, I'm inclined to say we should
define the interfaces to all the shift macros to require a shift count that is
strictly positive and strictly less than the total number of bits in the given
number of words, then review all shift counts for cases that might violate
this; I expect checking for 0 at any rare call sites where it might occur will
be more efficient than making these macros handle the case of 0.

In one such review attempt, I can see the use of *left* shift for converting
integers to floating point may shift by 0.  The following testcase illustrates
that on x86_64 for conversion from unsigned __int128 to __float128 (soft-fp as
used in libgcc):

#include <stdlib.h>

#ifdef COMPILE_TIME
# define VOL /* Empty.  */
#else
# define VOL volatile
#endif

int
main (void)
{
  VOL unsigned long long a = 0x1000000000000ULL;
  VOL unsigned long long b = 0xffffffffffffffffULL;
  unsigned __int128 c = (((unsigned __int128) a) << 64) | b;
  __float128 d = c;
  if (d != 0x1.000000000000ffffffffffffffffp112q)
    abort ();
  exit (0);
}

If you define COMPILE_TIME and build with optimization, the test passes as the
conversion is done at compile time; otherwise, it is done at runtime and a
right-shift by 64 in _FP_FRAC_SLL_2 called to shift left by 0 results in an
incorrect result.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


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

* [Bug soft-fp/7006] Bad left shift in _FP_FRAC_SRS_2 macro in soft-fp/op-2.h on SH-4
       [not found] <bug-7006-131@http.sourceware.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2013-06-17 22:42 ` jsm28 at gcc dot gnu.org
@ 2013-06-21 19:02 ` jsm28 at gcc dot gnu.org
  2014-07-01 21:20 ` fweimer at redhat dot com
  6 siblings, 0 replies; 7+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2013-06-21 19:02 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=7006

Joseph Myers <jsm28 at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Joseph Myers <jsm28 at gcc dot gnu.org> ---
What I believe was the only remaining case of a zero shift count being passed
to one of the shift macros is fixed for 2.18 by:

commit 8fdda7afb883589b46e423f91f32988373670bfa
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Fri Jun 21 19:00:43 2013 +0000

    Fix bad shift in soft-fp (bug 7006).

If you find other cases of zero shift counts being passed to these macros,
please file new bugs for them.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


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

* [Bug soft-fp/7006] Bad left shift in _FP_FRAC_SRS_2 macro in soft-fp/op-2.h on SH-4
       [not found] <bug-7006-131@http.sourceware.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2013-06-21 19:02 ` jsm28 at gcc dot gnu.org
@ 2014-07-01 21:20 ` fweimer at redhat dot com
  6 siblings, 0 replies; 7+ messages in thread
From: fweimer at redhat dot com @ 2014-07-01 21:20 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=7006

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
              Flags|                            |security-

-- 
You are receiving this mail because:
You are on the CC list for the bug.


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

end of thread, other threads:[~2014-07-01 21:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-7006-131@http.sourceware.org/bugzilla/>
2011-07-03  8:34 ` [Bug math/7006] Bad left shift in _FP_FRAC_SRS_2 macro in soft-fp/op-2.h on SH-4 aj at suse dot de
2012-02-21  0:22 ` [Bug soft-fp/7006] " jsm28 at gcc dot gnu.org
2012-03-06 21:42 ` jsm28 at gcc dot gnu.org
2012-03-06 22:52 ` rth at gcc dot gnu.org
2013-06-17 22:42 ` jsm28 at gcc dot gnu.org
2013-06-21 19:02 ` jsm28 at gcc dot gnu.org
2014-07-01 21:20 ` fweimer at redhat dot com

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 read-only IMAP folder(s) and NNTP newsgroup(s).