View Issue Details

IDProjectCategoryView StatusLast Update
0038321FPCCompilerpublic2021-01-08 14:31
ReporterChristo Crause Assigned ToFlorian  
PrioritynormalSeverityminorReproducibilityN/A
Status closedResolutionfixed 
Product Version3.3.1 
Fixed in Version3.3.1 
Summary0038321: AVR Assigning a pointer constant truncates value to 8 bits
DescriptionWhen 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 Reproduceprogram 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
TagsNo tags attached.
Fixed in Revision48095
FPCOldBugId
FPCTarget-
Attached Files

Activities

Christo Crause

2021-01-08 14:31

reporter   ~0128168

Thanks!

Issue History

Date Modified Username Field Change
2021-01-06 12:24 Christo Crause New Issue
2021-01-06 13:53 Florian Assigned To => Florian
2021-01-06 13:53 Florian Status new => resolved
2021-01-06 13:53 Florian Resolution open => fixed
2021-01-06 13:53 Florian Fixed in Version => 3.3.1
2021-01-06 13:53 Florian Fixed in Revision => 48095
2021-01-06 13:53 Florian FPCTarget => -
2021-01-08 14:31 Christo Crause Status resolved => closed
2021-01-08 14:31 Christo Crause Note Added: 0128168