[Bug c++/104670] New: ICE when using decltype of a lambda returning a struct inside of a struct

2022-02-23 Thread krzysio.kurek at wp dot pl via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104670

Bug ID: 104670
   Summary: ICE when using decltype of a lambda returning a struct
inside of a struct
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: krzysio.kurek at wp dot pl
  Target Milestone: ---

Created attachment 52502
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52502=edit
-freport-bug output

GCC ICEs when compiling the following piece of code:

struct foo {
decltype([] { return (struct {
int fn() {}
}){}; }) bar;
};

Compiled with `-std=c++20`
Past stable releases of GCC report "confused by earlier errors, bailing out"
without crashing instead.

[Bug libstdc++/94960] New: extern template prevents inlining of standard library objects

2020-05-05 Thread krzysio.kurek at wp dot pl
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94960

Bug ID: 94960
   Summary: extern template prevents inlining of standard library
objects
   Product: gcc
   Version: 9.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libstdc++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: krzysio.kurek at wp dot pl
  Target Milestone: ---

Consider this example
void foo()
{
  std::string(1, 0);
}
(https://godbolt.org/z/AlkBBJ)
This function creates a string using the `basic_string(size_t, CharT)`
constructor and then discards it. This particular constructor uses _M_construct
internally, which is declared as an out of line member function. Because of
this, and because the function isn't marked as `inline`, when the compiler
reaches the `extern template class basic_string;`, it foregoes trying to
find the definition for _M_construct, instead generating a call to it, causing
foo() to fully instantiate a string object and then delete it, since the
compiler can't find _M_construct within its own translation unit.

This problem applies to every member function of any class which has an extern
template, is defined out of line and is not marked as `inline`.

[Bug lto/88516] Internal LTO error when linking against static libSFML

2018-12-29 Thread krzysio.kurek at wp dot pl
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88516

krzysio.kurek at wp dot pl changed:

   What|Removed |Added

 Status|WAITING |RESOLVED
 Resolution|--- |INVALID

--- Comment #4 from krzysio.kurek at wp dot pl ---
I've been trying to put the issue in a repository however the ICE stopped
occurring for me, and I don't know how to replicate it anymore. I'll reopen
this issue when I have something ready.

[Bug lto/88516] Internal LTO error when linking against static libSFML

2018-12-15 Thread krzysio.kurek at wp dot pl
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88516

--- Comment #2 from krzysio.kurek at wp dot pl ---
Created attachment 45243
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45243=edit
preprocessed file

Oh I just noticed that the preprocessed file didn't get attached.

[Bug lto/88516] Internal LTO error when linking against static libSFML

2018-12-15 Thread krzysio.kurek at wp dot pl
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88516

--- Comment #1 from krzysio.kurek at wp dot pl ---
I'm afraid this is as minimal as it gets. Should I set up a git repo with all
sources needed to reproduce the error?

[Bug lto/88516] New: Internal LTO error when linking against static libSFML

2018-12-15 Thread krzysio.kurek at wp dot pl
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88516

Bug ID: 88516
   Summary: Internal LTO error when linking against static libSFML
   Product: gcc
   Version: 8.2.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: lto
  Assignee: unassigned at gcc dot gnu.org
  Reporter: krzysio.kurek at wp dot pl
CC: marxin at gcc dot gnu.org
  Target Milestone: ---

sysinfo:
gcc (SUSE Linux) 8.2.1 20181108 [gcc-8-branch revision 265914]
OpenSUSE Tumbleweed 20181213

GCC configuration:
../configure --prefix=/usr --infodir=/usr/share/info --mandir=/usr/share/man
--libdir=/usr/lib64 --libexecdir=/usr/lib64
--enable-languages=c,c++,objc,fortran,obj-c++,ada,go
--enable-offload-targets=hsa,nvptx-none=/usr/nvptx-none, --without-cuda-driver
--enable-checking=release --disable-werror
--with-gxx-include-dir=/usr/include/c++/8 --enable-ssp --disable-libssp
--disable-libvtv --disable-cet --disable-libcc1 --enable-plugin
--with-bugurl=http://bugs.opensuse.org/ --with-pkgversion='SUSE Linux'
--with-slibdir=/lib64 --with-system-zlib --enable-libstdcxx-allocator=new
--disable-libstdcxx-pch --enable-version-specific-runtime-libs
--with-gcc-major-version-only --enable-linker-build-id --enable-linux-futex
--enable-gnu-indirect-function --program-suffix=-8 --without-system-libunwind
--enable-multilib --with-arch-32=x86-64 --with-tune=generic
--build=x86_64-suse-linux --host=x86_64-suse-linux

exact commandline:
g++ main.cpp /usr/local/lib/libsfml-graphics-s.a
/usr/local/lib/libsfml-window-s.a /usr/local/lib/libsfml-system-s.a -lpthread
-lrt /usr/lib64/libudev.so /usr/lib64/libOpenGL.so /usr/lib64/libX11.so
/usr/lib64/libXrandr.so /usr/lib64/libfreetype.so

error message:
lto1: internal compiler error: in add_symbol_to_partition_1, at
lto/lto-partition.c:155
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugs.opensuse.org/> for instructions.
lto-wrapper: fatal error: g++ returned 1 exit status
compilation terminated.
/usr/lib64/gcc/x86_64-suse-linux/8/../../../../x86_64-suse-linux/bin/ld: error:
lto-wrapper failed
collect2: error: ld returned 1 exit status

Happens with a locally compiled SFML, commit
b9fdaf487f878fac17c3d4c1182acd8c4182eecc, with LTO enabled and compiled to
static libraries.

[Bug lto/82229] GCC7's LTO underperforms compared to GCC6

2018-05-17 Thread krzysio.kurek at wp dot pl
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82229

--- Comment #28 from krzysio.kurek at wp dot pl ---
I mean the relative performance is worse but still Profiled GCC6 is faster than
GCC 7 or GCC 8.

[Bug lto/82229] GCC7's LTO underperforms compared to GCC6

2018-04-29 Thread krzysio.kurek at wp dot pl
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82229

krzysio.kurek at wp dot pl changed:

   What|Removed |Added

  Attachment #44025|0   |1
is obsolete||

--- Comment #26 from krzysio.kurek at wp dot pl ---
Created attachment 44040
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44040=edit
Annotates and report logs from perf

I don't have an FTP, I'm just doing this stuff locally by hand.

[Bug lto/82229] GCC7's LTO underperforms compared to GCC6

2018-04-26 Thread krzysio.kurek at wp dot pl
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82229

krzysio.kurek at wp dot pl changed:

   What|Removed |Added

  Attachment #42199|0   |1
is obsolete||

--- Comment #24 from krzysio.kurek at wp dot pl ---
Created attachment 44025
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44025=edit
Performance logs from perf

Alright so I've generated 4 profiles with the following flags:
"pure6": -O3 -DNDEBUG -flto
"profiled6": -O3 -DNDEBUG -flto + profile run
"pure7": -O3 -DNDEBUG -flto
"profiled7": -O3 -DNDEBUG -flto + profile run

On GCC6 the profile run impacted performance of the application negatively
compared to "pure6".

[Bug lto/82229] GCC7's LTO underperforms compared to GCC6

2018-04-17 Thread krzysio.kurek at wp dot pl
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82229

--- Comment #22 from krzysio.kurek at wp dot pl ---
I'm sorry but profiling doesn't seem to be well documented, what tools should I
use to generate a profiling log?

[Bug lto/82229] GCC7's LTO underperforms compared to GCC6

2018-04-15 Thread krzysio.kurek at wp dot pl
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82229

krzysio.kurek at wp dot pl changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|INVALID |---

--- Comment #20 from krzysio.kurek at wp dot pl ---
Reopening.

[Bug lto/82229] GCC7's LTO underperforms compared to GCC6

2018-04-15 Thread krzysio.kurek at wp dot pl
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82229

--- Comment #19 from krzysio.kurek at wp dot pl ---
I'm sorry if it's not clear, English isn't my native language.

So to reiterate.
The normal, unoptimized path is:
World::update() simulates world which uses Random::get() to generate a random
number. Random::get() calls std::uniform_int_distribution, which then calls
std::mersenne_twister_engine().
And this is what GCC7 uses.

Now GCC6 with LTO manages to optimize the path by:
Calling Random::get() only once per frame.
Omitting std::uniform_int_distribution, calling std::mersenne_twister_engine()
instead every time a random number is needed.

[Bug lto/82229] GCC7's LTO underperforms compared to GCC6

2018-04-15 Thread krzysio.kurek at wp dot pl
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82229

--- Comment #18 from krzysio.kurek at wp dot pl ---
I'm sorry if it's not clear, English isn't my native language.

So to reiterate.
The normal, unoptimized path is:
World::update() simulates world which uses Random::get() on every person.
Random::get() calls

[Bug lto/82229] GCC7's LTO underperforms compared to GCC6

2018-04-14 Thread krzysio.kurek at wp dot pl
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82229

krzysio.kurek at wp dot pl changed:

   What|Removed |Added

Version|7.1.0   |7.2.0

--- Comment #17 from krzysio.kurek at wp dot pl ---
I've been trying to create a minimal testcase but I've not been able to.
Seemingly random actions like changing the directory from the build dir back
into it prevents the bug from manifesting.
Looking at results of Valgrind's tool, Callgrind, I've managed to find the hog
being Random::get() calls not being optimized as aggressively on GCC7 as on
GCC6.
On GCC6, std::mersenne_twister_engine is being called directly from the main
world simulation loop, whereas on GCC7, Random::get() is called every time
calculations on random numbers are made. Random::get() in turn calls
std::uniform_int_distribution which then calls the mersenne engine.

[Bug lto/82302] LTO producing bad code

2017-10-01 Thread krzysio.kurek at wp dot pl
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82302

--- Comment #12 from krzysio.kurek at wp dot pl ---
UBSAN errors regarding integer overflow is by design, and is a part of
libnoise.
I can't find any documentation or help on what invalid vptr errors are though.

[Bug libstdc++/82346] [5.5 Regression] String is not detected as a part of std

2017-09-28 Thread krzysio.kurek at wp dot pl
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82346

--- Comment #8 from krzysio.kurek at wp dot pl ---
Wouldn't this bug affect all gcc compilers? I have 5, 6 and 7 installed, and
only 5 is affected.

[Bug lto/82302] LTO producing bad code

2017-09-27 Thread krzysio.kurek at wp dot pl
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82302

--- Comment #9 from krzysio.kurek at wp dot pl ---
I think I located the issue, it works fine on my machine, but using I found an
error using glslangValidator.
Please try pulling and compiling again.

[Bug libstdc++/82346] [5.5 Regression] String is not detected as a part of std

2017-09-27 Thread krzysio.kurek at wp dot pl
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82346

--- Comment #5 from krzysio.kurek at wp dot pl ---
$ g++-5 -std=c++11 main.cpp -o string -v
Using built-in specs.
COLLECT_GCC=g++-5
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.1-12ubuntu4'
--with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs
--enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-5 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie
--with-system-zlib --disable-browser-plugin --enable-java-awt=gtk
--enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre
--enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64
--with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
--enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686
--with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib
--with-tune=generic --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu   
Thread model: posix 
gcc version 5.4.1 20170906 (Ubuntu 5.4.1-12ubuntu4) 
COLLECT_GCC_OPTIONS='-std=c++11' '-o' 'string' '-v' '-shared-libgcc'
'-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-linux-gnu/5/cc1plus -quiet -v -imultiarch x86_64-linux-gnu
-D_GNU_SOURCE main.cpp -quiet -dumpbase main.cpp -mtune=generic -march=x86-64
-auxbase main -std=c++11 -version -fstack-protector-strong -Wformat
-Wformat-security -o /tmp/ccUSBFkt.s
GNU C++11 (Ubuntu 5.4.1-12ubuntu4) version 5.4.1 20170906 (x86_64-linux-gnu)
compiled by GNU C version 5.4.1 20170906, GMP version 6.1.2, MPFR
version 3.1.6-rc1, MPC version 1.0.3
warning: MPFR header version 3.1.6-rc1 differs from library version 3.1.6.  
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072  
ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/5"  
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-linux-gnu/5/../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/5
 /usr/include/x86_64-linux-gnu/c++/5
 /usr/include/c++/5/backward
 /usr/lib/gcc/x86_64-linux-gnu/5/include
 /usr/local/include
 /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.
GNU C++11 (Ubuntu 5.4.1-12ubuntu4) version 5.4.1 20170906 (x86_64-linux-gnu)
compiled by GNU C version 5.4.1 20170906, GMP version 6.1.2, MPFR
version 3.1.6-rc1, MPC version 1.0.3
warning: MPFR header version 3.1.6-rc1 differs from library version 3.1.6.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 4fa6e505be5bb1fff9039a541d8268ee
main.cpp: In function ‘int main()’:
main.cpp:6:25: error: ‘to_string’ is not a member of ‘std’
   std::string perfect = std::to_string(1+2+4+7+14) + " is a perfect number";
 ^

[Bug c++/82346] String is not detected as a part of std

2017-09-27 Thread krzysio.kurek at wp dot pl
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82346

krzysio.kurek at wp dot pl changed:

   What|Removed |Added

 Status|RESOLVED|UNCONFIRMED
 Resolution|INVALID |---

--- Comment #2 from krzysio.kurek at wp dot pl ---
Oh yeah I could have mentioned, my bad.
-std=c++11/-std=c++14 do not fix the issue. It only fails on 5.4.1, and works
on 5.4.0.

[Bug c++/82346] New: String is not detected as a part of std

2017-09-27 Thread krzysio.kurek at wp dot pl
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82346

Bug ID: 82346
   Summary: String is not detected as a part of std
   Product: gcc
   Version: 5.4.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: krzysio.kurek at wp dot pl
  Target Milestone: ---

Most basic code fails to compile.

#include 
#include 

int main ()
{
  std::string perfect = std::to_string(1+2+4+7+14) + " is a perfect number";
  std::cout << perfect << '\n';
  return 0;
}

[Bug lto/82302] LTO producing bad code

2017-09-25 Thread krzysio.kurek at wp dot pl
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82302

--- Comment #8 from krzysio.kurek at wp dot pl ---
In a sense that there is no error, the program goes into infinite loop.

[Bug lto/82302] LTO producing bad code

2017-09-25 Thread krzysio.kurek at wp dot pl
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82302

--- Comment #7 from krzysio.kurek at wp dot pl ---
No, the error you're having is completely different from what I originally
reported.

[Bug lto/82302] LTO producing bad code

2017-09-25 Thread krzysio.kurek at wp dot pl
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82302

--- Comment #5 from krzysio.kurek at wp dot pl ---
I can't reproduce your error.

[Bug lto/82302] LTO producing bad code

2017-09-25 Thread krzysio.kurek at wp dot pl
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82302

--- Comment #3 from krzysio.kurek at wp dot pl ---
This happens only on GCC7 with -flto activated.
clang-6, GCC6 and GCC5 with either flag enabled or disabled compile code that
runs fine.

I don't know why this error is occurring for you Martin.

[Bug lto/82302] New: LTO producing bad code

2017-09-22 Thread krzysio.kurek at wp dot pl
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82302

Bug ID: 82302
   Summary: LTO producing bad code
   Product: gcc
   Version: 7.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: lto
  Assignee: unassigned at gcc dot gnu.org
  Reporter: krzysio.kurek at wp dot pl
CC: marxin at gcc dot gnu.org
  Target Milestone: ---

I've found a repository with code which upon compilation with -flto under GCC7
creates a softlock. Works fine on GCC6.
Here's a fork of the repo:
https://github.com/kiroma/MineCraft-One-Week-Challenge
It's made so that cmake defaults to a build configuration with -flto enabled.
On GCC6 the program will output to the console:

Attempting to load chunk
Finished loading chunk, all clear!
Spawn found! Attempts: x Time Taken: y seconds

On GCC7 it will print:

Attempting to load chunk

but will not proceed.

[Bug lto/82229] GCC7's LTO underperforms compared to GCC6

2017-09-19 Thread krzysio.kurek at wp dot pl
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82229

--- Comment #11 from krzysio.kurek at wp dot pl ---
Done, cmake will now default to Release config with altered compiler flags that
include -flto.

[Bug lto/82229] GCC7's LTO underperforms compared to GCC6

2017-09-18 Thread krzysio.kurek at wp dot pl
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82229

--- Comment #8 from krzysio.kurek at wp dot pl ---
Okay, I'm terribly sorry for the amount of messages but I'm failing over and
over again trying to grasp the issue.
The seed is only static for the first request, but changes later on becoming
random once more.
After making few (what seemed at the time) minor cosmetic changes GCC6 had
optimized out at least one additional function completely.

[Bug lto/82229] GCC7's LTO underperforms compared to GCC6

2017-09-18 Thread krzysio.kurek at wp dot pl
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82229

--- Comment #7 from krzysio.kurek at wp dot pl ---
I've created a fork with "devel" branch here:
https://github.com/kiroma/Empire/tree/devel
I've tweaked some things, so now random seed is set, the simulation will exit
after 250 iterations and after exiting it will output to console average fps
for the whole run.

[Bug lto/82229] GCC7's LTO underperforms compared to GCC6

2017-09-18 Thread krzysio.kurek at wp dot pl
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82229

--- Comment #6 from krzysio.kurek at wp dot pl ---
Oh, two comments about the callgrind output.
Random::get() is being called 14 times less often on GCC6
There is a function created from template in GCC7 that is completely absent on
GCC6.

[Bug lto/82229] GCC7's LTO underperforms compared to GCC6

2017-09-18 Thread krzysio.kurek at wp dot pl
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82229

--- Comment #5 from krzysio.kurek at wp dot pl ---
Created attachment 42199
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42199=edit
callgrind output

I can make the program output to console average fps after 20 iterations with
10 warmup cycles. The program will still run with GUI, but will output just FPS
to the console and exit. Will this be sufficient?
I'm a complete newbie to the whole language, but I got some profiling done. I'm
attaching callgrind output files, they're named after which compiler was used.

[Bug c++/82229] GCC7's LTO underperforms compared to GCC6

2017-09-16 Thread krzysio.kurek at wp dot pl
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82229

--- Comment #2 from krzysio.kurek at wp dot pl ---
I'm using CMake to generate a Makefile.
The Release build adds -O3 and -DNDEBUG by default to compile options.
I modify the config so that it also adds -flto.
Should I attach make verbose output?

[Bug c++/82229] New: GCC7's LTO underperforms compared to GCC6

2017-09-16 Thread krzysio.kurek at wp dot pl
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82229

Bug ID: 82229
   Summary: GCC7's LTO underperforms compared to GCC6
   Product: gcc
   Version: 7.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: krzysio.kurek at wp dot pl
  Target Milestone: ---

A small SFML project on github:
https://github.com/Hopson97/Empire
Takes huge advantage of -flto flag on GCC6, but after upgrading to GCC7, the
difference is negligible.
Here are some of my test results:
gcc6.3 no flto: 24-25 fps
gcc7.2 no flto: 24 fps
gcc6.3 with flto: 40-42fps
gcc7.2 with flto: 26-27fps