View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0037914 | FPC | Compiler | public | 2020-10-12 21:37 | 2020-10-12 21:59 |
Reporter | Christo Crause | Assigned To | Florian | ||
Priority | normal | Severity | minor | Reproducibility | sometimes |
Status | closed | Resolution | fixed | ||
Product Version | 3.3.1 | ||||
Fixed in Version | 3.3.1 | ||||
Summary | 0037914: AVR [patch] Sometimes registers r0 or r1 are pushed for avrtiny | ||||
Description | When calling a function from an interrupt handler the compiler sometimes insert push/pop instructions for r0 & r1, obviously leading to assembler errors. The code below is an example which triggers this problem. This problem can be fixed by removing r0, r1 from the volatile register set, see attached patch. | ||||
Steps To Reproduce | Compile test program with ~/fpc/3.3.1/compiler/ppcrossavr -n @~/fpc/3.3.1/fpc.cfg -Wpattiny10 test.lpr program test; function Sound1(t: uint32): byte; begin end; var t: uint32; procedure genSound; alias: 'TIM0_OVF_ISR'; interrupt; begin OCR0A := Sound1(t); end; begin end. | ||||
Additional Information | Compiler/assembler output: Free Pascal Compiler version 3.3.1 [2020/10/06] for avr Copyright (c) 1993-2020 by Florian Klaempfl and others Target OS: Embedded Compiling test.lpr test.lpr(3,10) Warning: Function result does not seem to be set test.lpr(8,3) Warning: Variable "t" read but nowhere assigned Assembling test test.s: Assembler messages: test.s:70: Error: register name or number from 16 to 31 required test.s:71: Error: register name or number from 16 to 31 required test.s:87: Error: register name or number from 16 to 31 required test.s:88: Error: register name or number from 16 to 31 required test.lpr(19) Error: Error while assembling exitcode 1 test.lpr(19) Fatal: There were 2 errors compiling module, stopping Fatal: Compilation aborted | ||||
Tags | No tags attached. | ||||
Fixed in Revision | 47102 | ||||
FPCOldBugId | |||||
FPCTarget | - | ||||
Attached Files |
|
|
cpupara.patch (584 bytes)
diff --git a/compiler/avr/cpupara.pas b/compiler/avr/cpupara.pas index 0c4289e68a..1567fddc30 100644 --- a/compiler/avr/cpupara.pas +++ b/compiler/avr/cpupara.pas @@ -58,7 +58,7 @@ unit cpupara; function tcpuparamanager.get_volatile_registers_int(calloption : tproccalloption):tcpuregisterset; begin if CPUAVR_16_REGS in cpu_capabilities[current_settings.cputype] then - result:=VOLATILE_INTREGISTERS-[RS_R18,RS_R19] + result:=VOLATILE_INTREGISTERS-[RS_R0,RS_R1,RS_R18,RS_R19] else result:=VOLATILE_INTREGISTERS; end; |
|
Thanks, applied. |
|
7 Minutes, this is probably some kind of record! Thanks Florian. |
Date Modified | Username | Field | Change |
---|---|---|---|
2020-10-12 21:37 | Christo Crause | New Issue | |
2020-10-12 21:37 | Christo Crause | File Added: cpupara.patch | |
2020-10-12 21:44 | Florian | Assigned To | => Florian |
2020-10-12 21:44 | Florian | Status | new => resolved |
2020-10-12 21:44 | Florian | Resolution | open => fixed |
2020-10-12 21:44 | Florian | Fixed in Version | => 3.3.1 |
2020-10-12 21:44 | Florian | Fixed in Revision | => 47102 |
2020-10-12 21:44 | Florian | FPCTarget | => - |
2020-10-12 21:44 | Florian | Note Added: 0126268 | |
2020-10-12 21:59 | Christo Crause | Status | resolved => closed |
2020-10-12 21:59 | Christo Crause | Note Added: 0126270 |