Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fenv.h is not implemented in Newlib #581

Open
kolerov opened this issue Sep 22, 2023 · 3 comments
Open

fenv.h is not implemented in Newlib #581

kolerov opened this issue Sep 22, 2023 · 3 comments

Comments

@kolerov
Copy link
Collaborator

kolerov commented Sep 22, 2023

fenv.h header file declares functions and macros for working with floating-point environment: exceptions, flags, etc. It's not critical, but some FP test suites use it. Thus, it may be useful to have it implemented.

@abrodkin
Copy link
Member

@kolerov could you please elaborate a bit on real issues you've faced with?

@kolerov
Copy link
Collaborator Author

kolerov commented Sep 22, 2023

Here is an example of a FP test suite that uses fenv.h: http://www.tybor.com, tflt2int.c source file. However, I found that a lot of other test suites use it too. It's implemented in MWDT. Here is an error:

$ arc-elf32-gcc -mcpu=hs4x -mfpu=fpud_all -specs=nsim.specs -std=gnu11 TFLT2INT.C -lm -o TFLT2INT
TFLT2INT.C: In function 'void tst_02()':
TFLT2INT.C:667:14: error: 'FE_INVALID' was not declared in this scope
  667 |       if( !((FE_INVALID) & flags) ){\
      |              ^~~~~~~~~~

@abrodkin
Copy link
Member

The same gets in the way on execution of the SuperTest. Compilation fails with things like:

TESTING: suite/C99/7/12/14/1/t1.c

   Test the isgreater macro
+++ stderr ++++++++++++++++++++++
t1.c:22:14: warning: '#pragma FENV_ACCESS' is not supported on this target - ignored [-Wignored-pragmas]
#pragma STDC FENV_ACCESS ON
             ^
t1.c:78:37: error: use of undeclared identifier 'FE_INEXACT'
        CVAL_VERIFY( ! fetestexcept(FE_INEXACT));
                                    ^
1 warning and 1 error generated.

   Compilation failed

RESULT: C99/7/12/14/1/t1.c                                               FAILED

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants