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

            Bug ID: 120741
           Summary: [16 Regression] ICE on mingw-w64-12.0.0: during RTL
                    pass: pro_and_epilogue ICE in ix86_expand_prologue, at
                    config/i386/i386.cc:9446
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: slyfox at gcc dot gnu.org
  Target Milestone: ---

After a PR120697 fix (I did not check before) gcc-master ICEs on
mingw-w64-12.0.0 for `i686-w64-mingw32` target as.

Extracted example:

// $ cat mingw_wvfscanf.c.c
typedef __builtin_va_list va_list;
short *__mingw_swformat_format;
va_list __mingw_swformat_arg;
int __mingw_swformat_fc;
double __mingw_wcstod();
void *memset();
typedef struct {
  void *fp;
  int bch[1024];
} _IFP;
static int __mingw_swformat(_IFP *s, va_list argp) {
  short *f = __mingw_swformat_format;
  __mingw_swformat_arg = argp;
  if (!s || s->fp)
    return '.';
  while (f)
    switch (__mingw_swformat_fc) {
    case 'A':
      double d = __mingw_wcstod();
      *__builtin_va_arg(__mingw_swformat_arg, double *) = d;
    }
  _IFP ifp;
  return __mingw_swformat(&ifp, argp);
}
void __mingw_vswscanf(va_list argp) {
  _IFP ifp;
  memset(&ifp, 0, sizeof(_IFP));
  __mingw_swformat(&ifp, argp);
}

$ i686-w64-mingw32-gcc -std=gnu99   -O2 -c mingw_wvfscanf.c.c -o bug.o

during RTL pass: pro_and_epilogue
mingw_wvfscanf.c.c: In function '__mingw_vswscanf':
mingw_wvfscanf.c.c:29:1: internal compiler error: in ix86_expand_prologue, at
config/i386/i386.cc:9446
   29 | }
      | ^
0x21b2e98 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
        ???:0
0x21cd32a internal_error(char const*, ...)
        ???:0
0x7990c9 fancy_abort(char const*, int, char const*)
        ???:0
0x7816db ix86_expand_prologue() [clone .cold]
        ???:0
0x1a96d1d gen_prologue()
        ???:0
0x12cbcdc target_gen_prologue()
        ???:0
0xad1d1f make_prologue_seq()
        ???:0
0xad2425 thread_prologue_and_epilogue_insns()
        ???:0
0xad252a (anonymous
namespace)::pass_late_thread_prologue_and_epilogue::execute(function*)
        ???:0
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.

$ i686-w64-mingw32-gcc -v |& unnix
Using built-in specs.
COLLECT_GCC=/<<NIX>>/i686-w64-mingw32-nolibc-gcc-16.0.0.99999999/bin/i686-w64-mingw32-gcc
COLLECT_LTO_WRAPPER=/<<NIX>>/i686-w64-mingw32-nolibc-gcc-16.0.0.99999999/libexec/gcc/i686-w64-mingw32/16.0.0/lto-wrapper
Target: i686-w64-mingw32
Configured with: ../source/configure
--prefix=/<<NIX>>/i686-w64-mingw32-nolibc-gcc-16.0.0.99999999
--with-gmp-include=/<<NIX>>/gmp-with-cxx-6.3.0-dev/include
--with-gmp-lib=/<<NIX>>/gmp-with-cxx-6.3.0/lib
--with-mpfr-include=/<<NIX>>/mpfr-4.2.2-dev/include
--with-mpfr-lib=/<<NIX>>/mpfr-4.2.2/lib --with-mpc=/<<NIX>>/libmpc-1.3.1
--program-prefix=i686-w64-mingw32- --enable-lto --disable-libstdcxx-pch
--without-included-gettext --with-system-zlib --enable-checking=release
--enable-static --enable-languages=c --disable-multilib --disable-shared
--enable-plugin --with-isl=/<<NIX>>/isl-0.20
--with-as=/<<NIX>>/i686-w64-mingw32-binutils-wrapper-2.44/bin/i686-w64-mingw32-as
--disable-libssp --disable-nls --without-headers --disable-threads
--disable-libgomp --disable-libquadmath --disable-shared --disable-libatomic
--disable-decimal-float --disable-libmpx
--with-headers=/<<NIX>>/mingw_w64-headers-12.0.0/include --with-gcc
--with-gnu-as --with-gnu-ld --disable-debug --disable-win32-registry
--enable-hash-synchronization --enable-libssp --disable-nls
--enable-fully-dynamic-string --enable-sjlj-exceptions --with-dwarf2
--disable-bootstrap --build=x86_64-unknown-linux-gnu
--host=x86_64-unknown-linux-gnu --target=i686-w64-mingw32
--with-build-sysroot=/build/source/..
Thread model: single
Supported LTO compression algorithms: zlib
gcc version 16.0.0 99999999 (experimental) (GCC)

Reply via email to