public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "eebssk1 at godaftwithebk dot pub" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/108383] New: g++ ICE with -O3 and -flto on simple function
Date: Thu, 12 Jan 2023 13:53:36 +0000	[thread overview]
Message-ID: <bug-108383-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 108383
           Summary: g++ ICE with -O3 and -flto on simple function
           Product: gcc
           Version: 12.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: eebssk1 at godaftwithebk dot pub
  Target Milestone: ---

Getting ICE with O3&flto when compiling a project.
Using mingw32 cross compiler on linux.
project url: https://github.com/doitsujin/dxvk

x86_64-w64-mingw32-g++  -o src/dxgi/dxgi.dll src/dxgi/dxgi.dll.p/version.o
src/dxgi/dxgi.dll.p/dxgi_adapter.cpp.obj src/dxgi/dxgi.dll.p/dxgi_enums.cpp.obj
src/dxgi/dxgi.dll.p/dxgi_factory.cpp.obj
src/dxgi/dxgi.dll.p/dxgi_format.cpp.obj src/dxgi/dxgi.dll.p/dxgi_main.cpp.obj
src/dxgi/dxgi.dll.p/dxgi_monitor.cpp.obj
src/dxgi/dxgi.dll.p/dxgi_options.cpp.obj
src/dxgi/dxgi.dll.p/dxgi_output.cpp.obj
src/dxgi/dxgi.dll.p/dxgi_surface.cpp.obj
src/dxgi/dxgi.dll.p/dxgi_swapchain.cpp.obj -Wl,--allow-shlib-undefined -Wl,-O1
-shared ../src/dxgi/dxgi.def -Wl,--start-group
-Wl,--out-implib=src/dxgi/dxgi.dll.a -static -static-libgcc -static-libstdc++
-Wl,--file-alignment=4096 src/dxvk/libdxvk.a src/util/libutil.a
src/spirv/libspirv.a src/wsi/libwsi.a
subprojects/libdisplay-info/libdisplay-info.a src/vulkan/libvkcommon.a -pthread
-lm -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid
-lcomdlg32 -ladvapi32 -Wl,--end-group
lto-wrapper: warning: using serial compilation of 21 LTRANS jobs
lto-wrapper: note: see the ‘-flto’ option documentation for more information
during GIMPLE pass: alias
../src/dxgi/dxgi_adapter.cpp: In member function
‘RegisterVideoMemoryBudgetChangeNotificationEvent’:
../src/dxgi/dxgi_adapter.cpp:402:61: internal compiler error: in
binds_to_current_def_p, at symtab.cc:2494
  402 |   HRESULT STDMETHODCALLTYPE 
DxgiAdapter::RegisterVideoMemoryBudgetChangeNotificationEvent(
      |                                                             ^
0x62d5fd symtab_node::binds_to_current_def_p(symtab_node*)
        ../../gcc/symtab.cc:2494
0x84ddd7 gimple_call_arg_flags(gcall const*, unsigned int)
        ../../gcc/gimple.cc:1583
0xce9a84 handle_rhs_call
        ../../gcc/tree-ssa-structalias.cc:4335
0xcebe1a find_func_aliases_for_call
        ../../gcc/tree-ssa-structalias.cc:5010
0xcebe1a find_func_aliases
        ../../gcc/tree-ssa-structalias.cc:5113
0xcee3c6 compute_points_to_sets
        ../../gcc/tree-ssa-structalias.cc:7536
0xcee3c6 compute_may_aliases()
        ../../gcc/tree-ssa-structalias.cc:8044
0xa4ff5c execute_function_todo
        ../../gcc/passes.cc:2057
0xa50c9c do_per_function
        ../../gcc/passes.cc:1688
0xa50c9c execute_todo
        ../../gcc/passes.cc:2139
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
lto-wrapper: fatal error: x86_64-w64-mingw32-g++ returned 1 exit status
compilation terminated.

and then

../src/dxgi/dxgi_adapter.cpp: In member function
‘RegisterVideoMemoryBudgetChangeNotificationEvent’:
../src/dxgi/dxgi_adapter.cpp:402:71: internal compiler error: in
binds_to_current_def_p, at symtab.cc:2494
  402 |   HRESULT STDMETHODCALLTYPE __attribute__((optimize("no-tree-pta"))) 
DxgiAdapter::RegisterVideoMemoryBudgetChangeNotificationEvent(
      |                                                                       ^
0x62d5fd symtab_node::binds_to_current_def_p(symtab_node*)
        ../../gcc/symtab.cc:2494
0x912baf merge_call_side_effects
        ../../gcc/ipa-modref.cc:1310
0x913671 analyze_call
        ../../gcc/ipa-modref.cc:1678
0x913671 analyze_stmt
        ../../gcc/ipa-modref.cc:1811
0x91a19a analyze
        ../../gcc/ipa-modref.cc:1900
0x91a19a analyze_function
        ../../gcc/ipa-modref.cc:3219
0x91c5da execute
        ../../gcc/ipa-modref.cc:4186

and then

with __attribute__((optimize("no-tree-pta","no-ipa-modref")))
the code unit compiled without ICE.

The optimizations are in O1, however if i simply use
__attribute__((optimize(2))),then the code unit does compile too, which is
really weired.

There's similar(may be same?) issues in here:
https://github.com/msys2/MINGW-packages/issues/11726 , ICE in same gcc code
location (symtab.cc:2494), with different flags though.

             reply	other threads:[~2023-01-12 13:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-12 13:53 eebssk1 at godaftwithebk dot pub [this message]
2023-01-12 15:05 ` [Bug c++/108383] " eebssk1 at godaftwithebk dot pub
2023-01-13  7:25 ` [Bug ipa/108383] g++ ICE with -O3 and -flto and -fdeclone-ctor-dtor " rguenth at gcc dot gnu.org
2023-01-13 13:10 ` eebssk1 at godaftwithebk dot pub
2023-01-13 13:20 ` eebssk1 at godaftwithebk dot pub
2023-01-14 11:09 ` ivanka2012 at gmail dot com
2023-02-06 11:42 ` eebssk1 at godaftwithebk dot pub
2024-03-19  7:34 ` sjames at gcc dot gnu.org
2024-04-16 21:22 ` peter0x44 at disroot dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-108383-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).