public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/95949] New: mame build succeeds with -O3 but fails with -O2 and all -O3 flags added manually
@ 2020-06-28 15:59 belegdol at gmail dot com
  2020-06-28 16:00 ` [Bug c++/95949] " belegdol at gmail dot com
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: belegdol at gmail dot com @ 2020-06-28 15:59 UTC (permalink / raw)
  To: gcc-bugs

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/95949] mame build succeeds with -O3 but fails with -O2 and all -O3 flags added manually
  2020-06-28 15:59 [Bug c++/95949] New: mame build succeeds with -O3 but fails with -O2 and all -O3 flags added manually belegdol at gmail dot com
@ 2020-06-28 16:00 ` belegdol at gmail dot com
  2020-06-28 16:02 ` belegdol at gmail dot com
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: belegdol at gmail dot com @ 2020-06-28 16:00 UTC (permalink / raw)
  To: gcc-bugs

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

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/95949] mame build succeeds with -O3 but fails with -O2 and all -O3 flags added manually
  2020-06-28 15:59 [Bug c++/95949] New: mame build succeeds with -O3 but fails with -O2 and all -O3 flags added manually belegdol at gmail dot com
  2020-06-28 16:00 ` [Bug c++/95949] " belegdol at gmail dot com
@ 2020-06-28 16:02 ` belegdol at gmail dot com
  2020-06-29 10:41 ` rguenth at gcc dot gnu.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: belegdol at gmail dot com @ 2020-06-28 16:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Julian Sikorski <belegdol at gmail dot com> ---
The corresponding mame bug:
https://github.com/mamedev/mame/issues/6804

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/95949] mame build succeeds with -O3 but fails with -O2 and all -O3 flags added manually
  2020-06-28 15:59 [Bug c++/95949] New: mame build succeeds with -O3 but fails with -O2 and all -O3 flags added manually belegdol at gmail dot com
  2020-06-28 16:00 ` [Bug c++/95949] " belegdol at gmail dot com
  2020-06-28 16:02 ` belegdol at gmail dot com
@ 2020-06-29 10:41 ` rguenth at gcc dot gnu.org
  2020-06-29 12:42 ` redi at gcc dot gnu.org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-06-29 10:41 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2020-06-29
     Ever confirmed|0                           |1

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
What we inline and what not changes across releases, without a testcase
my suspicion is that mame uses extern template but fails to provide
all necessary instantiations.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/95949] mame build succeeds with -O3 but fails with -O2 and all -O3 flags added manually
  2020-06-28 15:59 [Bug c++/95949] New: mame build succeeds with -O3 but fails with -O2 and all -O3 flags added manually belegdol at gmail dot com
                   ` (2 preceding siblings ...)
  2020-06-29 10:41 ` rguenth at gcc dot gnu.org
@ 2020-06-29 12:42 ` redi at gcc dot gnu.org
  2020-06-29 16:11 ` belegdol at gmail dot com
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2020-06-29 12:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Please provide preprocessed source for Eminem.cpp, compiled with -O2

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/95949] mame build succeeds with -O3 but fails with -O2 and all -O3 flags added manually
  2020-06-28 15:59 [Bug c++/95949] New: mame build succeeds with -O3 but fails with -O2 and all -O3 flags added manually belegdol at gmail dot com
                   ` (3 preceding siblings ...)
  2020-06-29 12:42 ` redi at gcc dot gnu.org
@ 2020-06-29 16:11 ` belegdol at gmail dot com
  2020-06-29 17:20 ` redi at gcc dot gnu.org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: belegdol at gmail dot com @ 2020-06-29 16:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Julian Sikorski <belegdol at gmail dot com> ---
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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/95949] mame build succeeds with -O3 but fails with -O2 and all -O3 flags added manually
  2020-06-28 15:59 [Bug c++/95949] New: mame build succeeds with -O3 but fails with -O2 and all -O3 flags added manually belegdol at gmail dot com
                   ` (4 preceding siblings ...)
  2020-06-29 16:11 ` belegdol at gmail dot com
@ 2020-06-29 17:20 ` redi at gcc dot gnu.org
  2020-06-29 17:23 ` redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2020-06-29 17:20 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |UNCONFIRMED
     Ever confirmed|1                           |0

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #4)
> Please provide preprocessed source for Eminem.cpp, compiled with -O2

Thanks for realising I meant emumem.cpp, despite my phone's autocorrect!

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/95949] mame build succeeds with -O3 but fails with -O2 and all -O3 flags added manually
  2020-06-28 15:59 [Bug c++/95949] New: mame build succeeds with -O3 but fails with -O2 and all -O3 flags added manually belegdol at gmail dot com
                   ` (5 preceding siblings ...)
  2020-06-29 17:20 ` redi at gcc dot gnu.org
