[fpc-pascal] set addition bug?

Adam Naumowicz adamn at math.uwb.edu.pl
Mon Feb 11 23:20:07 CET 2008


Hello again,

On Mon, 11 Feb 2008, Adam Naumowicz wrote:

> Hello,
>
> I'd like to know if this is a known issue, or a new bug.
>
> With the following code:
> ------------------
> program tester;
>
> type SomeType = ( SomeElem );
>
> const ElemSet = [ SomeElem ];
>
> begin
>   writeln(SomeElem in ElemSet);
>   writeln(SomeElem in (ElemSet + []));
> end.
> ------------------
>
> one gets:
>
> TRUE
> FALSE
>
> while it should rather be
>
> TRUE
> TRUE
>
> The problem concerns FPC 2.2.0 on i386/Linux. Actually, I was tracing a bug 
> that was only visible with 2.2.0 while the 2.0.0 version of the compiler did 
> not produce an errorneous code on that. Unfortunately, I didn't succeed to 
> separate a small snippet of code responsible for that - in that case, 
> however, the set after the '+' was another set constant, not an empty set, so 
> the problem is rather general. As I said, with 2.0.0 the boolean value was 
> correct, while with 2.2.0 it was plain wrong.

It seems I've found an example that produces 'FALSE' with 2.2.0 and 'TRUE' 
with 2.0.0 trying to eliminate my code as much as possible - the piece 
is still a bit longish, so I attach it as a separate file - it seems, 
however, that removing lines any further 'hides' the bug.

I hope it will help you find the solution for this nasty problem.

Best regards,

Adam Naumowicz

======================================================================
Department of Applied Logic            fax. +48 (85) 745-7662
Institute of Computer Science          tel. +48 (85) 745-7559 (office)
University of Bialystok                e-mail: adamn at mizar.org
Sosnowa 64, 15-887 Bialystok, Poland   http://math.uwb.edu.pl/~adamn/
======================================================================
-------------- next part --------------
program tester;

type TXMLElemKind = (
 elErrorFrm,
 elInvolutiveness,
 elIrreflexivity,
 elIs,
 elIt,
 elIterEquality,
 elIterStep,
 elJustifiedProperty,
 elJustifiedTheorem,
 elLambdaVar,
 elLet,
 elLocusVar,
 elMonomial,
 elNot,
 elPoweredVar,
 elPred,
 elPredInstance,
 elPriority,
 elPrivFunc,
 elPrivPred,
 elProjectivity,
 elProof,
 elTakeAsVar,
 elTheorem,
 elTheorems,
 elThesis,
 elThesisExpansions,
 elTransitivity,
 elTyp,
 elUnexpectedProp,
 elUniqueness,
 elUnknownCorrCond,
 elVar,
 elVerum
 );

const TermElKinds = [
 elVar
 ];

const FrmElKinds = [
 elErrorFrm,
 elIs,
 elNot,
 elPred,
 elPrivPred,
 elVerum
 ];

var a:TXMLElemKind;

begin
a:=elVerum;
writeln( a in (FrmElKinds + TermElKinds));
end.


More information about the fpc-pascal mailing list