Subject: Re: [Boost-bugs] [Boost C++ Libraries] #11756: boost.Test: non standards compliant use of FE_* macros (unable to compile boost test library on FPU-less arches)
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-03-11 14:39:46
#11756: boost.Test: non standards compliant use of FE_* macros (unable to compile
boost test library on FPU-less arches)
----------------------------------+------------------------
Reporter: bartosz.krasinski@⦠| Owner: renficiaud
Type: Patches | Status: reopened
Milestone: Boost 1.64.0 | Component: test
Version: Boost 1.59.0 | Severity: Problem
Resolution: | Keywords:
----------------------------------+------------------------
Comment (by Jörg Krause <joerg.krause@â¦>):
Sorry about by confusion about fenv.h. The toolchain tarball include the
C++ Library header file fenv.h in sh4-buildroot-linux-
uclibc/include/c++/5.4.0/, but it does not have a fenv.h in sysroot. I
guess the later is generated somehow, right? (I've compared with another
arm musl-toolchain which does have fenv.h in sysroot).
----
I've compiled the following example with the SH4 C++ compiler:
{{{#!cc
#include <iostream>
#include <cfenv>
#include <cmath>
#pragma STDC FENV_ACCESS ON
volatile double zero = 0.0; // volatile not needed where FENV_ACCESS is
supported
volatile double one = 1.0; // volatile not needed where FENV_ACCESS is
supported
int main()
{
std::feclearexcept(FE_ALL_EXCEPT);
std::cout << "1.0/0.0 = " << 1.0 / zero << '\n';
if(std::fetestexcept(FE_DIVBYZERO)) {
std::cout << "division by zero reported\n";
} else {
std::cout << "divsion by zero not reported\n";
}
std::feclearexcept(FE_ALL_EXCEPT);
std::cout << "1.0/10 = " << one/10 << '\n';
if(std::fetestexcept(FE_INEXACT)) {
std::cout << "inexact result reported\n";
} else {
std::cout << "inexact result not reported\n";
}
std::feclearexcept(FE_ALL_EXCEPT);
std::cout << "sqrt(-1) = " << std::sqrt(-1) << '\n';
if(std::fetestexcept(FE_INVALID)) {
std::cout << "invalid result reported\n";
} else {
std::cout << "invalid result not reported\n";
}
}
}}}
Invoking the cross-compiler:
{{{#!sh
buildroot ) output/host/usr/bin/sh4-linux-g++ -std=c++11 main.cc
main.cc: In function âint main()â:
main.cc:12:5: error: âfeclearexceptâ is not a member of âstdâ
std::feclearexcept(FE_ALL_EXCEPT);
^
main.cc:12:24: error: âFE_ALL_EXCEPTâ was not declared in this scope
std::feclearexcept(FE_ALL_EXCEPT);
^
main.cc:14:8: error: âfetestexceptâ is not a member of âstdâ
if(std::fetestexcept(FE_DIVBYZERO)) {
^
main.cc:14:26: error: âFE_DIVBYZEROâ was not declared in this scope
if(std::fetestexcept(FE_DIVBYZERO)) {
^
main.cc:20:5: error: âfeclearexceptâ is not a member of âstdâ
std::feclearexcept(FE_ALL_EXCEPT);
^
main.cc:22:8: error: âfetestexceptâ is not a member of âstdâ
if(std::fetestexcept(FE_INEXACT)) {
^
main.cc:22:26: error: âFE_INEXACTâ was not declared in this scope
if(std::fetestexcept(FE_INEXACT)) {
^
main.cc:28:5: error: âfeclearexceptâ is not a member of âstdâ
std::feclearexcept(FE_ALL_EXCEPT);
^
main.cc:30:8: error: âfetestexceptâ is not a member of âstdâ
if(std::fetestexcept(FE_INVALID)) {
^
main.cc:30:26: error: âFE_INVALIDâ was not declared in this scope
if(std::fetestexcept(FE_INVALID)) {
}}}
----
Commit 02f9a561bc8003cb38fcc5b0863482459a38ea4f (18 October 2016) produces
the following error:
{{{#!sh
from libs/test/src/execution_monitor.cpp:16:
./boost/test/execution_monitor.hpp:503:27: error: âFE_DIVBYZEROâ was not
declared in this scope
BOOST_FPE_DIVBYZERO = FE_DIVBYZERO,
^
./boost/test/execution_monitor.hpp:504:27: error: âFE_INEXACTâ was not
declared in this scope
BOOST_FPE_INEXACT = FE_INEXACT,
^
./boost/test/execution_monitor.hpp:505:27: error: âFE_INVALIDâ was not
declared in this scope
BOOST_FPE_INVALID = FE_INVALID,
^
./boost/test/execution_monitor.hpp:506:27: error: âFE_OVERFLOWâ was not
declared in this scope
BOOST_FPE_OVERFLOW = FE_OVERFLOW,
^
./boost/test/execution_monitor.hpp:507:27: error: âFE_UNDERFLOWâ was not
declared in this scope
BOOST_FPE_UNDERFLOW = FE_UNDERFLOW,
^
./boost/test/execution_monitor.hpp:509:27: error: âFE_ALL_EXCEPTâ was not
declared in this scope
BOOST_FPE_ALL = FE_ALL_EXCEPT,
}}}
----
Whereas commit eec86d1fbe68aea190ce05a080d20e1569fb82a9 (24 August 2016)
produces the same error as reported in comment 45.
----
For SH4:
* `__GLIBC__` is defined
* `__USE_GNU` is defined
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/11756#comment:49> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-03-11 14:43:13 UTC