[fpc-devel] New warning?
Carl Eric Codere
carl.codere at optimasc.com
Tue Dec 3 21:56:55 CET 2002
>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?
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.
>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...
More information about the fpc-devel
mailing list