Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2004-08

1.9.4 String comparison problem

2 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Johann Glaser

Hi!

In FPC 1.9.4 there is a bug concerning comparison of a string if it is empty. The program to test is

Program Bug;
Var SS : ShortString;
    AS : AnsiString;
Begin
  SS := 'asdf';
  AS := 'asdf';
  WriteLn('SS         > '''': ', SS > '');
  WriteLn('Length(SS) >  0: '  , Length(SS) > 0);
  WriteLn('AS         > '''': ', AS > '');
  WriteLn('Length(AS) >  0: '  , Length(AS) > 0);
End.

This should emit 4 times "TRUE" but gives a "FALSE" for the first line.

I compiled it with FPC 1.9.4

Free Pascal Compiler version 1.9.4 [2004/08/12] for i386 Copyright (c) 1993-2004 by Florian Klaempfl

from the Debian package fp-compiler_1.9.4-5_i386.deb.

There is a bug ID 2388 which was marked "Fixed" on 2003-10-24. Since 1.9.4 is newer, I'm concerned this was forgotten. Shall I re-submit this bug?

Bye
Hansi

Johann Glaser Vienna University of Technology Electrical Engineering ____ http://www.johann-glaser.at/ ____

Reply by email

Peter Vreman
to Johann Glaser
you wrote 31 lines
Hi! In FPC 1.9.4 there is a bug concerning comparison of a string if it is empty. The program to test is Program Bug; Var SS : ShortString; AS : AnsiString; Begin SS := 'asdf'; AS := 'asdf'; WriteLn('SS > '''': ', SS > ''); WriteLn('Length(SS) > 0: ' , Length(SS) > 0); WriteLn('AS > '''': ', AS > ''); WriteLn('Length(AS) > 0: ' , Length(AS) > 0); End. This should emit 4 times "TRUE" but gives a "FALSE" for the first line. I compiled it with FPC 1.9.4 Free Pascal Compiler version 1.9.4 [2004/08/12] for i386 Copyright (c) 1993-2004 by Florian Klaempfl from the Debian package fp-compiler_1.9.4-5_i386.deb. There is a bug ID 2388 which was marked "Fixed" on 2003-10-24. Since 1.9.4 is newer, I'm concerned this was forgotten. Shall I re-submit this bug?

No problem here with current cvs:

C:\fpc\tests\webtbs>tw2388
SS > '': TRUE
Length(SS) > 0: TRUE
AS > '': TRUE
Length(AS) > 0: TRUE

Peter

Reply by email