Jump to content
Sign in to follow this  
Mike Schafer

Compiler Error

Recommended Posts

No big deal, but I thought you'd like to see this.

Also having problems in 6.40 with the programmer

not firing up even though checked in build options.

 

Mike

 

 

Environment:

Windows XP

BoostC Compiler and IDE V6.40

Target 18F4620

 

 

The |= construction in the else condition fails. Note that it works

in the if condition. Also, the code compiles if the |= is replaced by

the non-shorthand construction.

 

Code:

 

#define HOME 0

#define AWAY 0x0F

 

void main(void)

{

char val;

char test;

 

 

if(test) val |= (HOME << 4);

else val |= (AWAY << 4);

 

}

 

Error messages:

 

"C:\Program Files\SourceBoost\boostc.pic18.exe" -t PIC18F4620 bug.c

 

BoostC Optimizing C Compiler Version 6.40 (for PIC18 architecture)

http://www.sourceboost.com

Copyright© 2004-2006 Pavel Baranov

Copyright© 2004-2006 David Hobday

 

 

 

bug.c

 

failure

C:\Pic software\Maxzig_v3\bug.c(11:21): internal error: failed to generate assignment expression

C:\Pic software\Maxzig_v3\bug.c(11:21): error: failed to generate expression

C:\Pic software\Maxzig_v3\bug.c(11:11): error: error in the body of 'if' expression

Failed to locate output file 'bug.obj'

Done

 

Failed

Share this post


Link to post
Share on other sites

Thanks for reporting this bug. It has been fixed and fix will be available in the next release.

 

Regards,

Pavel

Share this post


Link to post
Share on other sites

I would like to confirm that this issue is in the 6.41 patched version too.

 

#include <system.h>
// OS: WinXP, SP2
// SourceBoostIDE: 6.41
// Compiler: BoostC 6.41
// Target: PIC16F876A
// Reproducible: always
// Expected behavior: compile without error
// 
// bug5.c
//
// Using the (&=) operator and a target of type char or int:
//
// When operand is a literal expression or constant and the
// result is all ONES (0xFF or 0xFFFF) the compiler
// generates an error message.
//
// Using the (|=) operator and a target of type char or int:
//
// When the evaluation of a literal expression produces a 
// result of ZERO the compiler generates an error message.
//

/* Output from Build tab:

Building...
BoostC Optimizing C Compiler Version 6.41 (for PIC16 architecture)
http://www.sourceboost.com
Copyright(C) 2004-2006 Pavel Baranov
Copyright(C) 2004-2006 David Hobday

Licensed to REDACTED under Single user Pro License for 2 node(s)
Limitations: PIC12,PIC16 max code size:Unlimited, max RAM banks:Unlimited


bug5.c

failure
C:\Public\TestC\SourceBoost\Test\bug5.c(53:6): internal error: failed to generate assignment expression
C:\Public\TestC\SourceBoost\Test\bug5.c(53:6): error: failed to generate expression
"C:\Program Files\SourceBoost\boostc.pic16.exe" bug5.c -t PIC16F876A 
Exit code was 1.
Removing target: bug5.obj
Done

*/

void main(void)
{
 unsigned char val = 0;
 
 //val |= (0);             // this compiles
 //val |= (0x80 * 0);      // this compiles
 val |= (1 / 2);       // this fails
 //val |= (1 - 1);       // this fails
 //val |= (0x0000 << 4); // this fails
 //val &= (51 * 5);      // this fails
 //val &= (255);         // this fails
 //val &= (254 + 1);     // this fails
 //val &= (0x0ff0 >> 4); // this fails
}

Edited by cac001

Share this post


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...
Sign in to follow this  

×
×
  • Create New...