This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

bug in gcc(egcs) arm optimizer [multiply not satisfying constraints]


There is a bug(internal error) in the optimizer for arm.

I've reduced the file a lot, but pretty much anything else I remove makes
the thing work.

Shown below.


> cat tmp.i
void foo(int a)
{
    int b1, b2;
    unsigned char *ptr = 0;
    int failure, c1 = 0, c2 = 0;

    failure = a;
    failure *= failure;

    for (b2 = 0; b2 < 1; b2++) {
        for (b1 = 0; b1 < 1; b1++) {
            unsigned long clree, clreo, clroe, clroo;
            unsigned long sum, sumsq;
            clree = *(ptr);
            clreo = *(ptr + 1);
            clroe = *(ptr + a);
            clroo = *(ptr + a + 1);
            sum = (clree + clreo + clroe + clroo);
            sumsq = ((clree * clree) + (clreo * clreo) + 
                     (clroe * clroe) + (clroo * clroo));
            if ((((failure * 4 * sumsq) < (failure * sum * sum))) && 
                (c1 < sumsq) && 
                (c2 > sumsq)) {
                a++;
            }
        }
    }
}


> ccarm -c -O2 tmp.i
    tmp.i: In function `foo':
    tmp.i:28: internal error--insn does not satisfy its constraints:
    (insn:HI 189 186 201 (set (reg:SI 7 r7)
	    (plus:SI (mult:SI (reg:SI 7 r7)
		    (reg:SI 7 r7))
		(reg:SI 2 r2))) 44 {*mulsi3addsi} (insn_list 183 (insn_list 188 (nil)))
	(expr_list:REG_DEAD (reg:SI 2 r2)
	    (nil)))
    toplev.c:1360: Internal compiler error in function fatal_insn


> ccarm -c tmp.i
    [works]


> ccarm -v
    Reading specs from /usr/local/ccarm-1998-09-17/lib/gcc-lib/arm-gordian-coff/egcs-2.91.57/specs
    gcc version egcs-2.91.57 19980901 (egcs-1.1 release)



This happens when the host machine is either a
  FreeBSD 2.2.6-STABLE i386
or a
  IRIX 5.3 mips


It does not seem to happen on one of our old versions:
  gcc version 2.8.1
but given how sensitive the input file is, that may just be because of a
different register being used due to other optimization changes.



Jonathan


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]