Hi,
I'm using uVision 3.33, supplied as part of the Luminary Micro design contest. I've noticed the following problem when trying to right-shift a 16-bit unsigned value.
The code produced is:-
176: unsigned short int16; 177: 178: void testfunc(void) 179: { 0x0000072E BD10 POP {r4,pc} 180: int16 >>= 1; 0x00000730 480A LDR r0,[pc,#40] ; @0x0000075C 0x00000732 8800 LDRH r0,[r0,#0x00] 0x00000734 4909 LDR r1,[pc,#36] ; @0x0000075C 0x00000736 8008 STRH r0,[r1,#0x00] 181: }
.. which does not do a right shift !
If I do a left shift, however, it works:-
176: unsigned short int16; 177: 178: void testfunc(void) 179: { 0x0000072E BD10 POP {r4,pc} 180: int16 <<= 1; 0x00000730 480C LDR r0,[pc,#48] ; @0x00000764 0x00000732 8800 LDRH r0,[r0,#0x00] 0x00000734 F64F71FF MOVW r1,#0xFFFF 0x00000738 EA010040 AND r0,r1,r0,LSL #1 0x0000073C 4909 LDR r1,[pc,#36] ; @0x00000764 0x0000073E 8008 STRH r0,[r1,#0x00] 181: }
.. with the LSL instruction clearly visible.
Is this a known bug in the Keil compiler ?
Thanks,
Pete Baston.
Hi Peter
Here's the version info from my uVision.
Best Regards,
Pete.
IDE-Version: µVision3 V3.33b Copyright (c) Keil Elektronik GmbH / Keil Software, Inc. 1995 - 2006 License Information: Peter Baston PB Engineering LIC=---- Tool Version Numbers: Toolchain Path: C:\Program Files\Keil\ARM\BIN30\ C Compiler: ARMCC.Exe V3.0.0.942 Assembler: ARMASM.Exe V3.0.0.942 Linker/Locator: ARMLINK.Exe V3.0.0.942 Librarian: ARMAR.Exe V3.0.0.942 Hex Converter: FROMELF.Exe V3.0.0.942 CPU DLL: SARMCM3.DLL V3.01 Dialog DLL: DLM.DLL V1.00a Target DLL: BIN\lmidk-agdi.dll V??? Dialog DLL: TLM.DLL V1.00
Pete,
I am running the following version, which is RVCT3.0 with service pack 1:
IDE-Version: µVision3 V3.50 Copyright (c) Keil Elektronik GmbH / Keil Software, Inc. 1995 - 2007 Tool Version Numbers: Toolchain Path: BIN30\ C Compiler: ARM/Thumb C/C++ Compiler, RVCT3.0 [Build 951] for uVision [Full] Assembler: ARM/Thumb Macro Assembler, RVCT3.0 [Build 951] for uVision [Full] Linker/Locator: ARM Linker, RVCT3.0 [Build 951] for uVision [Full] Librarian: ARM Archiver, RVCT3.0 [Build 951] for uVision Hex Converter: ARM FromELF, RVCT3.0 [Build 951] for uVision [Full] CPU DLL: SARM.DLL V3.04 Dialog DLL: DARMAT.DLL V1.04 Target DLL: BIN\UL2ARM.DLL V1.26 Dialog DLL: TARMAT.DLL V1.03
Regards, Peter