I am investigating test suite failures for the avr-embedded target.  The
first genuine failure is test/taddbool.pp (there are also a bunch of
incorrect exit values and other failures due to missing features such as
float, random, ansi/widestring etc.).  This test fails on the last
expression (longbool XOR longbool).  The following is a stripped down test
case illustrating the failure:

Program TAddBool;
 lb1, lb2: longbool;
  lb1 := true;
  lb2 := true;
  if lb1 xor lb2 then

>From the node report (thanks Kit!) it appears that the compiler first
converts the longbools to boolean8, then perform the XOR, then convert the
boolean8 result back to longbool before evaluating the if condition.  In
this last type conversion there appear to be an error (with reference to
the attached assembler output): after label .Lj5 a 32 bit bool is recreated
from the result of the 8 bit XOR node.  Note that r18 contains the result
of the 8 bit XOR result, however registers r19 - r21 are used without
initialization.  R19 in this example contains the result of converting LB2
to an 8 bit bool, leading to the observed incorrect result.

Is this analysis correct?  If so, is this a code generation issue limited
to avr, or is it a higher level problem which affects other processor
types?  Would someone be willing to give me pointers on how to fix this if
the fix is not too involved?

Attachment: taddbool.s
Description: Binary data

fpc-devel maillist  -  fpc-devel@lists.freepascal.org

Reply via email to