Re: [PATCH 1/1] fenv support arm

Joel Sherrill <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <CAF9ehCWsKgV72v0YF4iMTs1FviLW5e6hwwWVuh+0gk+Sb9=WVA@mail.gmail.com>
Szabolcs, is the code in question compiled with any feature flags set?

I see on Linux that the prototypes would be triggered by _GNU_SOURCE while
in newlib, it is _BSD_SOURCE. Is that possibly contributing?

Can you post a test case? The command line that is failing would also help.

I'd like to not guess at what's wrong.

--joel

On Thu, Jul 2, 2020 at 10:48 AM Joel Sherrill <[email protected]> wrote:

>
>
> On Thu, Jul 2, 2020 at 7:11 AM Szabolcs Nagy <[email protected]>
> wrote:
>
>> The 06/03/2020 23:15, Eshan dhawan via Newlib wrote:
>> > --- /dev/null
>> > +++ b/newlib/libc/machine/arm/sys/fenv.h
>> ...
>> > +#ifndef __ARM_PCS_VFP
>> > +
>> > +int feclearexcept(int excepts);
>> > +int fegetexceptflag(fexcept_t *flagp, int excepts);
>> > +int fesetexceptflag(const fexcept_t *flagp, int excepts);
>> > +int feraiseexcept(int excepts);
>> > +int fetestexcept(int excepts);
>> > +int fegetround(void);
>> > +int fesetround(int round);
>> > +int fegetenv(fenv_t *envp);
>> > +int feholdexcept(fenv_t *envp);
>> > +int fesetenv(const fenv_t *envp);
>> > +int feupdateenv(const fenv_t *envp);
>> > +#if __BSD_VISIBLE
>> > +int feenableexcept(int __mask);
>> > +int fedisableexcept(int __mask);
>> > +int fegetexcept(void);
>> > +#endif /* __BSD_VISIBLE */
>> > +
>> > +#endif       /* __ARM_PCS_VFP */
>>
>> why are these declarations conditional?
>>
>
> The prototypes for the POSIX methods are in the shared fenv.h.
>
> Since the ARM has the BSD_VISIBLE extras, those should be left in the arm
> specific sys/fenv.h.
>
> But (I don't think) they need a ARM_PCS_VFP wrapper since there should be
> an implementation for all multilibs.  We could discuss the BSD_VISIBLE
> prototypes being moved to <fenv.h> and removed from all the architecture
> <sys/fenv.h>
> but that was also how the code I moved from Cygwin to newlib libm was done
> so
> maybe there is a reason that I don't know to leave it here.
>
>>
>> i get build failures e.g. in libgfortran
>> because configure detects the availability
>> of feenableexcept in libm.a so it starts
>> using it but then fenv.h does not have the
>> declaration so compilation fails.
>>
>> it seems there is vfp code for all this
>> so why are the declarations removed?
>>
>
> The FreeBSD headers rely on the architecture sys/fenv.h prototypes
> even for POSIX standard methods. Most of the block of code is removed
> because the prototypes were in <fenv.h> which is where this file is
> included
> from.
>
> Eshan... re-add the BSD_VISIBLE block please and resubmit. It also
> looks like the test code isn't exercising those methods so that should
> be updated after this patch is updated. We don't want libfortran broken
> for longer than neccessary.
>
> --joel
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.