Package: gcc-2.95
Version: 2.95.4-9

Hi,
  I removed debug prints from new matroxfb driver, and ... compiler 
died. Simplest example I was able to invent is below. If you uncomment
printf(), or if you'll remove (almost) any line from computeRegs() body, 
it will stop ICE.

  gcc-3.0 (3.0.4-10) and gcc-3.1 (3.1.1-0pre2) compile code flawlessly.

                                        Best regards,
                                                Petr Vandrovec
                                                [EMAIL PROTECTED]


$ gcc-2.95 -W -Wall -O2 bug.c
bug.c: In function `computeRegs':
bug.c:72: Internal compiler error:
bug.c:72: internal error--unrecognizable insn:
(insn 62 61 151 (parallel[
            (set (reg:SI 0 %eax)
                (asm_operands ("") ("=a") 0[
                        (reg:DI 1 %edx)
                    ]
                    [
                        (asm_input:DI ("A"))
                    ]  ("bug.c") 60))
            (set (reg:SI 1 %edx)
                (asm_operands ("") ("=d") 1[
                        (reg:DI 1 %edx)
                    ]
                    [
                        (asm_input:DI ("A"))
                    ]  ("bug.c") 60))
        ] ) -1 (insn_list 57 (nil))
    (nil))
$

#define do_div(n,base) ({ \
        unsigned long __upper, __low, __high, __mod; \
        asm("":"=a" (__low), "=d" (__high):"A" (n)); \
        __upper = __high; \
        if (__high) { \
                __upper = __high % (base); \
                __high = __high / (base); \
        } \
        asm("divl %2":"=a" (__low), "=d" (__mod):"rm" (base), "0" (__low), "1" 
(__upper)); \
        asm("":"=A" (n):"a" (__low),"d" (__high)); \
        __mod; \
})

#define u_int32_t unsigned int

struct mavenregs {
        unsigned char regs[256];
};

struct my_timming {
        u_int32_t HDisplay;
        unsigned int pixclock;
        unsigned int mnp;
};

struct output_desc {
        unsigned int    h_vis;
        unsigned int    h_f_porch;
        unsigned int    h_sync;
        unsigned int    h_b_porch;
        unsigned long long int  chromasc;
        unsigned int    burst;
        unsigned int    v_total;
};

unsigned int matroxfb_g450_setclk(unsigned int, unsigned int);
unsigned int g450_mnp2f(unsigned int);

static void computeRegs(struct mavenregs* r, struct my_timming* mt, const 
struct output_desc* outd) {
        u_int32_t chromasc;
        u_int32_t hlen;
        u_int32_t hfp;
        u_int32_t hvis;
        unsigned int pixclock;
        unsigned long long piic;
        int mnp;

        hvis = 1;
        piic = 1000000000ULL * hvis;

        mnp = matroxfb_g450_setclk(piic, 3);
        
        mt->pixclock = g450_mnp2f(mnp);
//      printf("PX: %u\n", mt->pixclock);
        mt->mnp = mnp;

        pixclock = 1000000000U / mt->pixclock;

        piic = outd->chromasc;
        do_div(piic, mt->pixclock);
        chromasc = piic;

        r->regs[0] = chromasc >> 24;
        r->regs[1] = chromasc >> 16;

        hfp = (((outd->h_f_porch + pixclock) / pixclock)) & ~1;
        hlen = hvis + hfp;

        if (hlen) {
                hfp -= hlen;
        }
}




-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]


Reply via email to