|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
[Spirit] [bind] Compiler warning dependent on number of rules?Hello,
I'm currently parsing some data using Spirit together with boost::bind to set the callbacks for Spirit. In release build I get a compiler (gcc 4.4.1) warning from bind: warning: dereferencing pointer ‘val’ does break strict-aliasing rules I was able to find the lines causing this problem by commenting them out, rebuilding and the error got away. The strange thing is, that when I copy some other parsing rules, that previously compiled without any warning, I get the same warning again. When trying to create a simple example to post here, it seemed that the actual parsing code (that is the only code that uses boost::bind) was exchangeable. It was the number of options in the parsing rule that caused the warning to appear (which I really do not understand). The parsing rule looks like this: parse(someString.c_str(), ( *( str_p('+') >> str_p('(') >> real_p[boost::bind(&Object::func_param, boost::ref(m_curObmect), _1)] >> str_p(')') | str_p('+')[boost::bind(&Object::func, boost::ref(m_curObject), _1)] /*| str_p('+') >> str_p('(') >> real_p[boost::bind(&Object::func_param, boost::ref(m_curObmect), _1)] >> str_p(')') | str_p('+')[boost::bind(&Object::func, boost::ref(m_curObject), _1)] [... to be repeated ...] */ ) ) , space_p).full; The goal is to find either "+" or "+(double)", which works as expected. causesThe signatures of the Object functions are Object::func_param(double param); and Object::func(char); The rule can be copied 7 times, leading to 14 options, without any warning. If I add one 8th copy of these lines, or if I just add a 15th option (independent of the actual line I copy) I get the warning again. My system is an Ubuntu Karmic 64bit machine, using gcc 4.4.1, boost 1.39 headers and simply including "boost/spirit.hpp", which means I get the deprecation warning for that file at the moment. I'd be thankful for any suggestions, since for now, I do not even know where to look further. I do not have any idea what might cause this warning. thanks, Norbert _______________________________________________ Boost-users mailing list Boost-users@... http://lists.boost.org/mailman/listinfo.cgi/boost-users |
|
|
Re: [Spirit] [bind] Compiler warning dependent on number of rules?On Wed, Nov 4, 2009 at 1:24 AM, Norbert Wenzel <n_wenzel@...> wrote:
> Hello, > > I'm currently parsing some data using Spirit together with boost::bind > to set the callbacks for Spirit. In release build I get a compiler (gcc > 4.4.1) warning from bind: > warning: dereferencing pointer ‘val’ does break strict-aliasing rules > > I was able to find the lines causing this problem by commenting them > out, rebuilding and the error got away. The strange thing is, that when > I copy some other parsing rules, that previously compiled without any > warning, I get the same warning again. > > When trying to create a simple example to post here, it seemed that the > actual parsing code (that is the only code that uses boost::bind) was > exchangeable. It was the number of options in the parsing rule that > caused the warning to appear (which I really do not understand). > > The parsing rule looks like this: > > parse(someString.c_str(), > ( > *( > str_p('+') >> str_p('(') >> real_p[boost::bind(&Object::func_param, > boost::ref(m_curObmect), _1)] >> str_p(')') | > str_p('+')[boost::bind(&Object::func, boost::ref(m_curObject), _1)] /*| > > str_p('+') >> str_p('(') >> real_p[boost::bind(&Object::func_param, > boost::ref(m_curObmect), _1)] >> str_p(')') | > str_p('+')[boost::bind(&Object::func, boost::ref(m_curObject), _1)] > [... to be repeated ...] */ > > ) > ) > , > space_p).full; > > The goal is to find either "+" or "+(double)", which works as expected. > causesThe signatures of the Object functions are > Object::func_param(double param); and > Object::func(char); > > The rule can be copied 7 times, leading to 14 options, without any > warning. If I add one 8th copy of these lines, or if I just add a 15th > option (independent of the actual line I copy) I get the warning again. > > My system is an Ubuntu Karmic 64bit machine, using gcc 4.4.1, boost 1.39 > headers and simply including "boost/spirit.hpp", which means I get the > deprecation warning for that file at the moment. > > I'd be thankful for any suggestions, since for now, I do not even know > where to look further. I do not have any idea what might cause this warning. Not sure what is causing the problem, do you have a reduced test-case we can see? Also, two things. 1) You *really* should be posting this to the Spirit mailing list instead, will get faster responses and from knowledgeable people. 2) You *really* should be using Spirit.Qi, not Spirit.Classic. Your grammar's will be much shorter, much faster, and much easier. _______________________________________________ Boost-users mailing list Boost-users@... http://lists.boost.org/mailman/listinfo.cgi/boost-users |
|
|
Re: [Spirit] [bind] Compiler warning dependent on number of rules?OvermindDL1 wrote:
> On Wed, Nov 4, 2009 at 1:24 AM, Norbert Wenzel <n_wenzel@...> wrote: >> >> I'm currently parsing some data using Spirit together with boost::bind >> to set the callbacks for Spirit. In release build I get a compiler (gcc >> 4.4.1) warning from bind: >> warning: dereferencing pointer ‘val’ does break strict-aliasing rules > > Not sure what is causing the problem, do you have a reduced test-case > we can see? I could reduce the test case so much, that there was no warning anymore. I can only reproduce the warning when using the bjam configuration, that also builds my project. Copying the g++ parameters from the bjam build and using them directly, does not make gcc issue any warnings. So I guess the problem is anywhere in my build configuration, but not in the code. > Also, two things. > 1) You *really* should be posting this to the Spirit mailing list > instead, will get faster responses and from knowledgeable people. Sorry, I didn't know about the Spirit specific list. Next time the questions will go there. > 2) You *really* should be using Spirit.Qi, not Spirit.Classic. Your > grammar's will be much shorter, much faster, and much easier. Maybe I should give it a try, but I was simply finding more tutorials faster for the classic version. Thanks for your help. Norbert _______________________________________________ Boost-users mailing list Boost-users@... http://lists.boost.org/mailman/listinfo.cgi/boost-users |
| Free embeddable forum powered by Nabble | Forum Help |