View Issue Details

IDProjectCategoryView StatusLast Update
0036242FPCCompilerpublic2020-01-19 18:34
ReporterChristo Crause Assigned ToFlorian  
Status closedResolutionfixed 
Product Version3.3.1 
Fixed in Version3.3.1 
Summary0036242: AVR - compiler gets stuck in trgobj.do_register_allocation
DescriptionWhen compiling the example below with -O2 the compiler gets stuck in trgobj.do_register_allocation. This is probably related to Florian's comment ( about problems with the register allocator, AVR register orthogonality and spilling of registers.
Steps To ReproduceCompile program below with following compiler arguments:
ppcrosavr -Cpavr5 -Tembedded -Wpatmega328p -Pavr -XPavr- -O2 test.pp

program test;

function fpc_qword: qword;
  n: boolean;
  bitpos: qword;
  fpc_qword := 0;
  bitpos := 0;

  for n := false to true do
    bitpos := bitpos + bitpos;

Fixed in Revision43983
Attached Files



2019-11-01 20:18

administrator   ~0118955

Actually, if you wait long enough (centuries :))?, you get an internalerror. I am not sure though why the register allocator does not find a solution in this case, as far as I can see, the non-orthogonal register set is not the problem.

Christo Crause

2019-12-07 18:06

reporter   ~0119683

Note that a different user is experiencing a similar issue, refer to discussion on Lazarus forum:,47649.0.html


2020-01-19 17:31

administrator   ~0120553

Actually, there was a bug which was solved by r43983 (sp being set as r13/r14 which nobody noticed so far), which caused this failure.

Christo Crause

2020-01-19 18:34

reporter   ~0120557

Good catch.

Issue History

Date Modified Username Field Change
2019-11-01 17:17 Christo Crause New Issue
2019-11-01 17:18 Christo Crause Tag Attached: AVR
2019-11-01 20:18 Florian Note Added: 0118955
2019-12-07 18:06 Christo Crause Note Added: 0119683
2020-01-19 17:31 Florian Assigned To => Florian
2020-01-19 17:31 Florian Status new => resolved
2020-01-19 17:31 Florian Resolution open => fixed
2020-01-19 17:31 Florian Fixed in Version => 3.3.1
2020-01-19 17:31 Florian Fixed in Revision => 43983
2020-01-19 17:31 Florian FPCTarget => -
2020-01-19 17:31 Florian Note Added: 0120553
2020-01-19 18:34 Christo Crause Status resolved => closed
2020-01-19 18:34 Christo Crause Note Added: 0120557