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

            Bug ID: 107745
           Summary: long double constexprs don't work with * or /, but
                    work with + and - (JUST ON PPC)
           Product: gcc
           Version: 12.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: Sebastian at SSpaeth dot de
  Target Milestone: ---

TL;DR:
This looks like a compiler bug or quality-of-implementation issue, and happens
JUST ON PPC with gcc. From a bit of playing with godbolt, long double
constexprs don't work with * or /, but work with + and -.

https://godbolt.org/z/WYz5fY538

This works fine on everything but PPC that I tried. It also works with PPC
clang, but not PPC gcc. Could you report this to gcc and see what they say?

The shortest reproducible snippet is:

constexpr long double v =
    (6.15348059642740421245081038903225e-15L /
     5.40431955284459475358983848622456e+16L);


Details in upstream issue at https://github.com/google/s2geometry/issues/279

---------------------


The library built fine on all supported archs using Debian's gcc
(g++-12_12.2.0-7 gcc-12_12.2.0-7 libc6-dev_2.35-4 libstdc++-12-dev_12.2.0-7
libstdc++6_12.2.0-7 linux-libc-dev_6.0.3-1) EXCEPT for PPC.

The full failed build log is currently still at:
https://buildd.debian.org/status/fetch.php?pkg=s2geometry&arch=ppc64el&ver=0.10.0-2&stamp=1667081576&raw=0

-------------------

Build failure boils down to the error
```
/<<PKGBUILDDIR>>/src/s2/s2edge_crossings.cc: In instantiation of ‘bool
S2::internal::GetStableCrossProd(const Vector3<T>&, const Vector3<T>&,
Vector3<T>*) [with T = long double]’:
/<<PKGBUILDDIR>>/src/s2/s2edge_crossings.cc:127:54:   required from here
/<<PKGBUILDDIR>>/src/s2/s2edge_crossings.cc:115:31: error:
‘(6.15348059642740421245081038903225e-15l /
5.40431955284459475358983848622456e+16l)’ is not a constant expression
  115 |       (32 * kSqrt3 * DBL_ERR) /
      |       ~~~~~~~~~~~~~~~~~~~~~~~~^
  116 |       (kRobustCrossProdError.radians() / T_ERR - (1 + 2 * kSqrt3));
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```


Please let us know if you need more information.

Reply via email to