Recent

Author Topic: Bug Verification  (Read 1246 times)

taazz

  • Hero Member
  • *****
  • Posts: 5362
Bug Verification
« on: September 16, 2018, 05:16:33 am »
I would like to verify that the following is a bug or if not what I missunderstood.
Unit  :fpexprpars.pas
proc :TFPExpressionParser.Primitive
Line  : 1721 highlighted bellow.
Code: Pascal  [Select]
  1.     if TryStrToInt64(CurrentToken,I) then
  2.       Result:=TFPConstExpression.CreateInteger(I)
  3.     else
  4.       begin
  5.       Val(CurrentToken,X,C);
  6.       If (I=0) then
  7.         Result:=TFPConstExpression.CreateFloat(X)
  8.       else
  9.         ParserError(Format(SErrInvalidFloat,[CurrentToken]));
  10.       end;
  11.     end
  12.  
according my reading  skills I would expect the line to read If (C=0) then instead of I. Is my assumption correct?

PS:
  the code comes from a lazarus 1.8.4 64bit installation. So if its a bug I need confirmation that its still present in trunk before I report it.
« Last Edit: September 16, 2018, 05:18:19 am by taazz »
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

WooBean

  • Jr. Member
  • **
  • Posts: 84
Re: Bug Verification
« Reply #1 on: September 16, 2018, 08:23:13 am »
Hello  tazz,

in my opinion it is a bug and it is harmful when CurrentToken cannot be parsed to int64 nor float value. In such a case snipped line 9. "ParserError(Format(SErrInvalidFloat,[CurrentToken]));" is not called despite it should be - according to a common logic.


The bug, definitely

WooBean   
Win7/64, Lazarus 1.8 win64-win64, FPC 3.0.4

zamtmn

  • Sr. Member
  • ****
  • Posts: 348
Re: Bug Verification
« Reply #2 on: September 16, 2018, 08:29:32 am »

taazz

  • Hero Member
  • *****
  • Posts: 5362
Re: Bug Verification
« Reply #3 on: September 16, 2018, 01:56:50 pm »
Thank you gentlemen, I'll report it later tonight if there is no active report on the subject.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64