Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJgzZoqhV6OHuFG-oNx207vpsgUwamrx3ieJ2b=JpQ8TM6vXBg@mail.gmail.com>
Date: Wed, 24 Jul 2024 17:48:16 -0400
From: enh <enh@...gle.com>
To: libc-coord@...ts.openwall.com
Subject: Re: #pragma STDC FENV_ACCESS ON

On Wed, Jul 24, 2024 at 2:31 PM Rich Felker <dalias@...c.org> wrote:
>
> On Thu, Jul 18, 2024 at 01:28:02PM -0400, enh wrote:
> > has anyone else considered adding `#pragma STDC FENV_ACCESS ON` to
> > <fenv.h>? expecting callers to realize they [might] have to do this
> > [depending on their compiler and architecture] if they want to safely
> > use most of the functions in <fenv.h> doesn't seem to be working out
> > too well, even for libm authors...
> >
> > all the choices seem bad.
>
> That wouldn't even help because the compilers don't honor it.

well, it's worse than that --- some need it, some don't. and even for
a given compiler, it depends on the specific target architecture. (and
i think MS' compilers have a different non-standard pragma instead.)

> You need
> nondefault CFLAGS instead. And even if it did help, it would just be
> facilitating wrong/nonportable code. The reason nobody's using it is

(it's used in musl's fmal() :-) )

> that the compilers ignore it (and IIRC at least at one point even
> spammed warnings to that effect).

clang will still complain if you use it for arm32 ... but requires it
for x86-64.

> Get the compilers fixed, teach them
> to issue warnings when fenv functions are called without the pragma in
> effect, and everything else will fix itself.

lol, sure, but back in the real world where the compiler writers don't
care about their users, and the standards committees don't care
whether the language as standardized is actually usable or not...

i think the strongest "meh, whatever, it's also not the libc owners'
problem --- just leave users to deal with it" argument is probably
that hardly anyone who doesn't own a libm actually cares about
<fenv.h>. Android's arm32 <fenv.h> was completely broken (because
someone had copy & pasted the BSD _mips_ inline assembler) for years,
and afaik no user noticed --- i noticed when i was doing the arm64
port and wrote the first test.

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.