[Bug 1987266] Re: test-ibm128-llround fails on ppc64el when built with gcc-12 and -O2 or higher

Bug Watch Updater 1987266 at bugs.launchpad.net
Thu Sep 1 18:39:12 UTC 2022


Launchpad has imported 6 comments from the remote bug at
https://sourceware.org/bugzilla/show_bug.cgi?id=29488.

If you reply to an imported comment from within Launchpad, your comment
will be sent to the remote bug automatically. Read more about
Launchpad's inter-bugtracker facilities at
https://help.launchpad.net/InterBugTracking.

------------------------------------------------------------------------
On 2022-08-15T01:31:00+00:00 Michael Hudson-Doyle wrote:

root at kinetic:~/build# ./elf/ld.so --library-path .:math ./math/test-ibm128-llround
testing long double (without inline functions)
Failure: llround (0x7fffffffffffffff.8p0): Exception "Invalid operation" not set
Failure: llround_downward (0x7fffffffffffffff.8p0): Exception "Invalid operation" not set
Failure: llround_towardzero (0x7fffffffffffffff.8p0): Exception "Invalid operation" not set
Failure: llround_upward (0x7fffffffffffffff.8p0): Exception "Invalid operation" not set

Test suite completed:
  1156 test cases plus 656 tests for exception flags and
    656 tests for errno executed.
  4 errors occurred.

Recompiling math/s_llroundl.os with gcc-11 or with gcc-12 -O1 is enough
to fix this. Looking at the disassembly though I'm completely confused,
feraiseexcept (FE_INVALID); is still getting called in the failing case
and the code that runs after that looks the same (I've spent far too
long trying to debug this). I've uploaded the .o files to
https://people.canonical.com/~mwh/good.o and
https://people.canonical.com/~mwh/bad.o -- good luck to the next person!

Reply at: https://bugs.launchpad.net/ubuntu-power-
systems/+bug/1987266/comments/0

------------------------------------------------------------------------
On 2022-08-18T02:06:13+00:00 Michael Hudson-Doyle wrote:

Ah my previous debugging was confused, feraiseexcept is not being
reached and the issue is that the algorithm depends on signed overflow
at
https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/ieee754/ldbl-128ibm/s_llroundl.c;h=d85154e73ac062e6c9ed403fe3cfc3889726ff72;hb=2b274fd8c9c776cf70fcdb8356e678ada522a7b0#l86
which is of course undefined behaviour. I don't completely understand
the algorithm so don't really know how to fix this (or, honestly, how
much I care about edge cases in ldbl-128ibm arithmetic...)

Reply at: https://bugs.launchpad.net/ubuntu-power-
systems/+bug/1987266/comments/1

------------------------------------------------------------------------
On 2022-08-18T16:11:31+00:00 Joseph-codesourcery wrote:

Making res unsigned, and casting hi and lo to unsigned long long in the 
"res = hi + lo;" statement, and casting res back to long long in the two 
places it gets compared against 0, would be the obvious approach to avoid 
signed overflow.

Reply at: https://bugs.launchpad.net/ubuntu-power-
systems/+bug/1987266/comments/2

------------------------------------------------------------------------
On 2022-08-20T21:09:28+00:00 Michael Hudson-Doyle wrote:

I thought casting out-of-range unsigned to signed was undefined as well?

Reply at: https://bugs.launchpad.net/ubuntu-power-
systems/+bug/1987266/comments/3

------------------------------------------------------------------------
On 2022-08-20T22:06:29+00:00 Andreas Schwab wrote:

It is implementation defined.

Reply at: https://bugs.launchpad.net/ubuntu-power-
systems/+bug/1987266/comments/4

------------------------------------------------------------------------
On 2022-08-21T10:44:19+00:00 Michael Hudson-Doyle wrote:

(In reply to Andreas Schwab from comment #4)
> It is implementation defined.

Oh right. Anyway the suggestion helps so I'll mail a patch.

Reply at: https://bugs.launchpad.net/ubuntu-power-
systems/+bug/1987266/comments/5


** Changed in: glibc
       Status: Unknown => New

** Changed in: glibc
   Importance: Unknown => Medium

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to glibc in Ubuntu.
https://bugs.launchpad.net/bugs/1987266

Title:
  test-ibm128-llround fails on ppc64el when built with gcc-12 and -O2 or
  higher

Status in GLibC:
  New
Status in The Ubuntu-power-systems project:
  New
Status in glibc package in Ubuntu:
  New

Bug description:
  root at kinetic:~/build# ./elf/ld.so --library-path .:math ./math/test-ibm128-llround
  testing long double (without inline functions)
  Failure: llround (0x7fffffffffffffff.8p0): Exception "Invalid operation" not set
  Failure: llround_downward (0x7fffffffffffffff.8p0): Exception "Invalid operation" not set
  Failure: llround_towardzero (0x7fffffffffffffff.8p0): Exception "Invalid operation" not set
  Failure: llround_upward (0x7fffffffffffffff.8p0): Exception "Invalid operation" not set

  Test suite completed:
    1156 test cases plus 656 tests for exception flags and
      656 tests for errno executed.
    4 errors occurred.

  Recompiling math/s_llroundl.os with gcc-11 or with gcc-12 -O1 is
  enough to fix this. Looking at the disassembly though I'm completely
  confused, feraiseexcept (FE_INVALID); is still getting called in the
  failing case and the code that runs after that looks the same (I've
  spent far too long trying to debug this). I've uploaded the .o files
  to https://people.canonical.com/~mwh/good.o and
  https://people.canonical.com/~mwh/bad.o -- good luck to the next
  person!

  A potential fix is here:
  https://sourceware.org/pipermail/libc-alpha/2022-August/141547.html

  For more details and discussions have a look at the attached upstream
  bug.

To manage notifications about this bug go to:
https://bugs.launchpad.net/glibc/+bug/1987266/+subscriptions




More information about the foundations-bugs mailing list