Jump to content
Sign in to follow this  
djulien

Expressions Within Enum Broken

Recommended Posts

Bug description:

BoostC is not correctly handling expressions within enum.

 

Example code:

#include <system.h>

enum { Constant1 = 0x1A0 };
enum { Constant2 = Constant1 + 1*1 };

int debug @0x70;

void main(void)
{
debug = Constant1; //should be 0x1A0; this one works
debug = Constant2; //should be 0x1A1, actually is 0x0A1
}

 

The code that is being generated is:

MOVLW 0xA0
MOVWF gbl_debug
MOVLW 0x01		;//this is correct
MOVWF gbl_debug+D'1'
MOVLW 0xA1
MOVWF gbl_debug
CLRF gbl_debug+D'1'  ;// this is wrong
RETURN

 

 

Expected behavior:

Compiler should generate the correct opcodes to assign the value.

 

Is the problem 100% reproduceable:

yes

 

Compiler:

BoostC

 

Compiler version:

7.1+

 

Target device:

PIC16F1827, etc.

 

OS:

Windows XP

 

don

Share this post


Link to post
Share on other sites

Your content will need to be approved by a moderator

Guest
You are commenting as a guest. If you have an account, please sign in.
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  

×