Records within records fail to pass between procedures correctly
Original Reporter info from Mantis: smiggles
-
Reporter name: Bob Jones
Original Reporter info from Mantis: smiggles
- Reporter name: Bob Jones
Description:
This is on an arm-embedded cortex-m3 compiler
When passing a record whose members include another record to a procedure the recieved data is corrupt
I've included a sample program that demonstrates the bug below.
Steps to reproduce:
{$MODE DELPHI}
program bug01;
uses stm32f10x, stm32tim, misc, Stm32gpio, stm32gcc, stm32fsmc, serialdebug;
type
R1 = record
R1E1 :dword;
R1E2 :dword;
R1E3 :dword;
R1E4 :dword;
R1E5 :dword;
R1E6 :dword;
R1E7 :dword;
end;
R2 = record
R2E1 :dword;
R2E2 :dword;
R2E3 :dword;
R2E4 :dword;
R2E5 :dword;
R2E6 :dword;
R2E7 :dword;
R2E8 :dword;
R2E9 :dword;
R2E10 :dword;
R2E11 :dword;
R2E12 :dword;
R2E13 :dword;
IR1A :R1;
end;
var
IR2 :R2;
procedure P(R :R2);
begin
if R.R2E1<>100 then gSerialDebug.DebugMsgWait('FAIL','R.R2E1');
if R.R2E2<>101 then gSerialDebug.DebugMsgWait('FAIL','R.R2E2');
if R.R2E3<>102 then gSerialDebug.DebugMsgWait('FAIL','R.R2E3');
if R.R2E4<>103 then gSerialDebug.DebugMsgWait('FAIL','R.R2E4');
if R.R2E5<>104 then gSerialDebug.DebugMsgWait('FAIL','R.R2E5');
if R.R2E6<>105 then gSerialDebug.DebugMsgWait('FAIL','R.R2E6');
if R.R2E7<>106 then gSerialDebug.DebugMsgWait('FAIL','R.R2E7');
if R.R2E8<>107 then gSerialDebug.DebugMsgWait('FAIL','R.R2E8');
if R.R2E9<>108 then gSerialDebug.DebugMsgWait('FAIL','R.R2E9');
if R.R2E10<>109 then gSerialDebug.DebugMsgWait('FAIL','R.R2E10');
if R.R2E11<>110 then gSerialDebug.DebugMsgWait('FAIL','R.R2E11');
if R.R2E12<>111 then gSerialDebug.DebugMsgWait('FAIL','R.R2E12');
if R.R2E13<>112 then gSerialDebug.DebugMsgWait('FAIL','R.R2E13');
end;
begin
{initialisation stuff removed for clarity ....}
IR2.R2E1 :=100;
IR2.R2E2 :=101;
IR2.R2E3 :=102;
IR2.R2E4 :=103;
IR2.R2E5 :=104;
IR2.R2E6 :=105;
IR2.R2E7 :=106;
IR2.R2E8 :=107;
IR2.R2E9 :=108;
IR2.R2E10 :=109;
IR2.R2E11 :=110;
IR2.R2E12 :=111;
IR2.R2E13 :=112;
P(IR2);
gSerialDebug.DebugMsgWait('Test','Complete');
end.
Additional information:
In procedure 'P' the tests from R.R2E5 onwards always fail.
Mantis conversion info:
- Mantis ID: 19679
- OS: embedded
- Platform: arm
- Version: 2.4.5
- Fixed in version: 2.6.0
- Fixed in revision: 19312 (#58565340)