On 22/08/2019 06:20, peshkoff--- via Firebird-devel wrote: > Before making a choice i want to know why only optimized build is > affected. Pay attention - delete is redefined in it too. Why that > behavior difference? > > Alex, my understand is that non-optimized code calls the classes (std::string, etc) methods/constructor/destructor all from libstdc++.o, as they are not inlined, but optimized code inlines only the destructor. The same thing happens with both g++ and clang++.
See that stack traces of object construction: ---- Optmized: #0 0x00007ffff64b36d0 in operator new(unsigned long)@plt () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #1 0x00007ffff3992b59 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char const*> (__end=0x7fffffffa01c "", __beg=0x7fffffffa00c "((1|1[2]){3,5}?)", this=0x7fffffff9cb0) at /usr/include/c++/7/bits/basic_string.tcc:219 #2 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct_aux<char const*> (__end=0x7fffffffa01c "", __beg=0x7fffffffa00c "((1|1[2]){3,5}?)", this=0x7fffffff9cb0) at /usr/include/c++/7/bits/basic_string.h:236 #3 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char const*> (__end=0x7fffffffa01c "", __beg=0x7fffffffa00c "((1|1[2]){3,5}?)", this=0x7fffffff9cb0) at /usr/include/c++/7/bits/basic_string.h:255 #4 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string (__a=..., __n=16, __s=0x7fffffffa00c "((1|1[2]){3,5}?)", this=0x7fffffff9cb0) at /usr/include/c++/7/bits/basic_string.h:502 #5 _ZNK3re211StringPiececvNSt7__cxx1112basic_stringIcSt11char_traitsIcET_EEISaIcEEEv (this=<optimized out>) at ./re2/stringpiece.h:110 #6 re2::RE2::Init (this=this@entry=0x7fffecd11c90, pattern=..., options=...) at re2/re2.cc:175 #7 0x00007ffff3993cd7 in re2::RE2::RE2 (this=0x7fffecd11c90, pattern=..., options=...) at re2/re2.cc:120 ---- Not-optmized: #0 0x00007ffff64b36d0 in operator new(unsigned long)@plt () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #1 0x00007ffff65513ad in void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char const*>(char const*, char const*, std::forward_iterator_tag) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #2 0x00007ffff397616d in _ZNK3re211StringPiececvNSt7__cxx1112basic_stringIcSt11char_traitsIcET_EEISaIcEEEv (this=0x7fffffff9f48) at ./re2/stringpiece.h:110 #3 0x00007ffff39708bf in re2::RE2::Init (this=0x7fffecce2230, pattern=..., options=...) at re2/re2.cc:175 #4 0x00007ffff397059c in re2::RE2::RE2 (this=0x7fffecce2230, pattern=..., options=...) at re2/re2.cc:120 #5 0x00007ffff38c483a in (anonymous namespace)::SimilarToCompiler::SimilarToCompiler (this=0x7fffffffa000, pool=..., regexp=..., aFlags=5, aPatternStr=0x7fffffffa1f0 "(1|1[2]){3,5}", aPatternLen=13, escapeStr=0x7fffffffa158 "\\", escapeLen=1) at /home/asfernandes/fb/dev/firebird-master.git/src/common/SimilarToRegex.cpp:76 ---- Adriano Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel