AVR Assigning a pointer constant truncates value to 8 bits
Original Reporter info from Mantis: ccrause @ccrause
-
Reporter name: Christo Crause
Original Reporter info from Mantis: ccrause @ccrause
- Reporter name: Christo Crause
Description:
When assigning a literal value to a pointer it gets truncated to 8 bits, see code below and the produced assembler code.
The problem seems to be caused by the following line in tcgpointerconstnode.pass_generate_code:
location.value:=aint(value);
For AVR aint is defined as shortint, which seem like an inappropriate cast for a 16 bit pointer value.
Steps to reproduce:
program pointertest;
var
p: pointer;
begin
p := pointer($1234);
end;
Additional information:
# [7] p := pointer($1234);
ldi r26,52
mov r18,r26
mov r19,r1
sts (U_sPsSECTIONTEST_ss_P),r18
sts (U_sPsSECTIONTEST_ss_P+1),r19
Mantis conversion info:
- Mantis ID: 38321
- Version: 3.3.1
- Fixed in version: 3.3.1
- Fixed in revision: 48095 (#6d759926)