This bug happens on a cross-compiler targetting x86_64-pc-mingw32, but not on a
native x86_64-linux compiler. Both compilers are built with SVN trunk from the
same revision (128540).

Witn -m64, it doesn't error out at -O0, there is an ICE at -O1 and a different
error at -O2. With -m32, compilation seems fine in all cases.


$ cat foo.c
_Complex float
product_c4 (_Complex float *src)
{
  _Complex float res;
  int n;

  res = 1;
  for (n = 0; n < 10; n++)
    res *= src[n];
  return res;
}
$ ./gcc/cc1 -O0 -std=c99 -quiet foo.c -m64
$ ./gcc/cc1 -O1 -std=c99 -quiet foo.c -m64
foo.c: In function ‘product_c4’:
foo.c:11: internal compiler error: in reg_overlap_mentioned_p, at
rtlanal.c:1398
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
$ ./gcc/cc1 -O2 -std=c99 -quiet foo.c -m64
foo.c: In function ‘product_c4’:
foo.c:11: error: invalid rtl sharing found in the insn
(insn 114 113 115 2 foo.c:9 (set (subreg:DI (reg:SC 92) 0)
        (reg:DI 133)) -1 (nil))
foo.c:11: error: shared rtx
(subreg:DI (reg:SC 92) 0)
foo.c:11: internal compiler error: internal consistency failure
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.


My cross-compiler is:

$ ./gcc/xgcc -v
Using built-in specs.
Target: x86_64-pc-mingw32
Configured with: /home/fxcoudert/devel/trunk/configure
--prefix=/home/fxcoudert/mingw64-cross/install --target=x86_64-pc-mingw32
--enable-languages=c,fortran --disable-werror --with-gmp=/home/fxcoudert/local
Thread model: win32
gcc version 4.3.0 20070917 (experimental) [trunk revision 128540] (GCC)


The backtrace for the ICE at -O1 is:

#0  fancy_abort (file=0xb7d6e0 "/home/fxcoudert/devel/trunk/gcc/rtlanal.c",
    line=1398, function=0xb7d670 "reg_overlap_mentioned_p")
    at /home/fxcoudert/devel/trunk/gcc/diagnostic.c:654
#1  0x000000000067a8e9 in reg_overlap_mentioned_p (x=0x2b4d7a1fd180,
    in=0x2b4d7a1fa740) at /home/fxcoudert/devel/trunk/gcc/rtlanal.c:1398
#2  0x000000000067ac70 in reg_used_between_p (reg=0x2b4d7a1fd180,
    from_insn=<value optimized out>, to_insn=0xb7d670)
    at /home/fxcoudert/devel/trunk/gcc/rtlanal.c:721
#3  0x0000000000a0ec1e in can_combine_p (insn=0x2b4d7a1fe050,
    i3=0x2b4d7a1f29b0, pred=<value optimized out>, succ=0x2b4d7a1f2f50,
    pdest=0x7fff30e85460, psrc=0x7fff30e85458)
    at /home/fxcoudert/devel/trunk/gcc/combine.c:1605
#4  0x0000000000a15d18 in try_combine (i3=0x2b4d7a1f29b0,
    i2=<value optimized out>, i1=0x2b4d7a1fe050,
    new_direct_jump_p=0x7fff30e854f4)
    at /home/fxcoudert/devel/trunk/gcc/combine.c:2481
#5  0x0000000000a1a09d in rest_of_handle_combine ()
    at /home/fxcoudert/devel/trunk/gcc/combine.c:1152


I can investigate further if need be, tell me what to do. If you have access to
the GCC compiler farm, my build is available in
/home/fxcoudert/mingw64-cross/ibin


PS: the reason I found this bug is that it shows up while building libgfortran
for this cross-compiler :(


-- 
           Summary: ICE and invalid rtl sharing on x86_64-mingw cross-
                    compiler
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: fxcoudert at gcc dot gnu dot org
 GCC build triplet: x86_64-linux-gnu
  GCC host triplet: x86_64-linux-gnu
GCC target triplet: x86_64-pc-mingw32


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33472

Reply via email to