Comment 6 for bug 1452470

Revision history for this message
Andre Vieira (andre-simoesdiasvieira) wrote :

Hi,

As explained by Tony before, this bug is due to the STL *header* containing:

std::max (1.0, __d1x)

__d1x is a double and 1.0 is a float because of -fsingle-precision-constant. However, std::max is only defined for (float, float) or (double, double). This code is guarded by the _GLIBCXX_USE_C99_MATH_TR1 macro which was not set in our 4.8 based toolchain releases. This explains why it fails with only an include, why only since the 4.9 releases and why with -fsingle-precision-constant. STL developers might be convinced to add a (double) cast in front of the few constants there but they might as well refuse given that -fsingle-precision is not standard compliant [1]. Prefixing the 3 constants in arm-none-eabi/include/c++/4.9.3/bits/random.tcc with (double) fixes the issue.

[1] section 6.4.4.2 paragraph 4 of C11 (and similar text exist in earlier versions) explicitly states that unsuffixed floating constant have double precision.

Kind Regards,