From fe5118e9031ded4d1a0e52a1ecb3c38cb37114ae Mon Sep 17 00:00:00 2001 From: daniel Date: Wed, 6 Jun 2007 19:50:04 +0000 Subject: [PATCH] * Reduce false positives of type_h_use_div_for_int. git-svn-id: trunk@7590 - --- compiler/nadd.pas | 5 +---- compiler/ncnv.pas | 5 +++++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/compiler/nadd.pas b/compiler/nadd.pas index 8fcb960b6d..2f60ce7ba0 100644 --- a/compiler/nadd.pas +++ b/compiler/nadd.pas @@ -823,10 +823,7 @@ implementation begin left.resultdef := s64inttype; right.resultdef := s64inttype; - end - else if (left.resultdef.typ <> floatdef) and - (right.resultdef.typ <> floatdef) then - CGMessage(type_h_use_div_for_int); + end; inserttypeconv(right,resultrealdef); inserttypeconv(left,resultrealdef); end diff --git a/compiler/ncnv.pas b/compiler/ncnv.pas index b51e57f7e4..03c1c32245 100644 --- a/compiler/ncnv.pas +++ b/compiler/ncnv.pas @@ -608,6 +608,11 @@ implementation if def=nil then internalerror(200103281); fileinfo:=node.fileinfo; + {An attempt to convert the result of a floating point division + (with the / operator) to an integer type will fail. Give a hint + to use the div operator.} + if (node.nodetype=slashn) and (def.typ=orddef) then + cgmessage(type_h_use_div_for_int); end;