bug in new ia32 backend

Mike Stump mrs@wrs.com
Mon Jun 21 19:19:00 GMT 1999


Ok, tracked the bug I mentioned on Friday down.  The testcase is:

struct bb {
  long zero_word;
};
 
static int trace_init = 0;
 
void __bb_init_trace_func (struct bb *blocks, unsigned long blockno) {
 
  register int eax_ __asm__("eax");
  register int ecx_ __asm__("ecx");
  register int edx_ __asm__("edx");
  register int esi_ __asm__("esi");
  __asm__ __volatile__ (        "push{l} %0\n\t"        "push{l} %1\n\t"       "push{l} %2\n\t" "push{l} %3"    : : "r"(eax_), "r"(ecx_), "r"(edx_), "r"(esi_));
 
  if (!blocks->zero_word)
    {
      if (!trace_init)
        {
          __bb_init_prg ();
        }
    }
}

The bug has little to do with the testcase if I understand the bug.  I
am on i586-pc-linux-gnulibc1, and found it via a native build, during
libgcc.a building.

The reduced command line was:

./xgcc -B./ t1.i -O2 -c -fPIC

The problem is that match_scratch appears to want to use (reg:SI 16
argp), even though this is a _fake_ register.  The problem appears to
be those damn lies.  The fake registers are not registers, and now
those lies are biting us.  We can either stop telling lies, or fix up
the new code to be more aware of the lies.

find_free_register is the routine that invents the use of the argp,
but argp isn't a register.  :-(

If I change the compiler to read:

;; Don't compare memory with zero, load and use a test instead.
(define_peephole2
  [(set (reg:CCNO 17)
        (compare:CCNO (match_operand:SI 0 "memory_operand" "")
        (const_int 0)))]
  "! optimize_size && 0"
   [(set (match_scratch:SI 3 "r") (match_dup 0))
    (set (reg:CCNO 17) (compare:CCNO (match_dup 3) (const_int 0)))]
  "")

the testcase works, but only by accident.  If you give me direction on
that best way you see to make this work, I might try and fix it.
Maybe if they are constrained to the index regs... instead of the
general regs?

Otherwise, I'll just continue bootstrapping and testing.


More information about the Gcc-bugs mailing list