Hi Sergey,

Thanks for offering.  On powerpc*-darwin* libgfortran uses
config/fpu-macppc.h, and the patch changes only get_fpu_state and
set_fpu_state there: fegetenv/fesetenv now go through a local fenv_t
that is memcpy'd to and from the buffer.

1. Apply the patch to a trunk checkout and build as you usually do.
   Use the attachment from my previous mail, or the raw copy in the
   archive:

     curl -s 
https://inbox.sourceware.org/gcc-patches/gcc-upstream.upstream-bugfix-1004-pr82968.v1.20261019t2231...@tachyum.com/raw
 | git am

   Outside gcc/testsuite it changes only libgfortran, so if you
   already have a trunk build tree, "make all-target-libgfortran" is
   enough.

2. Run the IEEE tests from the build directory:

     make check-gfortran RUNTESTFLAGS="ieee.exp"

   They are the tests that save and restore the FPU state (ieee_6.f90,
   the IEEE_GET/SET_STATUS ones and the new pr82968.f90).  For just the
   new test, use RUNTESTFLAGS="ieee.exp=pr82968.f90".

3. Compare gcc/testsuite/gfortran/gfortran.sum with an unpatched build
   (or with your 16.2.0 results, if you kept them): pr82968.f90 should
   PASS, with no new FAILs.

I don't expect the unpatched code to fault on PowerPC.  fenv_t there is
a 32-bit integer, and the processor (or the kernel, for the rare access
that crosses a boundary) copes with misaligned word loads and stores,
unlike SPARC.  pr82968.f90 may therefore pass with and without the
patch.  What your run would show is that fpu-macppc.h still compiles,
and that the rounding mode round-trips through IEEE_GET_STATUS and
IEEE_SET_STATUS when the status is at an odd offset.  That is useful in
itself, since my x86_64 regtest only built fpu-387.h.

Thanks,
Igor

Reply via email to