Ehhh – forgot the list:

From: Joakim Hove
Sent: 7. juli 2014 16:22
To: 'Bård Skaflestad'
Subject: RE: [OPM] Boost.Regex and libstc++ debug mode


Hmmm;



a minor Google exercise turned up this: 
https://svn.boost.org/trac/boost/ticket/5911 I don't really understand this, 
but it seem the boost people do not acknownledge this as Boost issue?? It seems 
that when setting D_GLIBCXX_DEBUG the full C++ stack must be recompiled; that 
mostly works since:



1.       libstdc++ comes in a DEBUG version which is linked in when 
–DGLIBCXX_DEBUG is used.

2.       The external C++ libraries we use are mostly header only; however 
Boost regex is not header only and will break due to ABI incompatibilities.



If my argument is right the problem should be the same with Boost filesystem?





Anyways: This was not by any means on my radar when I questioned the use of 
Boost regex; but I had the feeling from Google that Boost regex was not the 
most loved part of the Boost stack; maybe it is just a plain old bug? I guess 
we could get around this with some #define trickery or alternatively using 
Posix regex.h?



Joakim





-----Original Message-----
From: Opm [mailto:[email protected]] On Behalf Of Bård Skaflestad
Sent: 7. juli 2014 15:58
To: [email protected]<mailto:[email protected]>
Subject: [OPM] Boost.Regex and libstc++ debug mode



All,



Since the introduction of Boost.Regex to support regular keyword matching using 
regular expressions (opm-parser commit 9258651), I am no longer able to use 
libstdc++'s "Debug Mode", viz.



    https://gcc.gnu.org/onlinedocs/libstdc++/manual/debug_mode.html



to build OPM-related projects.



If I build the test at the bottom using (GCC 4.6.3, Boost 1.46.1, Ubuntu

12.04 LTS)



    g++ -std=c++0x -Wall -Wextra -pedantic -UNDEBUG -O0 t.cpp \

        -D_GLIBCXX_DEBUG=1 -D_GLIBCXX_DEBUG_PEDANTIC=1 \

        -lboost_regex



I get



    $ ./a.out

    s = <hello>

    Segmentation fault (core dumped)



whereas if I drop the '-D_GLIBCXX_DEBUG' flags (both of them) I get the 
expected output



    $ ./a.out

    s = <hello>

    s matches re (=.*)

    s = <hello>



For the record: I get the same behaviour on CentOS 5.10 using GCC 4.7.0 and 
Boost 1.48.0.  Anyone else noticing similar symptoms?  Picking this up in a 
debugger I notice that the call to boost::regex_match()

*appears* to change the input string ('s'), despite it being a 
reference-to-const in that context.



The libstdc++ "Debug Mode" is very useful and has caught a number of problems 
for me in the past so I'd like to keep the option of using it for OPM.  
Therefore I'm asking if I'm doing something wrong or if anyone knows if there's 
possibly an error in either of the libraries (my prime suspect being 
Boost.Regex).





Regards,



Bård



-----------------8<---------------------------8<----------------------



#include <iostream>

#include <string>



#include <boost/regex.hpp>



int

main()

{

    const std::string s("hello");

    boost::regex      re(".*");



    std::cout << "s = <" << s << ">\n";



    if (boost::regex_match(s, re)) {

        std::cout << "s matches re (=" << re.str() << ")\n";

    }

    else {

        std::cout << "s does not match";

    }



    std::cout << "s = <" << s << ">\n";

}







_______________________________________________

Opm mailing list

[email protected]<mailto:[email protected]>

http://www.opm-project.org/mailman/listinfo/opm


-------------------------------------------------------------------
The information contained in this message may be CONFIDENTIAL and is
intended for the addressee only. Any unauthorised use, dissemination of the
information or copying of this message is prohibited. If you are not the
addressee, please notify the sender immediately by return e-mail and delete
this message.
Thank you
_______________________________________________
Opm mailing list
[email protected]
http://www.opm-project.org/mailman/listinfo/opm

Reply via email to