@ 2020-06-29 17:23 ` redi at gcc dot gnu.org
  2020-06-29 17:38 ` belegdol at gmail dot com
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2020-06-29 17:23 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |WAITING

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The preprocessed source is incomplete, it looks like the relevant declarations
are probably in the preprocessed header
./../../../../mingw-gcc/obj/x64/Release/emu.h.gch

Can you disable the use of the preprocessed header?

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/95949] mame build succeeds with -O3 but fails with -O2 and all -O3 flags added manually
  2020-06-28 15:59 [Bug c++/95949] New: mame build succeeds with -O3 but fails with -O2 and all -O3 flags added manually belegdol at gmail dot com
                   ` (6 preceding siblings ...)
  2020-06-29 17:23 ` redi at gcc dot gnu.org
@ 2020-06-29 17:38 ` belegdol at gmail dot com
  2020-06-29 20:17 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: belegdol at gmail dot com @ 2020-06-29 17:38 UTC (permalink / raw)
  To: gcc-bugs

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

Julian Sikorski <belegdol at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #48803|0                           |1
        is obsolete|                            |

--- Comment #8 from Julian Sikorski <belegdol at gmail dot com> ---
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.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/95949] mame build succeeds with -O3 but fails with -O2 and all -O3 flags added manually
  2020-06-28 15:59 [Bug c++/95949] New: mame build succeeds with -O3 but fails with -O2 and all -O3 flags added manually belegdol at gmail dot com
                   ` (7 preceding siblings ...)
  2020-06-29 17:38 ` belegdol at gmail dot com
@ 2020-06-29 20:17 ` redi at gcc dot gnu.org
  2020-07-30 14:21 ` belegdol at gmail dot com
  2021-12-17 19:39 ` belegdol at gmail dot com
  10 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2020-06-29 20:17 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |UNCONFIRMED
     Ever confirmed|1                           |0

--- Comment #9 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Thanks

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/95949] mame build succeeds with -O3 but fails with -O2 and all -O3 flags added manually
  2020-06-28 15:59 [Bug c++/95949] New: mame build succeeds with -O3 but fails with -O2 and all -O3 flags added manually belegdol at gmail dot com
                   ` (8 preceding siblings ...)
  2020-06-29 20:17 ` redi at gcc dot gnu.org
@ 2020-07-30 14:21 ` belegdol at gmail dot com
  2021-12-17 19:39 ` belegdol at gmail dot com
  10 siblings, 0 replies; 12+ messages in thread
From: belegdol at gmail dot com @ 2020-07-30 14:21 UTC (permalink / raw)
  To: gcc-bugs

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

W E Brown <webrown.cpp at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |webrown.cpp at gmail dot com

Julian Sikorski <belegdol at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|10.1.0                      |10.2.0

--- Comment #10 from Julian Sikorski <belegdol at gmail dot com> ---
10.2.0 is still affected.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/95949] mame build succeeds with -O3 but fails with -O2 and all -O3 flags added manually
  2020-06-28 15:59 [Bug c++/95949] New: mame build succeeds with -O3 but fails with -O2 and all -O3 flags added manually belegdol at gmail dot com
                   ` (9 preceding siblings ...)
  2020-07-30 14:21 ` belegdol at gmail dot com
@ 2021-12-17 19:39 ` belegdol at gmail dot com
  10 siblings, 0 replies; 12+ messages in thread
From: belegdol at gmail dot com @ 2021-12-17 19:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from Julian Sikorski <belegdol at gmail dot com> ---
I can still reproduce this with mame master
(0b418d65bae66baa9f334c6daa6dcb4148909f7f) and mingw-w64-x86_64-gcc 11.2.0-5.

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2021-12-17 19:39 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-28 15:59 [Bug c++/95949] New: mame build succeeds with -O3 but fails with -O2 and all -O3 flags added manually belegdol at gmail dot com
2020-06-28 16:00 ` [Bug c++/95949] " belegdol at gmail dot com
2020-06-28 16:02 ` belegdol at gmail dot com
2020-06-29 10:41 ` rguenth at gcc dot gnu.org
2020-06-29 12:42 ` redi at gcc dot gnu.org
2020-06-29 16:11 ` belegdol at gmail dot com
2020-06-29 17:20 ` redi at gcc dot gnu.org
2020-06-29 17:23 ` redi at gcc dot gnu.org
2020-06-29 17:38 ` belegdol at gmail dot com
2020-06-29 20:17 ` redi at gcc dot gnu.org
2020-07-30 14:21 ` belegdol at gmail dot com
2021-12-17 19:39 ` belegdol at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).