Subject: [Boost-bugs] [Boost C++ Libraries] #13611: SEGFAULT when logging std::to_string(NAN)
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2018-06-19 23:19:16
#13611: SEGFAULT when logging std::to_string(NAN)
------------------------------+-----------------------------
Reporter: Filip Matzner | Owner: Andrey Semashev
Type: Bugs | Status: new
Milestone: To Be Determined | Component: log
Version: Boost 1.67.0 | Severity: Problem
Keywords: |
------------------------------+-----------------------------
Consider the following code:
{{{
#include <climits>
#include <boost/log/trivial.hpp>
int main()
{
BOOST_LOG_TRIVIAL(info) <<
std::to_string(std::numeric_limits<double>::quiet_NaN());
}
}}}
When compiled with:
{{{
g++ -std=c++17 -DBOOST_ALL_DYN_LINK -pthread -lboost_log -O3 test.cpp &&
./a.out
}}}
It crashes with SEGFAULT. If I replace BOOST_LOG_TRIVIAL(info) with
std::cout, it does not.
System:
{{{
[floop_at_pine /tmp ]$ g++ -v
...
gcc version 8.1.1 20180531 (GCC)
[floop_at_pine /tmp ]$ uname -a
Linux pine 4.16.13-2-ARCH #1 SMP PREEMPT Fri Jun 1 18:46:11 UTC 2018
x86_64 GNU/Linux
}}}
Note that the SEGFAULT does not happen with clang++, but only g++. It also
does not happen with -O2, but only -O3. It might also be a compiler bug,
you will probably know better than me. :-)
-- Ticket URL: <https://svn.boost.org/trac10/ticket/13611> 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 : 2018-06-19 23:26:49 UTC