This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: 3.0-pre crashes on i686 code
Jan Hubicka wrote:
>
> > Jan Hubicka wrote:
> > >
> > > Looking at the crash, it seems to be latent bug. Can you try whether following patch fix your testcase?
> > > Thu May 31 18:04:54 CEST 2001 Jan Hubicka <jh@suse.cz>
> > > * i386.c (ix86_expand_int_movcc): Force one of operands to be register.
> > > Index: config/i386/i386.c
> > > ===================================================================
> > > RCS file: /cvs/gcc/egcs/gcc/config/i386/i386.c,v
> > > retrieving revision 1.261
> > > diff -c -3 -p -r1.261 i386.c
> > > *** i386.c 2001/05/24 13:59:09 1.261
> > > --- i386.c 2001/05/31 16:04:45
> > > *************** ix86_expand_int_movcc (operands)
> > > *** 6575,6580 ****
> > > --- 6575,6583 ----
> > > emit_move_insn (tmp, operands[2]);
> > > operands[2] = tmp;
> > > }
> > > + if (! register_operand (operands[2], VOIDmode)
> > > + && ! register_operand (operands[3], VOIDmode))
> > > + operands[2] = force_reg (GET_MODE (operands[0]), operands[2]);
> > >
> > > emit_insn (compare_seq);
> > > emit_insn (gen_rtx_SET (VOIDmode, operands[0],
> >
> > Yes, it compiles now.
> Good,
> Can you share the testcase, so it can be considered for approval for 3.0?
I can reproduce the same crash with this small program, and the patch
fixes the compilation problem:
#include <fstream>
void crash ()
{
std::ofstream out ("/tmp/whatever-file");
}
bash$ /usr/local/gcc3/bin/g++ -march=i686 -O -c crash.cc
/usr/local/gcc3/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/bits/basic_ios.tcc:
In
member function `void std::basic_ios<_CharT,
_Traits>::init(std::basic_streambuf<_CharT, _Traits>*) [with _CharT =
char,
_Traits = std::char_traits<char>]':
/usr/local/gcc3/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/bits/std_fstream.h:321:
instantiated from `std::basic_ofstream<_CharT,
_Traits>::basic_ofstream(const char*, std::_Ios_Openmode) [with _CharT =
char, _Traits = std::char_traits<char>]'
crash.cc:4: instantiated from here
/usr/local/gcc3/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/bits/basic_ios.tcc:130:
Unrecognizable
insn:
(insn 127 126 112 (set (reg:SI 52)
(if_then_else:SI (ne (reg:CCZ 17 flags)
(const_int 0 [0x0]))
(mem/u/f:SI (symbol_ref:SI ("_ZNSt8ios_base7goodbitE")) 0)
(mem/u/f:SI (symbol_ref:SI ("_ZNSt8ios_base6badbitE")) 0)))
-1 (insn_list 126 (nil))
(expr_list:REG_DEAD (reg:CCZ 17 flags)
(nil)))
/usr/local/gcc3/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/bits/basic_ios.tcc:130:
Internal
compiler error in extract_insn, at recog.c:2210
Teemu