[Bug c++/125642] [LoongArch] `__FRACT_FBIT__` predefined in C++ mode despite `_Fract` keyword being unsupported

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sun Jun 7 08:18:44 GMT 2026


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

--- Comment #3 from Drea Pinski <pinskia at gcc dot gnu.org> ---
Confirmed, this has been a bug since _Fract support was added with
r0-83137-g0f996086cbf162. long before loongarch was done.

Simple fix:
```
diff --git a/gcc/c-family/c-cppbuiltin.cc b/gcc/c-family/c-cppbuiltin.cc
index 7296ee8b3ba..900843e8d03 100644
--- a/gcc/c-family/c-cppbuiltin.cc
+++ b/gcc/c-family/c-cppbuiltin.cc
@@ -1378,7 +1378,7 @@ c_cpp_builtins (cpp_reader *pfile)
     }

   /* For fixed-point fibt, ibit, max, min, and epsilon.  */
-  if (targetm.fixed_point_supported_p ())
+  if (!c_dialect_cxx () && targetm.fixed_point_supported_p ())
     {
       builtin_define_fixed_point_constants ("SFRACT", "HR",
                                            short_fract_type_node);

```

This is preapproved if this fixes the issue.


More information about the Gcc-bugs mailing list