[PATCH] D39611: [CodeGen] make cbrt and fma constant (never set errno); document complex calls as always constant

Hal Finkel via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 3 17:32:37 PDT 2017


hfinkel added a comment.

In https://reviews.llvm.org/D39611#915560, @efriedma wrote:

> > The POSIX docs all have language like this for complex calls:
> >  "No errors are defined."
>
> I would not trust the POSIX documentation.
>
> carg() is an alias for atan2(), and cabs() is an alias for hypot(), so they should be marked the same way.  (On glibc, cabs/hypot will set errno; not sure about carg/atan2.)


That seems like a bug if they set errno. The complex versions shouldn't set errno. glibc's docs say that neither hypot or set errno (although the POSIX spec allows for it in theory).

> For the others transcendental functions... they can raise exceptions in some cases, so they could in theory set errno, but it looks like they don't on glibc?  Not sure if that's documented anywhere, or something we should depend on.

In general, because all of these functions are well defined over the entire complex domain, they don't have errors. The "no errors defined" is likely correct.


https://reviews.llvm.org/D39611





More information about the cfe-commits mailing list