Hello,

is this a known bug ?

The compiler generates wrong code for:
=======
void badguy()
{
    unsigned char mem[100];
    register void (*badcall)(void) = (void *)mem;
    (*badcall)();      // this will call mem[-2]
}
========
The bits it does are:
=======================
badguy:
        sub     #100, r1        ;       100, fpn 0
        /* prologue end (size=2) */

        call    r1       ;  12  *call_insn/1    [length = 1]

        /* epilogue: frame size=100 */
        add     #100, r1
        ret
===============
The msp2274 that I was using, is FIRST decrementing the SP (r1) and then
calling it. 
 msp430-gcc   -O2 -mmcu=msp430x2274 -Werror  -dp  -S  tfun.c

Is 3.2.3 still the latest supported compiler?
thanks
thilo





Reply via email to