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

Reply via email to