This code:
unsigned int Argh( unsigned int Word, unsigned int Base ) { return ( ( Word & ~1 ) << 2 ) + Base; }
is compiled as:
Argh PROC ;;;1 unsigned int Argh( unsigned int Word, unsigned int Base ) ;;;2 { 000000 e1a02000 MOV r2,r0 ;;;3 return ( ( Word & ~1 ) << 2 ) + Base; 000004 e0810102 ADD r0,r1,r2,LSL #2 ;;;4 } 000008 e12fff1e BX lr ;;;5 ENDP
The subexpression involving & has been omitted. Simpler variants (omitting either the shift or the addition) compile correctly, for example:
Argh4 PROC ;;;18 unsigned int Argh4( unsigned int Word ) ;;;19 { 000030 e1a01000 MOV r1,r0 ;;;20 return ( Word & ~1 ) << 2; 000034 e3c10001 BIC r0,r1,#1 000038 e1a00100 LSL r0,r0,#2 ;;;21 } 00003c e12fff1e BX lr ENDP
Inserting a temporary variable to receive the & is not sufficient to work around.
I'm using
IDE-Version: µVision3 V3.60 Copyright (c) Keil Elektronik GmbH / Keil Software, Inc. 1995 - 2008 [[[snip]]] Tool Version Numbers: Toolchain: RealView MDK BASIC (256K) Version: 3.20 Toolchain Path: BIN31\ C Compiler: Armcc.Exe V3.1.0.919 Assembler: Armasm.Exe V3.1.0.919 Linker/Locator: ArmLink.Exe V3.1.0.919 Librarian: ArmAr.Exe V3.1.0.919 Hex Converter: FromElf.Exe V3.1.0.919 CPU DLL: SARM.DLL V3.20 Dialog DLL: DARMST9.DLL V1.03 Target DLL: BIN\UL2ARM.DLL V1.37 Dialog DLL: TARMST9.DLL V1.01a
I've looked at release notes for newer versions, but see nothing that looks relevant.