View Issue Details

IDProjectCategoryView StatusLast Update
0037550FPCCompilerpublic2020-08-14 11:41
ReporterChristo Crause Assigned ToFlorian  
Status closedResolutionfixed 
Product Version3.3.1 
Fixed in Version3.3.1 
Summary0037550: Xtensa [patch] Nostackframe directive does not generate correct code for windowed ABI.
DescriptionWhen a runtime error is generated that calls one of the empty system functions from such as get_frame, the error procedure immediately returns to the previous caller and execution resumes as if no error has generated. This happens for the windowed ABI because the empty implementations are marked with nostackframe. This results in the compiler generating a retw instruction without a matching entry instruction.

Either the empty RTL assembler procedures should not be marked with nostackframe for the windowed ABI, or the compiler should generate an entry instruction even if nostackframe is specified. Since the current behaviour when specifying nostackframe results in unexpected behaviour my suggested fix is to patch the compiler.
TagsNo tags attached.
Fixed in Revision46417
Attached Files


Christo Crause

2020-08-11 22:18


cgcpu.patch (477 bytes)   
Index: compiler/xtensa/cgcpu.pas
--- compiler/xtensa/cgcpu.pas	(revision 46365)
+++ compiler/xtensa/cgcpu.pas	(working copy)
@@ -742,7 +742,9 @@
-          end;
+          end
+        else if target_info.abi=abi_xtensa_windowed then
+          list.concat(taicpu.op_reg_const(A_ENTRY,NR_STACK_POINTER_REG,0));
cgcpu.patch (477 bytes)   

Christo Crause

2020-08-13 12:01

reporter   ~0124830

After rereading section of the ISA manual it appears that the minimum stack space required is 16 bytes (for the base save area), so the patch should be adjusted to specify 16 bytes, not 0.


2020-08-13 22:35

administrator   ~0124859

Thanks, applied with the proposed change.

Christo Crause

2020-08-14 11:41

reporter   ~0124872

Thanks Florian.

Issue History

Date Modified Username Field Change
2020-08-11 22:18 Christo Crause New Issue
2020-08-11 22:18 Christo Crause File Added: cgcpu.patch
2020-08-13 12:01 Christo Crause Note Added: 0124830
2020-08-13 22:35 Florian Assigned To => Florian
2020-08-13 22:35 Florian Status new => resolved
2020-08-13 22:35 Florian Resolution open => fixed
2020-08-13 22:35 Florian Fixed in Version => 3.3.1
2020-08-13 22:35 Florian Fixed in Revision => 46417
2020-08-13 22:35 Florian FPCTarget => -
2020-08-13 22:35 Florian Note Added: 0124859
2020-08-14 11:41 Christo Crause Status resolved => closed
2020-08-14 11:41 Christo Crause Note Added: 0124872