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

            Bug ID: 111343
           Summary: [SH] Including <cmath> in C++23 causes an ICE with
                    -m4-single-only
           Product: gcc
           Version: 13.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gyrovorbis at gmail dot com
  Target Milestone: ---

We recently updated from GCC12 to GCC13 in the Sega Dreamcast indie SDK,
KallistiOS, and while pretty much everything has worked fantastically, we are
encountering a pretty serious ICE when attempting to include the <cmath> header
with the -m4-single-only SH-specific flag (which treats doubles as floats),
when compiling as C++23.

The minimal program to reproduce the issue is here:

#include <cmath>

int main(int argc, char* argv[]) { 
    return 0;
}

We are building with: -std=c++23 -m4-single-only


Note that without the -m4-single-only flag, the ICE disappears. Note also that
without including <cmath>, with this flag, the following static assertion
fails:

static_assert(sizeof(__STDCPP_FLOAT64_T__) == 8,
             "Oh god, Dreamcast broke!");


Here is a link to a repro in Compiler Explorer: https://godbolt.org/z/MrE8a47oq

I'm assuming the addition of the new C++23 <stdfloat> types is clashing with
the `-m4-single-only` flag, as it doesn't seem as though when these types are
created, there is any checking for sizeof(double) or anything target-specific:
https://github.com/gcc-mirror/gcc/blob/a7d052b3200c7928d903a0242b8cfd75d131e374/gcc/c-family/c-cppbuiltin.cc#L1265

Reply via email to