Jump to content
Sign in to follow this  
edt

Switch On Constant

Recommended Posts

I came across the following behavior. The problem is very reproducible. I think the compiler accidentally assumes every immediate value is 0.

33:               	 switch (3) {
34:               		 case 0:
35:               			 trisa = 0x01;
 0003    3001     MOVLW 0x1
 0004    1683     BSF 0x3, 0x5
 0005    1303     BCF 0x3, 0x6
 0006    0085     MOVWF 0x5
36:               			 break;
37:               		 case 1:
38:               			 trisa = 0x23;
39:               			 break;
40:               	 }

I'm seeing this with BoostC 6.70 on Windows XP. The target is a P16f877A.

Share this post


Link to post
Share on other sites

Does it still do this if you insert the "default:" case as ANSI defines it?

Your example seems to be missing it...

Edited by emte

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