egcs-1.1.2: error in emit_move_insn_1

Pavel Roskin pavel_roskin@geocities.com
Thu May 13 10:18:00 GMT 1999


Hello!

egcs-1.1.2 (as well as the current CVS version, branch egcs_1_1_branch)
fails to compile following program:

struct str1 { int arr1[4]; };
static int die_now (int i)
{
  return (((struct str1 *) 0)->arr1[i]);
}

$ ./cc1 bug.i
 die_nowexpr.c:2568: Internal compiler error in function emit_move_insn_1

My machine: Linux-2.2.8, glibc-2.1.1 (from RedHat-6.0), identified as
i686-pc-linux-gnu

Following facts are known to me:
1) Any optimization makes the bug disappear
2) It is important that the size of the structure is more than 8 bytes
3) It is important that a constant is used left of "->" and a variable on
the right side

Backtrace from the CVS/current/egcs_1_1_branch:

Breakpoint 1, emit_move_insn_1 (x=0x825d484, y=0x8256320) at expr.c:2568
2568        abort ();
(gdb) where
#0  emit_move_insn_1 (x=0x825d484, y=0x8256320) at expr.c:2568
#1  0x80a82ed in emit_move_insn (x=0x825d484, y=0x8256320) at expr.c:2446
#2  0x80cd8a0 in force_reg (mode=VOIDmode, x=0x8256320) at explow.c:674
#3  0x80b17ab in expand_expr (exp=0x825bedc, target=0x825d388,
tmode=SImode, 
    modifier=EXPAND_NORMAL) at expr.c:6212
#4  0x809c9a8 in expand_return (retval=0x825bef4) at stmt.c:2661
#5  0x8067dce in c_expand_return (retval=0x825bedc) at c-typeck.c:6989
#6  0x804d0c6 in yyparse () at c-parse.y:1811
#7  0x806ffef in compile_file (name=0xbffffd5a "bug.i") at toplev.c:2775
#8  0x80737c7 in main (argc=2, argv=0xbffffc14, envp=0xbffffc20)
    at toplev.c:4845
#9  0x4002fcb3 in __libc_start_main (main=0x807267c <main>, argc=2, 
    argv=0xbffffc14, init=0x8048d68 <_init>, fini=0x8203acc <_fini>, 
    rtld_fini=0x4000a350 <_dl_fini>, stack_end=0xbffffc0c)
    at ../sysdeps/generic/libc-start.c:78
(gdb) p *x
$1 = {code = REG, mode = VOIDmode, jump = 0, call = 0, unchanging = 0, 
  volatil = 0, in_struct = 0, used = 0, integrated = 0, frame_related = 0, 
  fld = {{rtwint = 25, rtint = 25, rtstr = 0x19 <Address 0x19 out of
bounds>, 
      rtx = 0x19, rtvec = 0x19, rttype = CHImode, rt_addr_diff_vec_flags =
{
        min_align = 25, base_after_vec = 0, min_after_vec = 0, 
        max_after_vec = 0, min_after_base = 0, max_after_base = 0, 
        offset_unsigned = 0,  = 0, scale = 0}, rtbit = 0x19, rttree =
0x19}}}
(gdb) p *y
$2 = {code = CONST_INT, mode = VOIDmode, jump = 0, call = 0, unchanging =
0, 
  volatil = 0, in_struct = 0, used = 0, integrated = 0, frame_related = 0, 
  fld = {{rtwint = 0, rtint = 0, rtstr = 0x0, rtx = 0x0, rtvec = 0x0, 
      rttype = VOIDmode, rt_addr_diff_vec_flags = {min_align = 0, 
        base_after_vec = 0, min_after_vec = 0, max_after_vec = 0, 
        min_after_base = 0, max_after_base = 0, offset_unsigned = 0,  = 0, 
        scale = 0}, rtbit = 0x0, rttree = 0x0}}}
(gdb)

Pavel Roskin



More information about the Gcc-bugs mailing list