Compilation error with regex only with -O3 on gcc

Hi, when I compile with: -O0 to -O2 my programs compile and work fine, but when I switch to -O3 I get compilation errors (shortened, see below). Is this my fault (maybe I shouldnt use optimizations? thank you very much for your answers ido fedora core 4,gcc version: Target: i386-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,java,f95,ada --enable-java-awt=gtk --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --host=i386-redhat-linux Thread model: posix gcc version 4.0.1 20050727 (Red Hat 4.0.1-5) boost: boost-devel-1.32.0-6 Errors: Building file: ../src/Parser.cpp Invoking: GCC C++ Compiler g++ -DDEBUG -O3 -g3 -pedantic -Wall -c -fmessage-length=0 -osrc/Parser.o ../src/Parser.cpp /usr/include/boost/regex/v4/regex_compile.hpp: In member function ‘boost::re_detail::re_syntax_base* boost::reg_expression<charT, traits, Allocator>::compile_set_simple(boost::re_detail::re_syntax_base*, long unsigned int, bool) [with charT = char, traits = boost::regex_traits<char>, Allocator = std::allocator<char>]’: /usr/include/boost/regex/v4/regex_compile.hpp:1635: instantiated from ‘unsigned int boost::reg_expression<charT, traits, Allocator>::set_expression(const charT*, const charT*, boost::regex_constants::syntax_option_type) [with charT = char, traits = boost::regex_traits<char>, Allocator = std::allocator<char>]’ /usr/include/boost/regex/v4/basic_regex.hpp:238: instantiated from ‘unsigned int boost::reg_expression<charT, traits, Allocator>::set_expression(const charT*, boost::regex_constants::syntax_option_type) [with charT = char, traits = boost::regex_traits<char>, Allocator = std::allocator<char>]’ /usr/include/boost/regex/v4/regex_compile.hpp:110: instantiated from ‘boost::reg_expression<charT, traits, Allocator>::reg_expression(const charT*, boost::regex_constants::syntax_option_type, const Allocator&) [with charT = char, traits = boost::regex_traits<char>, Allocator = std::allocator<char>]’ /usr/include/boost/regex/v4/basic_regex.hpp:340: instantiated from ‘boost::basic_regex<charT, traits, Allocator>::basic_regex(const charT*, typename boost::reg_expression<charT, traits, Allocator>::flag_type, const Allocator&) [with charT = char, traits = boost::regex_traits<char>, Allocator = std::allocator<char>]’ ../src/Parser.cpp:16: instantiated from here __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com

robert kraus wrote:
Hi, when I compile with: -O0 to -O2 my programs compile and work fine, but when I switch to -O3 I get compilation errors (shortened, see below).
You've shortened the errors to the point where the actual error isn't shown! That makes it pretty hard to know what went wrong :)
Is this my fault (maybe I shouldnt use optimizations?
If the optimisation level affects whether the code compiles then it is a likely to be a compiler bug. You should report it to RedHat's bugzilla, since you are using a RedHat build of GCC. jon

when I compile with: -O0 to -O2 my programs compile and work fine, but when I switch to -O3 I get compilation errors (shortened, see below).
Is this my fault (maybe I shouldnt use optimizations? thank you very much for your answers
No idea, you've removed the actual error from the message :-( Can you: 1) Please try Boost-1.33 either when it arrives or as a release candidate, as the code that appears to be causing the error has been completely removed/rewritten in that release. 2) Please report anything that looks like a gcc bug on bugzilla. Many thanks, John.
participants (3)
-
John Maddock
-
Jonathan Wakely
-
robert kraus