Forum Index
HomeZBasic Home   Forum RulesForum Rules   Forum FAQForum FAQ   MemberlistMemberlist   UsergroupsUsergroups   RSS FeedRSS Feed
Site SearchSite Search   LinksLinks   DownloadDownload   Digests and SubscriptionsDigests and Subscriptions
ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in   RegisterRegister
Backend Compiler Warning

 
Post new topic   Reply to topic    Forum Index -> ZBasic Native Mode
Author Message
Don_Kirby



Joined: 15 Oct 2006
Posts: 329
Location: Long Island, New York

Posted: 07 October 2008, 0:50 AM    Post subject: Backend Compiler Warning Reply with quote

I've been getting this warning while now (it's not due to the newest compiler release). The application functions properly by all accounts, although the particular function where the warning is coming from is as yet unfinished.

Quote:
ModbusTask.c: In function 'zf_ModbusTask':
ModbusTask.c:28: warning: 'zv_DataCount' may be used uninitialized in this function


The warning is issued even if the variable is manually given a value immediately after declaration, such as:
Code:
   Dim I as Integer
   Dim BitTIme as Single
   Dim AddressField as Byte
   Dim OldQCount as Integer
   Dim DataCount as Integer
   DataCount = 1
   
   Dim CRC as UnsignedInteger
   Dim   ReceivedCRC as UnsignedInteger


The corrosponding C code does not seem to set the variable at all:

Code:
   int16_t zv_I;
   float zv_BitTIme;
   int16_t zv_OldQCount;
   int16_t zv_DataCount;
   uint16_t zv_CRC;
   uint16_t zv_ReceivedCRC;


I'm not necessarily concerned about the warning, but for the sake of commenting my code, I'd like to identify the issue, and at the very least make note of it.

-Don
Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Posts: 2499
Location: Portland, OR

Posted: 07 October 2008, 1:10 AM    Post subject: Re: Backend Compiler Warning Reply with quote

Don_Kirby wrote:
I'd like to identify the issue, and at the very least make note of it.
In most cases that I've seen, the warning that you referred to is valid. I have seen a few cases where the logic guaranteed that the variable wouldn't be used unless it was initialized.

In any event, I'd like to see the ZBasic code that led to this warning so that I can see what can be done to eliminate it.
Back to top
Don_Kirby



Joined: 15 Oct 2006
Posts: 329
Location: Long Island, New York

Posted: 07 October 2008, 21:58 PM    Post subject: Reply with quote

I'll see if I can come up with a small test case that exhibits the problem.

-Don
Back to top
Don_Kirby



Joined: 15 Oct 2006
Posts: 329
Location: Long Island, New York

Posted: 07 October 2008, 22:12 PM    Post subject: Reply with quote

In trying to isolate the problem, I've determined that when the task is taken out of the context of the application, the warning goes away. I'll need to do a bit more work to get a smaller test application to behave the in the same manner as the entire application.

Two other things:

It seems that the compiler is incorrectly reporting the amount of persistent memory in use:

Quote:
No errors. Target device: ZX24n, Code: 39166 bytes, RAM: 1713 bytes, Persistent memory: 32 bytes


It should be over 900 bytes. This is almost certainly not related to the warning issue.

Also, if I double click on the warning in the compiler output pane, the IDE jumps to the offending line number in the ZBasic code, which doesn't correspond at all to the C code to which the warning is referring to.

-Don
Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Posts: 2499
Location: Portland, OR

Posted: 08 October 2008, 0:47 AM    Post subject: Reply with quote

Don_Kirby wrote:
I'll need to do a bit more work to get a smaller test application to behave the in the same manner as the entire application.
If you don't mind sending me the whole application, I can work directly with it. That way, you won't have to spend time trying to reproduce it in a small test case.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Forum Index -> ZBasic Native Mode Time synchro. with the server - Timezone/DST with your computer
Page 1 of 1

 


All content Copyright © 2005-2012 Elba Corp. All Rights Reserved.
Opinions expressed in posts are those of the author and not necessarily those of Elba Corp.
Powered by phpBB © 2001, 2005 phpBB Group