Hi Bruno,
I found that the fenv-env tests do not compile on sh4. This is the
error:
test-fenv-env-2.c: In function 'main':
test-fenv-env-2.c:49:15: error: 'FE_UPWARD' undeclared (first use in this
function)
49 | fesetround (FE_UPWARD);
| ^~~~~~~~~
test-fenv-env-2.c:49:15: note: each undeclared identifier is reported only
once for each function it appears in
test-fenv-env-2.c:76:15: error: 'FE_DOWNWARD' undeclared (first use in this
function)
76 | fesetround (FE_DOWNWARD);
| ^~~~~~~~~~~
make[4]: *** [Makefile:28483: test-fenv-env-2.o] Error 1
If I understand correctly, these macros should not be defined on this
platform. Since ISO C23 § 7.6 states:
Each of the macros [List of FE_* macros] is defined if and only if
the implementation supports getting and setting the represented
round-ing direction by means of the fegetround and fesetround
functions.
Based on the SH-4 CPU Core Architecture document § 6.3 [1], this
architecture only supports Round to Nearest (FE_TONEAREST) and Round to
Zero (FE_TOWARDZERO).
Should these tests do something like this?
/* Modify the current environment. */
#if !defined __sh__
#define ENV1_ROUNDING_DIRECTION FE_TONEAREST
#define ENV2_ROUNDING_DIRECTION FE_TOWARDZERO
#else
#define ENV1_ROUNDING_DIRECTION FE_UPWARD
#define ENV2_ROUNDING_DIRECTION FE_DOWNWARD
#endif
Collin
[1]
https://www.st.com/resource/en/user_manual/cd00147165-sh-4-32-bit-cpu-core-architecture-stmicroelectronics.pdf