https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89927

            Bug ID: 89927
           Summary: Inconsistent behavior in std::regex when optimized
           Product: gcc
           Version: 8.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: xonar.leroux at gmail dot com
  Target Milestone: ---

Created attachment 46073
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46073&action=edit
Minimal case that triggers the bug

Compiling with: `g++ test.cpp` and running results in no exception as expected.

Compiling with `g++ -O3 test.cpp` and running  results in

terminate called after throwing an instance of 'std::regex_error'
  what():  Unexpected token in brace expression.

Compiling with `clang++ -fsanitize=undefined test.cpp` and running 

/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/8.2.1/../../../../include/c++/8.2.1/bits/regex_compiler.h:200:40:
runtime error: addition of unsigned offset to 0x5581d2265f61 overflowed to
0x5581d2264b15
terminate called after throwing an instance of 'std::regex_error'
  what():  Unexpected token in brace expression.

I am using the latest g++, libstdc++11 and clang++ versions from Arch Linux
(2019 April 2).

GCC Version:

Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure --prefix=/usr --libdir=/usr/lib
--libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=https://bugs.archlinux.org/
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared
--enable-threads=posix --enable-libmpx --with-system-zlib --with-isl
--enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu
--disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object
--enable-linker-build-id --enable-lto --enable-plugin
--enable-install-libiberty --with-linker-hash-style=gnu
--enable-gnu-indirect-function --enable-multilib --disable-werror
--enable-checking=release --enable-default-pie --enable-default-ssp
--enable-cet=auto
Thread model: posix
gcc version 8.2.1 20181127 (GCC)

Reply via email to