https://gcc.gnu.org/bugzilla/show_bug.cgi?id=19779
--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> --- (In reply to Iain Sandoe from comment #9) > (In reply to Andrew Pinski from comment #8) > > (In reply to Sergey Fedorov from comment #6) > > > (In reply to Andrew Pinski from comment #0) > > > > This is the new bug for PR 19405. Keeping track of that we no longer > > > > constant fold long doubles in the > > > > IBM 128bit long double format. > > > > > > What is the current status of the issue? > > > > Nothing has changed here that much. Though powerpc64 le is heading towards > > doing IEEE 128bit FP by default so this might be much much less of an issue > > for most people which means this is more likely never get fixed. > > it occasionally causes grief, but so far there's been a work-around; I guess > if someone really wanted to make a patch - they'd have to use MPFR et. al. > to do the work. MPFR won't really help, after all, it doesn't have any double double arithmetic support at all. The problem is that real.cc pretends that IBM double double is a sane floating point format with 106bit precision, which is not the case. In GCC, basic floating point operations are performed by performing stuff in the GCC internal format, which is something with sufficient precision and exponent range to cover all the sane supported formats including some extra precision bits and then converting that to the appropriate mode. That doesn't work for double double, which has precision between 53 to some thousands bits of precision, so in order to emulate in the compiler basic floating point, it would need to be handled like it is actually at runtime, which is hold the REAL_CST/CONST_DOUBLE double double values as a pair of DFmode values rather than a single real_internal_format value (because the latter can't express all the double double values), perform whatever __gcc_qadd/__gcc_qsub/__gcc_qmul/__gcc_qdiv etc. perform at runtime on the DFmode values, etc. And then there is a question what to do about emulation of libm functions - how to map that e.g. to mpfr operations, because what libm actually does for those is sometimes quite weird and hard to define.