Jump to content

While( .. ) Loop Never Exits


Guest Joe

Recommended Posts

Hello,

 

In the following code, the linker reports:

 

function never returns 'foo'

 

..however, a quick look at the code shows that the function will indeed return when sys.bar = 0

 

I run this in the simulator and the while loop never exits, even though the watch window shows sys.bar as zero.

 

 

This is a bug, while( 0 ) should ALWAYS exit.

 

 

#include <system.h>

struct
{
   unsigned char bar;
}sys;


void foo()
{
   sys.bar = 0;
   while( sys.bar );
}

void main()
{
   foo();
}

 

 

It appears to me that sourceboost has some serious problems with structure data... Is this the case? Should I avoid structs?

 

 

BoostC Optimizing C Compiler Version 2.0.1 Beta (for PIC16 architecture)

http://www.picant.com/c2c/c.html

Copyright© 2004-2005 Pavel Baranov

Copyright© 2004-2005 David Hobday

 

 

success

BoostLink Optimizing Linker Version 2.0.1 Beta

http://www.picant.com/c2c/c.html

Copyright© 2004-2005 Pavel Baranov

Copyright© 2004-2005 David Hobday

 

 

Warning: Unable to successfully create 'delay_us' for target with clock freq 4000000 Hz

Warning: argument of 'delay_10us' calls must have a value of 1 or more

Warning: function never returns: 'foo'

Building CASM file

 

Memory Usage Report

===================

RAM available:192 bytes, used:1 bytes (0.6%), free:191 bytes (99.4%)

ROM available:4096 words, used:10 words (0.3%), free:4086 words (99.7%)

 

Successful

Done

Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...