Subject: Re: [Boost-bugs] [Boost C++ Libraries] #6126: Signed integer members of Boost.Fusion adapted ADTs are not output correctly with Boost.Spirit.Karma rules
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-12-29 10:36:08
#6126: Signed integer members of Boost.Fusion adapted ADTs are not output
correctly with Boost.Spirit.Karma rules
-------------------------------+--------------------------------------------
Reporter: t0rt1e@⦠| Owner: hkaiser
Type: Bugs | Status: new
Milestone: To Be Determined | Component: spirit
Version: Boost 1.48.0 | Severity: Problem
Resolution: | Keywords: Boost.Spirit.Karma, Boost.Fusion, BOOST_FUSION_ADAPT_CLASS, BOOST_FUSION_ADAPT_ADT, short, int, long
-------------------------------+--------------------------------------------
Comment (by vexocide@â¦):
I've managed to reproduce the problem, and it's quite interesting to
say the least:
{{{
~ Jeroen$ g++ --version
i686-apple-darwin10-g++-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)
~ Jeroen$ g++ test_signed_integer_output_with_karma_minimal.cpp -o
test -I library/boost-trunk/
~ Jeroen$ ./test
rational_int_adt(2, -6) = -771751935/3 (expected: -1/3)
rational_int_adt(-2, 4) = -771751935/2 (expected: -1/2)
~ Jeroen$ g++ test_signed_integer_output_with_karma_minimal.cpp -o
test -O2 -I library/boost-trunk/
~ Jeroen$ ./test
rational_int_adt(2, -6) = -1/3 (expected: -1/3)
rational_int_adt(-2, 4) = -1/2 (expected: -1/2)
rational_int_struct(2, -6) = 2/-6 (expected: 2/-6)
~ Jeroen$ g++-mp-4.4 --version
g++-mp-4.4 (GCC) 4.4.6
~ Jeroen$ g++-mp-4.4 test_signed_integer_output_with_karma_minimal.cpp
-o test -I Documents/Code/library/boost-trunk/
~ Jeroen$ ./test
rational_int_adt(2, -6) = -1/1 (expected: -1/3)
rational_int_adt(-2, 4) = -1/1 (expected: -1/2)
rational_int_struct(2, -6) = 2/-6 (expected: 2/-6)
~ Jeroen$ g++-mp-4.4 test_signed_integer_output_with_karma_minimal.cpp
-o test -O2 -I Documents/Code/library/boost-trunk/
~ Jeroen$ ./test
rational_int_adt(2, -6) = -1/3 (expected: -1/3)
rational_int_adt(-2, 4) = -1/2 (expected: -1/2)
rational_int_struct(2, -6) = 2/-6 (expected: 2/-6)
~ Jeroen$ g++-mp-4.6 --version
g++-mp-4.6 (GCC) 4.6.2
~ Jeroen$ g++-mp-4.6 test_signed_integer_output_with_karma_minimal.cpp
-o test -I library/boost-trunk/
~ Jeroen$ ./test
rational_int_adt(2, -6) = -771751935/3 (expected: -1/3)
rational_int_adt(-2, 4) = -771751935/2 (expected: -1/2)
rational_int_struct(2, -6) = 2/-6 (expected: 2/-6)
~ Jeroen$ g++-mp-4.6 test_signed_integer_output_with_karma_minimal.cpp
-o test -O2 -I library/boost-trunk/
~ Jeroen$ ./test
rational_int_adt(2, -6) = 0/0 (expected: -1/3)
rational_int_adt(-2, 4) = 0/0 (expected: -1/2)
rational_int_struct(2, -6) = 2/-6 (expected: 2/-6)
}}}
Yes, that's four different outputs depending on the compiler version
and optimization flags used... Hartmut has tried this using MSVC (not
sure which version) and that worked just fine. I've currently broken
my clang++ installation thus I can't try that, unfortunately.
I believe that I've found the culprit (a specific temporary) and could
provide a patch, but that'll come tomorrow (I'll need to thoroughly
test it, for obvious reasons). In the mean time someone should ask the
GCC guys what's going on.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/6126#comment:4> 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-02-16 18:50:08 UTC