Jump to content

Boostc 6.80 Generates Bad Code


Recommended Posts

// File: bug21.C
// Target: PIC16F648A 
// OS: WinXP, SP2
// SourceBoostIDE: 6.80
// Compiler: BoostC 6.80
// Reproducible: always
// Expected behavior: Generate code for switch case 3 only
//
// Description: When a constant is used as the switch variable
//			  code is generated only for the first case.
//  
/* code generated:
void badcase (void)

{
 switch (3) {

  case 0:
	  trisa = 0x01;
0003  3001	  MOVLW 0x01
0004  1683	  BSF STATUS, RP0
0005  1303	  BCF STATUS, RP1
0006  0085	  MOVWF gbl_trisa

	  break;
  case 1:
	  trisa = 0x23;

	  break;
  case 3:
	  trisa = 0x83;

	  break;
 }
}
0007  0008	  RETURN
*/

#include <system.h>

void badcase (void)
{
 switch (3) {
  case 0:
	  trisa = 0x01;
	  break;
  case 1:
	  trisa = 0x23;
	  break;
  case 3:
	  trisa = 0x83;
	  break;
 }
}
void main()
{
 badcase();
}

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...
×
×
  • Create New...