AVR - Incorrect code generated when copying a static array [patch]
Original Reporter info from Mantis: ccrause @ccrause
-
Reporter name: Christo Crause
Original Reporter info from Mantis: ccrause @ccrause
- Reporter name: Christo Crause
Description:
Test test/cg/tcalfun1.pp generates a failure when copying a static array with a counter size exceeding 256 because the copy loop code generator in tcgavr.g_concatcopy only decrements a single register, so any 16 bit size will not be handled correctly. A stripped down test case highlighting this issue is attached.
The attached patch checks whether the array counter fits in 1 or 2 registers and emit either the current dec instruction if only 1 register is used or a subi/sbc pair if 2 registers are required for the array counter.
Mantis conversion info:
- Mantis ID: 36066
- Version: 3.3.1
- Fixed in version: 3.3.1
- Fixed in revision: 42977 (#4e93a9a6)