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

            Bug ID: 117331
           Summary: constexpr with "long double" fails on ppc64el
           Product: gcc
           Version: 14.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dev at umlaeute dot mur.at
  Target Milestone: ---

Created attachment 59474
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59474&action=edit
output of "g++ -save-temps  -o test.o test.cpp"

I'm trying to build some software for Debian's ppc64el architeture (aka
powerpc64le), and it miserably fails:

```
$ g++ --version
g++ (Debian 14.2.0-7) 14.2.0
```

It seems the culprit is a `constexpr` with `long double`.

E.g. a simple file with these contents:
```C++
void test() {
   constexpr auto oneThird = ((long double) 1)/ ((long double) 3);
}
```

fails to compile when built with the following error:
```
$ g++ -save-temps  -o test.o test.cpp 
test.cpp: In instantiation of 'T test() [with T = long double]':
test.cpp:9:19:   required from here
    9 |         test<long double>();
      |         ~~~~~~~~~~~~~~~~~^~
test.cpp:4:34: error: '(1.0e+0l / 3.0e+0l)' is not a constant expression
    4 |    constexpr auto oneThird = one / (T) 3;
      |                              ~~~~^~~~~~~
```

(The produced `test.ii` file is attached to this bug-report).

According to godbolt, gcc fails on any powerpc architecture, but succeeds with
"others" (I have only tried common ones, like x86_64).
It seems that clang (as per godbolt) can compile the code on powerpc64le just
fine.

Reply via email to