Bad code generation for strstr in 2.3.99-pre8

From: Peter Denison (peterd@pnd-pc.demon.co.uk)
Date: Tue May 23 2000 - 16:16:16 EST


Hi folks,
        I've just noticed some incorrect code generation for ix86 that's
causing an Oops on booting 2.3.99-pre8 (with depca driver compiled in).
There's a strstr function (in EISA_signature()) that's coming out in the
code as:

        xorl %eax,%eax
        movl $-1,%ecx
        movl 24(%esp),%esi
        movl 28(%esp),%edx
#APP
        movl (%edx),%edi
        repne
        scasb
        notl %ecx
        decl %ecx
        movl %ecx,%edx
1: movl (%edx),%edi
... etc ....

It's the combo of the last two lines that is clearly wrong. Now I don't
know enough about gcc constraints to work out what's going wrong, but in
include/asm-i386/string.h, the definition of strstr is

        "movl %6,%%edi\n\t"
        "repne\n\t"
        "scasb\n\t"
        "notl %%ecx\n\t"
        "decl %%ecx\n\t"
        "movl %%ecx,%%edx\n"
        "1:\tmovl %6,%%edi\n\t"
...
        :"=a" (__res), "=&c" (d0), "=&S" (d1)
        :"0" (0), "1" (0xffffffff), "2" (cs), "g" (ct)
        :"dx", "di");

Which I think should tell it that dx is getting clobbered. Why is it then
using edx as operand 6 ("g" (ct))? Answers on a postcard please....

I'm using gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)

-- 
Peter Denison <peterd@pnd-pc.demon.co.uk>
Linux Driver for Promise DC4030VL cards.
See http://www.pnd-pc.demon.co.uk/promise/promise.html for details

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue May 23 2000 - 21:00:24 EST