Jump to content
Sign in to follow this  
CuoreDiGhiaccio

Unsigned Int Sometime Fail With 16F887 And Optimization Flag = On

Recommended Posts

Hi,

sometime with unsigned int variable and optimization flag = on, compiler fail in some comparison test:

 

unsigned int i; // in asm file: gbl_i EQU 0x00000050 ; bytes:2

 

if (i==0)

{

do something

}

 

the generated code (some times, randomly), this is:

 

 

movf gbl_i, f

btfss status, z

goto label

 

the code:

 

movf gbl_i+D'1', f

btfss status, z

 

is missing, so when value is 256 the expression is condidered true.

 

Recompiling all work fine for some times but it can appear in other part of code with other variable with the same comparison type.

 

Apparently appear to be optimization the cause, but i'm not sure, i'll see it with the time. In the meantime I can only hope that the 500 elevators with only the firmware recompiled not have the problem.

 

Regards

 

 

Please do not consider this post, i found that sometime Build Fail and sometime no.

Edited by CuoreDiGhiaccio

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