Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sun, 1 Apr 2018 13:19:01 +0200
From: ardi <>
Subject: Re: Views on bare metal port

On Wed, Jan 31, 2018 at 7:25 PM, Szabolcs Nagy <> wrote:
> note that in particular for math code llvm is problematic.
> i'm not aware of any issues in musl libm currently, but
> rounding mode changes can break in unexpected ways because
> there is no support for -frounding-math (last time i checked
> the few cases where it matters clang did not miscompile those,
> but this is not actively tested)
> an illustration of the kind of things that can go wrong:
> we don't have equivalent hacks in musl.

Being a clang user, this comment has worried me, because, according to
this bug report, there's a risk of generating wrong code:

However, a participant in the bug comments, argues that this doesn't
really violate standards compliance, just that a C99 feature is not
implemented yet, and that a warning will be triggered:

>> (quoting Richard Smith at bug report above):
>> You are mistaken. Setting the rounding mode
>> without using #pragma STDC FENV_ACCESS ON
>> invokes undefined behavior. See C11 7.6.1/2. (This
>> pragma does not exist in C++, so <cfenv> is
>> unusable, but that's not our fault...)
>> Clang doesn't support that pragma, making this
>> an unimplemented feature from C99, for which we
>> will produce a warning or error. That's the subject of
>> this enhancement request.

Now, and to the point that really interests me (generating safe code
from a clang+musl environment):

- What kind of math operations can be affected by this bug?

- Is there any workaround at this moment?

- Or is gcc the only compiler that can generate valid math code with
musl at this moment and we should better wait until clang gets bug
8100 fixed?



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.