[Bug libstdc++/89927] New: Inconsistent behavior in std::regex when optimized

2019-04-02 Thread xonar.leroux at gmail dot com
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=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)

[Bug c++/69289] Compiling without --profile-generate causes longer execution time (-O3)

2019-04-02 Thread xonar.leroux at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69289

--- Comment #5 from Paul le roux  ---
On the GCC trunk version on godbolt.org there is still a difference between the
two cases, but it seems to have turned around. The noprofile case has
vector::resize partially inlined and in the profile case, it is not inlined.

This makes more sense (to me at least) since I expect that certain functions
won't be inlined so that one can gather better profile information. If it is
the case that `--profile-generate` should be less aggressive when inlining then
this bug report can be closed.

[Bug c++/81171] Segfault with auto template deduction

2019-04-02 Thread xonar.leroux at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81171

Paul le roux  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #2 from Paul le roux  ---
This has been fixed somewhere between when this was reported and 8.2.1 which I
am currently using.

[Bug c++/81171] New: Segfault with auto template deduction

2017-06-22 Thread xonar.leroux at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81171

Bug ID: 81171
   Summary: Segfault with auto template deduction
   Product: gcc
   Version: 7.1.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: xonar.leroux at gmail dot com
  Target Milestone: ---

Created attachment 41608
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41608=edit
Smallest case which still results in segfault

Running with

'g++ gcc_bug.cpp'

results in

'gcc_bug.cpp:8:1: internal compiler error: Segmentation fault'

Replacing auto with char results in successful compilation.

VERSIONS: g++ (GCC) 7.1.1 20170516

I also tested with GCC 5.4.0 and with -std=c++14 and it also segfaults.

[Bug c++/69289] Compiling without --profile-generate causes longer execution time (-O3)

2016-01-15 Thread xonar.leroux at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69289

--- Comment #4 from Paul le roux  ---
I compiled gcc/g++ from svn and the slowdown is still present without the
--profile-generate flag. (But both are faster than what they were :D )

[Bug c++/69289] New: Compiling without --profile-generate causes longer execution time (-O3)

2016-01-14 Thread xonar.leroux at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69289

Bug ID: 69289
   Summary: Compiling without --profile-generate causes longer
execution time (-O3)
   Product: gcc
   Version: 5.3.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: xonar.leroux at gmail dot com
  Target Milestone: ---

Created attachment 37349
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37349=edit
Source

Running without --profile-generate (NOT --profile-use) causes a slowdown.

The speed script that I run simply runs the program with time output.

Effect is still present when using/not using -march=native and when using/not
using -funroll-loops

speed.sh
  1 #!/bin/zsh
  2 
  3 sudo cpupower frequency-set -g performance
  4 
  5 time ./a.out 1
  6 time ./a.out 2
  7 time ./a.out 3
  8 time ./a.out 4
  9 time ./a.out 5
 10 time ./a.out 1
 11 time ./a.out 2
 12 time ./a.out 3
 13 time ./a.out 4
 14 time ./a.out 5
 15 
 16 sudo cpupower frequency-set -g powersave

% g++ --version
g++ (GCC) 5.3.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

% cat /proc/version 
Linux version 4.3.3-2-ARCH (builduser@tobias) (gcc version 5.3.0 (GCC) ) #1 SMP
PREEMPT Wed Dec 23 20:09:18 CET 2015

%g++ test.cpp -std=c++11 -O3 -funroll-loops -march=native --profile-generate
-Wall -Wextra
test.cpp:37:14: warning: unused parameter ‘argc’ [-Wunused-parameter]
 int main(int argc, char** argv)

% ./speed.sh 
[sudo] password for XXX: 
Setting cpu: 0
Setting cpu: 1
Setting cpu: 2
Setting cpu: 3
Setting cpu: 4
Setting cpu: 5
Setting cpu: 6
Setting cpu: 7
166
./a.out 1  0.32s user 0.55s system 99% cpu 0.875 total
166
./a.out 2  0.33s user 0.54s system 100% cpu 0.870 total
166
./a.out 3  0.33s user 0.54s system 100% cpu 0.870 total
166
./a.out 4  0.33s user 0.55s system 99% cpu 0.874 total
166
./a.out 5  0.35s user 0.52s system 99% cpu 0.870 total
166
./a.out 1  0.32s user 0.55s system 99% cpu 0.867 total
166
./a.out 2  0.35s user 0.52s system 99% cpu 0.872 total
166
./a.out 3  0.32s user 0.56s system 99% cpu 0.889 total
166
./a.out 4  0.33s user 0.53s system 99% cpu 0.868 total
166
./a.out 5  0.32s user 0.55s system 100% cpu 0.873 total
Setting cpu: 0
Setting cpu: 1
Setting cpu: 2
Setting cpu: 3
Setting cpu: 4
Setting cpu: 5
Setting cpu: 6
Setting cpu: 7
./speed.sh  3.34s user 5.42s system 79% cpu 10.947 total

% g++ test.cpp -std=c++11 -O3 -funroll-loops -march=native -Wall -Wextra
test.cpp:37:14: warning: unused parameter ‘argc’ [-Wunused-parameter]
 int main(int argc, char** argv)

% ./speed.sh
Setting cpu: 0
Setting cpu: 1
Setting cpu: 2
Setting cpu: 3
Setting cpu: 4
Setting cpu: 5
Setting cpu: 6
Setting cpu: 7
166
./a.out 1  0.43s user 0.56s system 100% cpu 0.990 total
166
./a.out 2  0.42s user 0.57s system 99% cpu 0.983 total
166
./a.out 3  0.41s user 0.58s system 99% cpu 0.997 total
166
./a.out 4  0.47s user 0.54s system 99% cpu 1.005 total
166
./a.out 5  0.43s user 0.56s system 99% cpu 0.988 total
166
./a.out 1  0.45s user 0.54s system 99% cpu 0.991 total
166
./a.out 2  0.42s user 0.55s system 99% cpu 0.971 total
166
./a.out 3  0.39s user 0.59s system 99% cpu 0.982 total
166
./a.out 4  0.46s user 0.52s system 99% cpu 0.985 total
166
./a.out 5  0.48s user 0.51s system 99% cpu 0.985 total
Setting cpu: 0
Setting cpu: 1
Setting cpu: 2
Setting cpu: 3
Setting cpu: 4
Setting cpu: 5
Setting cpu: 6
Setting cpu: 7
./speed.sh  4.36s user 5.53s system 99% cpu 9.909 total

[Bug c++/69289] Compiling without --profile-generate causes longer execution time (-O3)

2016-01-14 Thread xonar.leroux at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69289

Paul le roux  changed:

   What|Removed |Added

 CC||xonar.leroux at gmail dot com

--- Comment #1 from Paul le roux  ---
When copying the timings got switched around the --generate-profile is the
faster one.

[Bug c++/69289] Compiling without --profile-generate causes longer execution time (-O3)

2016-01-14 Thread xonar.leroux at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69289

--- Comment #2 from Paul le roux  ---
(In reply to Paul le roux from comment #1)
> When copying the timings got switched around the --generate-profile is the
> faster one.

Ignore that. I just quickly looked at the total usage, but that includes the
frequency-set. They are right way around.