Sign in Join

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

Mailing lists / fpc-devel / 2002-12

New warning?

2 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

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

Judison

Hi friends,

First, excuse the long mail, and my poor english.

Since my last "cvs update fpc", I'm getting a lot of warnings, but some seens "stupid" to me :) If I compile my project with -Cr there are a lot of: Warning: Type size mismatch, possible loss of data / range check error

Lets see a small example program.
Observe that "MyWord := MyWord + 1", is OK to warning, one day MyWord can be $FFFF...
but, in "MyWord := MyByte + 1" or "MyWord := MyByte + Byte(1)" whats wrong with this?

... and, the other situation, if IntA is Smallint, Inc(IntA) gets warned, BUT when it is Longint, Inc(IntA) gets no warning...

This is a bug?

PS: to compile the lastest CVS version, I need to change in fcl\xml\htmwrite.pas:

  s := LowerCase(node.NodeName);

to:

  s := node.NodeName;
  s := LowerCase(s);

else, the compiler don't know what overload function to use. and remove h2pas from makefile
else I get:
h2pas.pas(7639,1) Error: Local variable size exceed limit for certain cpu's

TIA
Your friend,
Judison

Reply by email

Carl Eric Codere
Show quoted text 7 lines
Since my last "cvs update fpc", I'm getting a lot of warnings, but some seens "stupid" to me :) If I compile my project with -Cr there are a lot of: Warning: Type size mismatch, possible loss of data / range check error Lets see a small example program. Observe that "MyWord := MyWord + 1", is OK to warning, one day MyWord can

be >$FFFF...

Show quoted text 7 lines
but, in "MyWord := MyByte + 1" or "MyWord := MyByte + Byte(1)" whats wrong with this? ... and, the other situation, if IntA is Smallint, Inc(IntA) gets warned, BUT when it is Longint, Inc(IntA) gets no warning... This is a bug?

Greetings,
I added these new warnings, but i agree i was maybe a bit overzealous, the warning will now appear if you directly assign a variable to another variable which might not fix in the range. With explicit typecasts these warnings will not appear.

Show quoted text 6 lines
PS: to compile the lastest CVS version, I need to change in >fcl\xml\htmwrite.pas: s := LowerCase(node.NodeName); to: s := node.NodeName; s := LowerCase(s); else, the compiler don't know what overload function to use.

The function overloading resolution was recently changed in the compiler, and it seems that some test cases were forgotten, if nobody fixes it by week's end, I'll try to fix it...

and remove h2pas from makefile else I get: h2pas.pas(7639,1) Error: Local variable size exceed limit for certain cpu's

Ooops... it was a mistake from my part (a silly coy paste bug!), it gives a warning now instead...

Reply by email