public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/107745] New: long double constexprs don't work with * or /, but work with + and - (JUST ON PPC)
@ 2022-11-18  8:50 Sebastian at SSpaeth dot de
  2022-11-18  9:00 ` [Bug c++/107745] " schwab@linux-m68k.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Sebastian at SSpaeth dot de @ 2022-11-18  8:50 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-02-20 17:19 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-18  8:50 [Bug c++/107745] New: long double constexprs don't work with * or /, but work with + and - (JUST ON PPC) Sebastian at SSpaeth dot de
2022-11-18  9:00 ` [Bug c++/107745] " schwab@linux-m68k.org
2022-11-18  9:07 ` Sebastian at SSpaeth dot de
2022-11-18  9:14 ` pinskia at gcc dot gnu.org
2022-11-18  9:19 ` jakub at gcc dot gnu.org
2022-11-18  9:36 ` Sebastian at SSpaeth dot de
2024-02-20 15:14 ` xry111 at gcc dot gnu.org
2024-02-20 15:26 ` iains at gcc dot gnu.org
2024-02-20 17:19 ` redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).