This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Avoid using Keil 4.13a - it generates defective code

I warn anybody before using ARM Keil 4.13a. It generates defective code. I have spent several hours with debugging a code that has been already worked. The problem affects local variables of functions and passing arguments. Code has been wrongly compiled without any optimization. I have no courage and time to test optimizations.

I also encourage Keil not to publish Keil 4.13a any more.

Keil 4.12 seems to be OK.

Parents
No data
Reply
  • Here is a small test case that I am now going to send to Keil failing the debugger:

    int main( void )
    {
        int x1 = 1,
            x2 = 2,
            x3 = 3,
            x4 = 4,
            x5 = 5,
            x6 = 6,
            x7 = 7,
            x8 = 8,
            x9 = 9,
            x10 = 10,
            x11 = 11,
            x12 = 12,
            x13 = 13,
            x14 = 14,
            x15 = 15,
            x16 = 16;
    
        for (;;)
        {
            ++x1 ;
            ++x2 ;
            ++x3 ;
            ++x4 ;
            ++x5 ;
            ++x6 ;
            ++x7 ;
            ++x8 ;
            ++x9 ;
            ++x10 ;
            ++x11 ;
            ++x12 ;
            ++x13 ;
            ++x14 ;
            ++x15 ;
            ++x16 ;
        }
    }
    

    Compiled using ARM code (LPC2478), no microlib, compiler optimization 0, no cross module optimization.
    On my system, the values of x14, x15, x16 are all set to 0x10 (according to the debugger), then incremented in the loop. Why does this happen? Well, the storage of x14 happens like this:

    0x00000178  E3A0E00E  MOV       R14,#0x0000000E
    0x0000017C  E58DE008  STR       R14,[R13,#0x0008]
        17:         x15 = 15,
    

    and the debugger displays the contents of the stack without taking the offset into consideration!
    Please copy-paste this program and try it will MDK 4.13a in a simulator.

Children