Hello

With the latest version of gcc-toolchain in Guix (14.2.0), macros from the
<cfenv> header aren't defined during compilation with g++.  Version 13 of
gcc-toolchain doesn't have this problem.

Reproducer:

Create a file called test.cpp with contents:

    #include <stdio.h>
    #include <cfenv>

    int main() {
        #ifdef FE_DIVBYZERO
            printf("FE_DIVBYZERO is defined\n");
        #else
            printf("FE_DIVBYZERO is NOT defined\n");
        #endif

        return 0;
    }

$ guix shell -C gcc-toolchain@14 -- g++ test.cpp && ./a.out
FE_DIVBYZERO is NOT defined

$ guix shell -C gcc-toolchain@13 -- g++ test.cpp && ./a.out
FE_DIVBYZERO is defined

If we include the C equivalent <fenv.h> instead of <cfenv>, again g++ finds
it in version 13 but not in version 14 of gcc-toolchain.
Note that gcc from gcc-toolchain@14 does find the macro from <fenv.h>
(provided the source file has .c extension).

Other macros from <cfenv> are also affected with g++, including
FE_OVERFLOW, FE_UNDERFLOW, FE_INEXACT, and FE_INVALID.

This bug is probably the same as 43579 (feclearexcept with g++)
https://issues.guix.gnu.org/43579

I've copied in the members of core-packages team.

guix a53bd6f

Thanks!
Jake

Reply via email to