public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ivanka2012 at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug lto/106103] New: ICE in binds_to_current_def_p when source object files are compiled with -flto -Os
Date: Mon, 27 Jun 2022 11:55:49 +0000	[thread overview]
Message-ID: <bug-106103-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 106103
           Summary: ICE in binds_to_current_def_p when source object files
                    are compiled with -flto -Os
           Product: gcc
           Version: 12.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ivanka2012 at gmail dot com
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---
              Host: x86_64-build_pc-linux-gnu
            Target: x86_64-w64-mingw32
             Build: x86_64-build_pc-linux-gnu

Created attachment 53209
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53209&action=edit
Source code that contains alc.cpp.ii, buffer.cpp.ii and openal-info.c.i

Compile the attached source files in the archive with the following commands:
x86_64-w64-mingw32-g++ -flto -Os -std=gnu++14 -o alc.o -c alc.cpp.ii
x86_64-w64-mingw32-g++ -flto -Os -std=gnu++14 -o buffer.o -c buffer.cpp.ii
x86_64-w64-mingw32-gcc -flto -Os -std=gnu11 -o openal-info.o -c openal-info.c.i
x86_64-w64-mingw32-g++ -r openal-info.o buffer.o alc.o -o /dev/null -lkernel32

The linker will yield the following:
during GIMPLE pass: dse
alc.cpp.ii: In function 'alcGetString':
alc.cpp.ii:1167:13: internal compiler error: in binds_to_current_def_p, at
symtab.cc:2494
 1167 | const char *alcGetString() try {
      |             ^
0x681fd1 symtab_node::binds_to_current_def_p(symtab_node*)
        /x/crosstool-ng/.build/x86_64-w64-mingw32/src/gcc/gcc/symtab.cc:2494
0xc5a980 ref_maybe_used_by_call_p_1
       
/x/crosstool-ng/.build/x86_64-w64-mingw32/src/gcc/gcc/tree-ssa-alias.cc:2804
0xc5c137 ref_maybe_used_by_call_p
       
/x/crosstool-ng/.build/x86_64-w64-mingw32/src/gcc/gcc/tree-ssa-alias.cc:2929
0xc5c137 ref_maybe_used_by_stmt_p(gimple*, ao_ref*, bool)
       
/x/crosstool-ng/.build/x86_64-w64-mingw32/src/gcc/gcc/tree-ssa-alias.cc:2961
0xc7e517 dse_classify_store(ao_ref*, gimple*, bool, simple_bitmap_def*, bool*,
tree_node*)
       
/x/crosstool-ng/.build/x86_64-w64-mingw32/src/gcc/gcc/tree-ssa-dse.cc:981
0xc7ff76 dse_optimize_stmt
       
/x/crosstool-ng/.build/x86_64-w64-mingw32/src/gcc/gcc/tree-ssa-dse.cc:1385
0xc7ff76 execute
       
/x/crosstool-ng/.build/x86_64-w64-mingw32/src/gcc/gcc/tree-ssa-dse.cc:1491

The compiler is configured with the following flags:
--build=x86_64-build_pc-linux-gnu --host=x86_64-build_pc-linux-gnu
--target=x86_64-w64-mingw32 --prefix=/prefix --exec_prefix=/prefix
--with-sysroot=/prefix/x86_64-w64-mingw32/sysroot
--enable-languages=c,c++,fortran --with-pkgversion='crosstool-NG
1.25.0.40_994767d' --disable-shared --enable-__cxa_atexit --disable-libmudflap
--disable-libgomp --disable-libssp --disable-libquadmath
--disable-libquadmath-support --disable-libsanitizer --disable-libmpx
--disable-libstdcxx-verbose
--with-gmp=/x/crosstool-ng/.build/x86_64-w64-mingw32/buildtools
--with-mpfr=/x/crosstool-ng/.build/x86_64-w64-mingw32/buildtools
--with-mpc=/x/crosstool-ng/.build/x86_64-w64-mingw32/buildtools
--with-isl=/x/crosstool-ng/.build/x86_64-w64-mingw32/buildtools --enable-lto
--enable-threads=posix --enable-target-optspace --enable-plugin --disable-nls
--enable-multiarch --with-local-prefix=/prefix/x86_64-w64-mingw32/sysroot
--enable-long-long
However, this was supplied by crosstool-ng, which I used to compile the
toolchain. You might need to use that instead.
The toolchain can be compiled with crosstool-ng using the following:
./ct-ng x86_64-w64-mingw32
./ct-ng build
I also set the prefix to something more reasonable and all compiler and linker
flags were set to be '-g' but nothing else.

Notes:
This is already the most minimal possible test case. I tried fiddling with the
compiler and linker flags and the above combination is the most minimal one
that produces the ICE. The source code has also been processed with cvise for
several days.
I also observed this ICE in the "alias" GIMPLE pass in other test cases that
are not included here since I haven't reduced those.

             reply	other threads:[~2022-06-27 11:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-27 11:55 ivanka2012 at gmail dot com [this message]
2022-06-29 10:15 ` [Bug lto/106103] " ivanka2012 at gmail dot com
2023-01-14 11:14 ` [Bug tree-optimization/106103] " ivanka2012 at gmail dot com
2023-07-20 18:50 ` ivanka2012 at gmail dot com
2024-02-11 16:12 ` tanksherman27 at gmail dot com
2024-02-11 16:57 ` pinskia at gcc dot gnu.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-106103-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).