Jump to content

Bug In While-loop.


Recommended Posts

BoostC compiler fails with the following code:

 

#include <system.h>

union{
      unsigned short pntr;
      unsigned char  segment;
      unsigned char  index;
    } buf_out;


void main(void)
{
 while(++buf_out.index)
 {
   i++;
 }

 while(1);
}

 

 

Building...

BoostC Optimizing C Compiler Version 6.35 (for PIC18 architecture)

http://www.sourceboost.com

Copyright© 2004-2006 Pavel Baranov

Copyright© 2004-2006 David Hobday

 

Licensed to XXXXX under Single user Full License for 1 node(s)

Limitations: PIC18 max code size:Unlimited, max RAM banks:Unlimited, Non commercial use only

 

 

test_project.c

C:\Program Files\SourceBoost\projects\test_project.c(208:8): internal error: prefix operation inside conditional expression on non variable

C:\Program Files\SourceBoost\projects\test_project.c(208:8): error: failed to generate expression

C:\Program Files\SourceBoost\projects\test_project.c(208:8): internal error: failed to generate 'while' expression

 

failure

Exit code was 1.

Removing target: test_project.obj

Failed to locate output file 'test_project.obj'

Done

 

Failed

 

This happens with structs as well, also with pic16 architecture.

When you change the code to:

 

while(buf_out.index++)

 

then the compiler succeeds.

 

 

IDE version: current

Compiler: BoostC Optimizing C Compiler Version 6.35 (for PIC18 architecture)

Compiler version: Version 6.35

Target device: PIC18F4620

OS: Windows XP

 

 

Regards, Teuniz

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...