Jump to content
Sign in to follow this  
Smache

Bostc Compiler Bug

Recommended Posts

Source Boost IDE 5.7.1

BoostC 1.9.2

 

#include <system.h>

 

unsigned short var1;

 

void main(void)

{

unsigned char var2;

 

var2=(unsigned char)(var1>>4); // doesn't work

// var2=(unsigned short)var1>>4; // works OK

}

 

Asm output:

 

main

; { main ; function begin

BCF STATUS, RP0

BCF STATUS, RP1

MOVF gbl_var1, W

MOVWF CompTempVar32

BCF STATUS,C

RRF CompTempVar33, F

RRF CompTempVar32, F

BCF STATUS,C

RRF CompTempVar33, F

RRF CompTempVar32, F

BCF STATUS,C

RRF CompTempVar33, F

RRF CompTempVar32, F

BCF STATUS,C

RRF CompTempVar33, F

RRF CompTempVar32, W

MOVWF main_1_var2

RETURN

; } main function end

 

With the other line commented the asm output is correct:

 

main

; { main ; function begin

BCF STATUS, RP0

BCF STATUS, RP1

MOVF gbl_var1, W

MOVWF CompTempVar32

MOVF gbl_var1+D'1', W

MOVWF CompTempVar33

BCF STATUS,C

RRF CompTempVar33, F

RRF CompTempVar32, F

BCF STATUS,C

RRF CompTempVar33, F

RRF CompTempVar32, F

BCF STATUS,C

RRF CompTempVar33, F

RRF CompTempVar32, F

BCF STATUS,C

RRF CompTempVar33, F

RRF CompTempVar32, W

MOVWF main_1_var2

RETURN

; } main function end

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