I'm using CW7.1.2 for ColdFire (7.1 build 14, patch 7.1.2 build 11, version 5.9.0) for an MCF5235.
Standard calling convention (StdABI), no optimization at all (also no peephole, etc).
I had problems with the MQX function _psp_ticks_to_time using an older version of MQX and could narrow it down to the instruction
tmp = tick_ptr->TICKS[0] * tpms;
I created a small self-contained sample file like this:
typedef unsigned long uint_32;typedef unsigned long long uint_64;void compilerError(uint_64 tick){ static uint_32 tpms; uint_64 tmp; tmp = tick * tpms;}
When I create a disassembly I get the following:
;
; 9: tmp = tick * tpms;
;
0x00000008 0x223900000000 move.l _tpms$5,d1
0x0000000E 0x203C00000000 move.l #_tpms$5,d0
0x00000014 0x48EF0003000C movem.l d0-d1,12(a7)
0x0000001A 0x4CEE00030008 movem.l 8(a6),d0-d1
0x00000020 0x48EF00030004 movem.l d0-d1,4(a7)
0x00000026 0x41EEFFF8 lea -8(a6),a0
0x0000002A 0x2E88 move.l a0,(a7)
0x0000002C 0x4EB900000000 jsr ___rt_mul64
The red-colored instruction looks wrong to me: Instead of zero-extending 'tpms' into d0, d0 is filled with the immediate value "the address of variable tpms".
In MQX 3.4 (I haven't had time to check any later versions yet) the function _psp_ticks_to_time has been replaced with a much smaller and simpler function (the previous code is commented-out, though), but the fact remains that the compiler seems to make a relevant mistake, as illustrated by my sample code.
I searched in the forums, but couldn't find any refernce:
Can anyone confirm my findings? Is this error corrected in 7.2? I cannot easily (medical equipment) move to 7.2, but this error in 7.1.2 might be a _good_ reason to start the move-process, _if_ the error is corrected in 7.2...
If you need a complete workspace to reproduce this, let me know, I assume I can create one easily.
Regards,
Johan
I've just installed CW 7.2 for ColdFire, not being aware of any patches for this release.
Also using this release, the compiler produces incorrect code, just like with 7.1.2 (but not for 7.1.1).
I'll submit a support ticket.
Johan