Bootstrap failure - unrecognizable insn compiling f/target.c

Zack Weinberg zack@wolery.cumb.org
Mon Jun 12 10:35:00 GMT 2000


On Sun, Jun 11, 2000 at 11:38:15PM -0700, Tim Prince wrote:
> Yes, we've been having to work around this for months.  This is the main
> reason for not attempting to build g77 until after gcc has been
> bootstrapped and installed.  Perhaps I'm not sufficiently familiar with
> the process of tracking bug reports to make sure they get listed
> properly.

Well, it's good to know it's not just me ;)

I investigated a bit more thoroughly.  Here is a test case.

typedef unsigned int size_t;
typedef unsigned long long int ffetargetTypeless;
extern void *memcpy (void *__restrict, const void *__restrict, size_t);
extern void *memset (void *, int, size_t);

int
ffetarget_convert_any_typeless_ (char *res, size_t size, ffetargetTypeless l)
{
  unsigned long long int l1;
  unsigned char l5;
  size_t size_of;
  char *p;
  l5 = l;
  p = (char *) &l5;
  size_of = sizeof (l5);
  l1 = l5;
  if (size <= size_of)
    {
      int i = size_of - size;
      memcpy (res, p + i, size);
      for (; i > 0; ++p, --i)
	if (*p != '\0')
	  return 1;
    }
  else
    {
      int i = size - size_of;
      memset (res, 0, i);
      memcpy (res + i, p, size_of);
    }
  if (l1 != l)
    return 1;
  return 0;
}

(This is a stripped down version of the original function. As usual,
the Fortran front end's sheer bizarreness leaves me awestruck.)

Compile with latest CVS, -Os:

$ ../../stage1/cc1 target.i -quiet -version -Os -da -o target.s
GNU C version 2.96 20000611 (experimental) (i686-pc-linux) 
compiled by GNU C version 2.95.2 20000313 (Debian GNU/Linux).
target.i: In function `ffetarget_convert_any_typeless_':
target.i:34: Unrecognizable insn:

(insn 195 193 198 (set (reg:SI 5 edi)
        (plus:SI (reg:SI 5 edi)
            (mem:SI (plus:SI (reg:SI 6 ebp)
                    (const_int -44 [0xffffffd4])) 0))) -1 (nil)
    (expr_list:REG_EQUIV (plus:SI (mem/f:SI (plus:SI (reg:SI 6 ebp)
                    (const_int 8 [0x8])) 0)
            (mem:SI (plus:SI (reg:SI 6 ebp)
                    (const_int -44 [0xffffffd4])) 0))
        (nil)))
target.i:34: Internal compiler error in `extract_insn', at recog.c:2048
Please submit a full bug report.
See <URL: http://www.gnu.org/software/gcc/bugs.html > for instructions.

The crash is inside reload.

(gdb) bt
#0  fancy_abort (file=0x82ea7dc "recog.c", line=2048, 
    function=0x82eaaf0 "extract_insn") at rtl.c:1236
#1  0x804b599 in _fatal_insn (msgid=0x82c9356 "Unrecognizable insn:", 
    insn=0x4010d7c0, file=0x82ea7dc "recog.c", line=2048, 
    function=0x82eaaf0 "extract_insn") at diagnostic.c:1416
#2  0x804b5d0 in _fatal_insn_not_found (insn=0x4010d7c0, 
    file=0x82ea7dc "recog.c", line=2048, 
    function=0x82eaaf0 "extract_insn") at diagnostic.c:1427
#3  0x81bad17 in extract_insn (insn=0x4010d7c0)
    at recog.c:2048
#4  0x81b650e in cleanup_subreg_operands (insn=0x4010d7c0)
    at final.c:3092
#5  0x818ee69 in reload (first=0x401091e0, global=1, dumpfile=0x0)
    at reload1.c:1150
#6  0x8176acc in global_alloc (file=0x0) at global.c:581
#7  0x804e274 in rest_of_compilation (decl=0x40108680)
    at toplev.c:3339
#8  0x82b0907 in finish_function (nested=0) at c-decl.c:6560
#9  0x829d3fa in yyparse () at c-parse.y:313
#10 0x804c9b3 in compile_file (name=0x40104270 "target.i")
    at toplev.c:2289
