[Bug c++/95949] New: mame build succeeds with -O3 but fails with -O2 and all -O3 flags added manually

2020-06-28 Thread belegdol at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95949

Bug ID: 95949
   Summary: mame build succeeds with -O3 but fails with -O2 and
all -O3 flags added manually
   Product: gcc
   Version: 10.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: belegdol at gmail dot com
  Target Milestone: ---
  Host: Windows MSYS2
Target: x86_64

mame [1] no longer builds with optimisation options below -O3 since revision
22513fb6fe281f5ccb75aaddb6417a12a66c313d. 
I have tried isolating the flag making the build succeed but even with all
flags enabled the linking still fails. In other words

make SOURCES=src/mame/drivers/model1.cpp NOWERROR=1 OPTIMIZE=3 VERBOSE=1 -j12

works, but

make SOURCES=src/mame/drivers/model1.cpp NOWERROR=1 OPTIMIZE=2
OPT_FLAGS="-fgcse-after-reload -fipa-cp-clone -floop-interchange
-floop-unroll-and-jam -fpeel-loops -fpredictive-commoning -fsplit-loops
-fsplit-paths -ftree-loop-distribution -ftree-loop-vectorize -ftree-partial-pre
-ftree-slp-vectorize -funswitch-loops -fvect-cost-model
-fvect-cost-model=dynamic -fversion-loops-for-strides" VERBOSE=1 -j12

does not. Linking fails with tons of undefined references. I am going to attach
the full list.

In order to reproduce the issue:
1. Install msys2
2. set it up for mame compilation as per [2]
3. git clone mame source code
4. export MINGW64=/mingw64
5. make SOURCES=src/mame/drivers/model1.cpp NOWERROR=1 OPTIMIZE=2
OPT_FLAGS="-fgcse-after-reload -fipa-cp-clone -floop-interchange
-floop-unroll-and-jam -fpeel-loops -fpredictive-commoning -fsplit-loops
-fsplit-paths -ftree-loop-distribution -ftree-loop-vectorize -ftree-partial-pre
-ftree-slp-vectorize -funswitch-loops -fvect-cost-model
-fvect-cost-model=dynamic -fversion-loops-for-strides" VERBOSE=1 -j12

I am happy to provide intermediate build objects, please let me know which
ones.

[1] https://github.com/mamedev/mame
[2]
https://docs.mamedev.org/initialsetup/compilingmame.html#using-a-standard-msys2-installation

[Bug c++/95949] mame build succeeds with -O3 but fails with -O2 and all -O3 flags added manually

2020-06-28 Thread belegdol at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95949

--- Comment #1 from Julian Sikorski  ---
Created attachment 48797
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48797&action=edit
Linking error log

[Bug c++/95949] mame build succeeds with -O3 but fails with -O2 and all -O3 flags added manually

2020-06-28 Thread belegdol at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95949

--- Comment #2 from Julian Sikorski  ---
The corresponding mame bug:
https://github.com/mamedev/mame/issues/6804

[Bug c++/95949] mame build succeeds with -O3 but fails with -O2 and all -O3 flags added manually

2020-06-29 Thread belegdol at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95949

--- Comment #5 from Julian Sikorski  ---
Created attachment 48803
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48803&action=edit
Preprocessed emumem.cpp source

Preprocessed source obtained with:
make SOURCES=src/mame/drivers/model1.cpp REGENIE=1 NOWERROR=1 OPTIMIZE=2
OPT_FLAGS="-save-temps" VERBOSE=1 -j12

[Bug c++/95949] mame build succeeds with -O3 but fails with -O2 and all -O3 flags added manually

2020-06-29 Thread belegdol at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95949

Julian Sikorski  changed:

   What|Removed |Added

  Attachment #48803|0   |1
is obsolete||

--- Comment #8 from Julian Sikorski  ---
Created attachment 48807
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48807&action=edit
Preprocessed emumem.cpp source with precompiled header off

Preprocessed source obtained with:
make SOURCES=src/mame/drivers/model1.cpp REGENIE=1 NOWERROR=1 OPTIMIZE=2
PRECOMPILE=0 OPT_FLAGS="-save-temps" VERBOSE=1 -j12
Compressed because uncompressed file is 3.3 MB.

[Bug c++/95949] mame build succeeds with -O3 but fails with -O2 and all -O3 flags added manually

2020-07-30 Thread belegdol at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95949

W E Brown  changed:

   What|Removed |Added

 CC||webrown.cpp at gmail dot com

Julian Sikorski  changed:

   What|Removed |Added

Version|10.1.0  |10.2.0

--- Comment #10 from Julian Sikorski  ---
10.2.0 is still affected.

[Bug c++/98515] New: Possible regression causing "is protected within this context" error

2021-01-04 Thread belegdol at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98515

Bug ID: 98515
   Summary: Possible regression causing "is protected within this
context" error
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: belegdol at gmail dot com
  Target Milestone: ---

mame-0.227 has failed to compile with gcc-11 in Fedora 34 [1]
(gcc-11.0.0-0.11.fc34). mame developers have kindly provided a minimal test
case. This fails with gcc-11 but works on 

class A {
public:
A() = default;

protected:
int var0 = 0;
};

template class B : public A {
public:
using A::A;
};

template class C : public B {
public:
using B::B;

void g();
};

template void C::g()
{
A::var0++;
}

template class C<0, 0>;

While this works:

class A {
public:
A() = default;

protected:
int var0 = 0;
};

template class B : public A {
public:
using A::A;
};

template class C : public B {
public:
using B::B;

void g() { A::var0++; }
};

template class C<0, 0>;

[1] https://github.com/mamedev/mame/issues/7616

[Bug c++/98515] Possible regression causing "is protected within this context" error

2021-01-04 Thread belegdol at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98515

--- Comment #1 from Julian Sikorski  ---
Created attachment 49877
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49877&action=edit
compiling test case

[Bug c++/98515] Possible regression causing "is protected within this context" error

2021-01-04 Thread belegdol at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98515

--- Comment #2 from Julian Sikorski  ---
Created attachment 49878
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49878&action=edit
failing test case

[Bug c++/98515] Possible regression causing "is protected within this context" error

2021-01-04 Thread belegdol at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98515

--- Comment #3 from Julian Sikorski  ---
The initial comment meant to say: This fails with gcc-11 but works on gcc-10.2.

[Bug c++/95949] mame build succeeds with -O3 but fails with -O2 and all -O3 flags added manually

2021-12-17 Thread belegdol at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95949

--- Comment #11 from Julian Sikorski  ---
I can still reproduce this with mame master
(0b418d65bae66baa9f334c6daa6dcb4148909f7f) and mingw-w64-x86_64-gcc 11.2.0-5.