|
Boost Users : |
Subject: [Boost-users] Error :Boost 1.48.0 with latest IBM compiler
From: devika R S (devika.rs_at_[hidden])
Date: 2012-07-24 04:44:51
Hi All,
This post is regarding the issue we saw on IBM compiler using BOOST 1.48
version.
Here is the sample code .
*********************************Example
Code*************************************
#include <boost/config/warning_disable.hpp>
#include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/phoenix_operator.hpp>
#include <boost/spirit/home/phoenix/statement/if.hpp>
#include <boost/spirit/home/phoenix/bind/bind_function.hpp>
#include <iostream>
#include <string>
namespace client
{
namespace qi = boost::spirit::qi;
namespace ascii = boost::spirit::ascii;
namespace phx = boost::phoenix;
struct vars_ : qi::symbols<char, double> {
vars_() {
add("ans" , 0);
}
} vars;
template <typename Iterator>
struct parser : qi::grammar<Iterator, double()>
{
parser() : parser::base_type(function)
{
using qi::eps;
using qi::lit;
using qi::_val;
using qi::_1;
using ascii::char_;
using qi::double_;
using qi::string;
using qi::lexeme;
using boost::phoenix::if_;
using qi::alpha;
using qi::alnum;
MAX = lexeme[string("max") | string("MAX")]; //define max symbol
MIN = lexeme[string("min") | string("MIN")]; //define min symbol
D = lexeme[string("d") | string("D")]; //define distance
symbol
function =
expression [_val = _1]
| declaration
| assignment
| ( MAX >> "(" >> function [_val = _1]
>>
+(',' >> function [if_(_1 >
_val)[_val = _1]]) >> ')') // call : max(function,...)
| ( MIN >> "(" >> function [_val = _1]
>>
+(',' >> function [if_(_1 <
_val)[_val = _1]]) >> ')') // call : min(function,...)
| ( D >> "(" >> (function >> ',' >> function) >>
')'); // call : d(point1,point2) not
implemented yet
expression =
term [_val = _1]
>> *( ('+' >> term [_val += _1])
| ('-' >> term [_val -= _1]));
term =
factor [_val = _1]
>> *( ('*' >> factor [_val *= _1])
| ('/' >> factor [_val /= _1]));
factor =
double_ [_val = _1]
| (vars [_val += _1] )
| '(' >> expression [_val = _1] >> ')'
| ('-' >> factor [_val = -_1])
| ('+' >> factor [_val = _1])
| declaration;
;
assignment =
vars >> '=' >> function;
var_decl =
lexeme [ qi::raw [ ( alpha >> *( alnum | '_' ) ) - vars ]
] //[ phx::bind(vars.add, _1) ]
;
declaration =
"var " >> var_decl >> *( ',' >> var_decl );
}
qi::rule<Iterator, double()> MAX, MIN, D,expression, term, factor,
function, assignment, var_decl,
declaration;
};
}
int main()
{
typedef std::string::const_iterator iterator_type;
typedef client::parser<iterator_type> parser;
parser _parser; // Our grammar
std::string str;
double result;
while (std::getline(std::cin, str))
{
if (str.empty() || str[0] == 'q' || str[0] == 'Q')
break;
std::string::const_iterator iter = str.begin();
std::string::const_iterator end = str.end();
bool r = parse(iter, end, _parser, result);
if (r && iter == end)
{
std::cout << "Parsing succeeded\n";
std::cout << "result = " << result << std::endl;
}
else
{
std::string rest(iter, end);
std::cout << "Parsing failed\n";
}
}
return 0;
}
*********************************END**************************************************
When we compile this code on IBM with the compiler :
IBM XL C/C++ for AIX, V11.1 (5724-X13).Version: 11.01.0000.0009
we end up with below error:
xlC -I/usr/include/common/boost -o test2.o -O -c -qnoansialias -qnoro
-qchars=signed -q64 -qrtti=all test2.cpp
"/usr/include/common/boost/boost/integer_traits.hpp", line 83.56: 1540-0724
(W) The non-type template argument "-1" of type "T" has wrapped.
"/usr/include/common/boost/boost/spirit/home/support/terminal.hpp", line
231.13: 1540-0407 (S) The base class "to_nonlazy_arg<const char [4]>"
contains a circular reference back to "to_nonlazy_arg<const char [4]>".
"/usr/include/boost/boost/spirit/home/support/terminal.hpp", line 288.46:
1540-0700 (I) The previous message was produced while processing "struct
boost_1_48_0::spirit::detail::to_nonlazy_arg<const char [4]>".
"/usr/include/common/boost/boost/spirit/home/support/terminal.hpp", line
281.16: 1540-0700 (I) The previous message was produced while processing
"struct boost_1_48_0::spirit::terminal<struct
boost_1_48_0::spirit::tag::char_code<boost_1_48_0::spirit::tag::string,boost_1_48_0::spirit::char_encoding::standard>
>::result_helper<0,const char
[4],boost_1_48_0::spirit::unused_type,boost_1_48_0::spirit::unused_type>".
"/usr/include/common/boost/boost/spirit/home/support/terminal.hpp", line
316.16: 1540-0700 (I) The previous message was produced while processing
"struct boost_1_48_0::spirit::terminal<struct
boost_1_48_0::spirit::tag::char_code<boost_1_48_0::spirit::tag::string,boost_1_48_0::spirit::char_encoding::standard>
>::result<const char
[4],boost_1_48_0::spirit::unused_type,boost_1_48_0::spirit::unused_type>".
"/usr/include/common/boost/boost/spirit/home/support/terminal.hpp", line
248.12: 1540-0700 (I) The previous message was produced while processing
"struct
boost_1_48_0::spirit::terminal<boost_1_48_0::spirit::tag::char_code<boost_1_48_0::spirit::tag::string,boost_1_48_0::spirit::char_encoding::standard>
>".
"/usr/include/common/boost/boost/spirit/home/support/common_terminals.hpp",
line 230.1: 1540-0700 (I) The previous message was produced while
processing "boost_1_48_0::spirit::standard::string".
But this code works absolutely fine on g++ Linux.
Is this is a known bug on IBM ?Is any patch available ?
Thanks in advance,
Abc
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net