Unable to Open a XML Document on an ARM Processor , related to issue 12079
Original Reporter info from Mantis: Bernd
-
Reporter name: Bernd
Original Reporter info from Mantis: Bernd
- Reporter name: Bernd
Description:
there is at least another problem in xmlread.pp which leads to a bus error on ARM:
procedure TXMLReader.PushVC(aElDef: TDOMElementDef);
begin
if FNesting = Length(FValidator) then
SetLength(FValidator, FNesting * 2);
Inc(FNesting);
FValidator[FNesting].FElementDef := aElDef;
FValidator[FNesting].FCurCP := nil;
FValidator[FNesting].FFailed := False;
UpdateConstraints;
end;
At least the address of the array element FElementDef is not properly aligned. I am not sure about FCurCP and FFailed. I have seen one of them unaligned too.
This could easily be fixed:
procedure TXMLReader.PushVC(aElDef: TDOMElementDef);
begin
if FNesting = Length(FValidator) then
SetLength(FValidator, FNesting * 2);
Inc(FNesting);
unaligned(FValidator[FNesting].FElementDef) := aElDef;
unaligned(FValidator[FNesting].FCurCP) := nil;
unaligned(FValidator[FNesting].FFailed) := False;
UpdateConstraints;
end;
But isn't this a compiler problem? Why could this happen, that these elements are unaligned?
BTW in 12079, would not the unaligned directive fit better to fix the bug?
Mantis conversion info:
- Mantis ID: 12137
- OS: WINCE
- Version: 2.2.2
- Fixed in version: 2.4.0
- Fixed in revision: 12719 (#7d459cf1)
- Target version: 2.4.0