#11 0x8050a40 in main (argc=6, argv=0xbffffad4)
    at toplev.c:4726

A fragment of the .greg dump-to-be, with the problem insn starred,
looks like this:

(insn 101 98 193 (set (reg:SI 19 dirflag)
        (const_int 0 [0x0])) 311 {cld} (nil)
    (expr_list:REG_EQUAL (const_int 0 [0x0])
        (nil)))

(insn 193 101 195 (set (reg:SI 5 edi)
        (mem/f:SI (plus:SI (reg:SI 6 ebp)
                (const_int 8 [0x8])) 0)) 32 {*movsi_1} (nil)
    (nil))

(insn 195 193 198 (set (reg:SI 5 edi)	*****
        (plus:SI (reg:SI 5 edi)
            (mem:SI (plus:SI (reg:SI 6 ebp)
                    (const_int -44 [0xffffffd4])) 0))) -1 (nil)
    (expr_list:REG_EQUIV (plus:SI (mem/f:SI (plus:SI (reg:SI 6 ebp)
                    (const_int 8 [0x8])) 0)
            (mem:SI (plus:SI (reg:SI 6 ebp)
                    (const_int -44 [0xffffffd4])) 0))
        (nil)))

(insn 198 195 201 (set (reg:SI 4 esi)
        (reg/v:SI 1 edx)) -1 (nil)
    (nil))

(insn 201 198 104 (set (reg:SI 2 ecx)
        (reg/v:SI 3 ebx)) -1 (nil)
    (nil))

(insn 104 201 108 (parallel[ 
            (set (reg:SI 2 ecx)
                (const_int 0 [0x0]))
            (use (reg:SI 2 ecx))
            (set (reg:SI 5 edi)
                (plus:SI (reg:SI 5 edi)
                    (reg:SI 2 ecx)))
            (set (reg:SI 4 esi)
                (plus:SI (reg:SI 4 esi)
                    (reg:SI 2 ecx)))
            (set (mem:BLK (reg:SI 5 edi) 0)
                (mem:BLK (reg:SI 4 esi) 0))
            (use (reg:SI 19 dirflag))
        ] ) 316 {rep_movqi} (insn_list 101 (nil))
    (expr_list:REG_DEAD (mem:SI (plus:SI (reg:SI 6 ebp)
                (const_int -44 [0xffffffd4])) 0)
        (expr_list:REG_DEAD (mem/f:SI (plus:SI (reg:SI 6 ebp)
                    (const_int 8 [0x8])) 0)
            (expr_list:REG_UNUSED (reg:SI 4 esi)
                (expr_list:REG_UNUSED (reg:SI 5 edi)
                    (expr_list:REG_UNUSED (reg:SI 2 ecx)
                        (expr_list:REG_DEAD (reg/v:SI 3 ebx)
                            (expr_list:REG_DEAD (reg/v:SI 1 edx)
                                (expr_list:REG_DEAD (reg:SI 19 dirflag)
                                    (nil))))))))))

After local-alloc, insns 101 and 104 were adjacent.  The intervening
insns are all setting up for the rep_movqi and were presumably
inserted by reload.

Note this part of the big parallel.

            (set (mem:BLK (reg:SI 5 edi) 0)
                (mem:BLK (reg:SI 4 esi) 0))

Before reload, that read

            (set (mem:BLK (reg/v:SI 26) 0)
                (mem:BLK (plus:SI (reg/v:SI 34)
                        (reg/v:SI 32)) 0))

I am not 100% certain, but I would bet that insn 195 is reload's
attempt to calculate (plus:SI (reg/v:SI 34) (reg/v:SI 32)) all in one
go, substituting expressions for both regs 34 and 32.  It also appears
to have gotten confused and shoved the value into %edi instead of
%esi.  The value applied to %edi by insn 193 is the correct value
going into insn 104.

The bug does not trigger at -O2 because we generate an out-of-line
call to memcpy instead of a rep movqi, with easier constraints for
reload to satisfy.

At this point I punt to the reload experts.  Bernd?

zw


More information about the Gcc-bugs mailing list