[Bug c++/89279] New: `floorf` not in `std` despite -std=c++11

2019-02-10 Thread christ...@lipka-koeln.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89279

Bug ID: 89279
   Summary: `floorf` not in `std` despite -std=c++11
   Product: gcc
   Version: 5.4.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: christ...@lipka-koeln.de
  Target Milestone: ---

Consider the following code snippet:

#include 
float foo(float x)
{
return std::floorf(x);
}

Compiling with `g++ -std=c++11` causes a compiler error: `‘floorf’ is not a
member of ‘std’`.

According to the C++11 standard, `` _must_ declare a `float
floorf(float)` in the `std` namespace and _may_ declare such a function in the
global namespace. However, `` appears to only declares the global
function.

According to other reports, the problem is not limited to 5.4.0, but persists
to this day:

https://stackoverflow.com/questions/54623100/c-gcc-floorf-not-a-member-of-std?noredirect=1#comment96038966_54623100


(I'm not sure whether issues with the standard header files are to be
considered C++ or library issues; please re-assign if appropriate.)

[Bug c++/84949] New: -ffast-math bugged with respect to NaNs

2018-03-19 Thread christ...@lipka-koeln.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84949

Bug ID: 84949
   Summary: -ffast-math bugged with respect to NaNs
   Product: gcc
   Version: 5.4.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: christ...@lipka-koeln.de
  Target Milestone: ---

When -ffast-math is specified, NaNs are broken in _one_ of the following ways:

(A) 
std::isnan() and std::fpclassify() are broken in that they fail to identify
NaNs.

-OR-

(B)
std::numeric_limits::has_quiet_NaN() is broken in that it claims that NaNs
are supported.


Seen with both g++ 4.8.4 on Ubuntu 14.04, as well as g++ 5.4.0 on MS Windows
Subsystem for Linux, using the following set of compiler flags in both cases:

-pipe -Wno-multichar -Wno-write-strings -fno-enforce-eh-specs
-Wno-non-template-friend -s -O3 -ffast-math -march=native -pthread

[Bug libstdc++/84949] -ffast-math bugged with respect to NaNs

2018-03-19 Thread christ...@lipka-koeln.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84949

--- Comment #2 from Christoph Lipka  ---
Having dug a bit deeper, I notice another way in which NaNs are broken in
-ffinite-math-only mode:

Normally, NaNs should always compare NON-EQUAL, even when compared to itself.

In -ffinite-math-only mode, NaNs ALWAYS compare EQUAL, even when compared to a
totally different value (such as, say, 0.0).


I would disagree with the claim that "NaNs are there" in -ffinite-math-only
mode - de facto they're not. What is there is one or more representations that
cause all sorts of undefined behaviour, which just so _happens_ to include
rendering as "nan" when converted to a string.

So my point stands that std::numeric_limits::has_quiet_NaN() should return
false when -ffinite-math-only is active.