https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97653

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1
   Target Milestone|---                         |11.0
            Summary|Incorrect long double       |[11 Regression] Incorrect
                   |calculation with            |long double calculation
                   |-mabi=ibmlongdouble         |with -mabi=ibmlongdouble

--- Comment #14 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
So, what I missed was that my gcc on gccfarm has been configured without the
--with-long-double-format=ieee option, but Jonathan's gcc has been configured
with that option.
When compiling the #c9 testcase with -mabi=ibmlongdouble , both on compiler
that
was configured --with-long-double-format=ieee and on compiler that was
configured without it, gcc emits calls to
__floatunditf
__gcc_qmul
__fixunstfdi
while when compiling the testcase with -mabi=ieeelongdouble , on both compilers
it emits calls to
__floatundikf
__mulkf3
__fixunskfdi
So far so good.

The problem I see is that depending on how gcc has been configured, libgcc
changes.
In gcc configured without --with-long-double-format=ieee , I see
__floatunditf calling __gcc_qadd and __gcc_qmul, so looks that the tf it talks
about is IBM double double aka if.
But looking at __floatunditf on --with-long-double-format=ieee configured gcc,
I see it calls __floatundikf, __mulkf3 and __addkf3.  So it looks both like ABI
incompatibility and something else weird going on, because if it was treating
the
tf as kf, why would it call __floatundikf and something on top of that?
Skimming other __*tf* functions in libgcc.a in --with-long-double-format=ieee
configured gcc, __powitf2 calls __gcc_q{mul,div}, so might be ok,
__eprintf calls __fprintfieee128 rather than fprintf from the other gcc,
but maybe it is ok because it passes to fprintf only arguments that are not
floating point.
__fixtfdi calls __lekf2, so looks ABI incompatible, ditto __fixunstfdi,
__floatditf calls __gcc_q{mul,add}, so might be ok, __fixtfti calls __lekf2,
so looks ABI incompatible, ditto __fixunstfti, __floattitf also looks broken,
ditto __floatuntitf.
Ignoring the decimal stuff (_dpd*).

So, if we want backwards ABI compatibility, I'm afraid when building libgcc,
at least the *tf* entry points, they should be built with explicit
-mabi=ibmlongdouble or otherwise ensure it is using IFmode rather than TFmode
stuff.

Reply via email to