Jump to content
Sign in to follow this  
bhPIC

Internal Error: Label Lookup Error

Recommended Posts

I am trying to get some code that I wrote with the C2C-plus (that worked with that) to compile with the BoostC upgrade. I am getting a strange error and I don't know what is causing the problem.

 

void password(void)

{ char i,j='0';

xcpass: if(j=='1') {

line3();

lcd_str(wrong);

for(i = 10; i > 0; i--) {

wrt_lcd('.');

delay_ms(i * 20);

delay_ms(i*20);

}

}

for(i = 0; i < 3; i++)

key_press=0;

clear_LCD();

line1();

lcd_str(tag);

line2();

lcd_str(Cam_Con);

line4();

lcd_str(passline);

button_handler();

wrt_lcd('*');

button_handler();

wrt_lcd('*');

button_handler();

wrt_lcd('*');

button_handler();

wrt_lcd('*');

if((key_press[0] == '1')&&(key_press[1] == '7')&&(key_press[2] == '7')&&(key_press[3] == '1')) {

configset();

goto xcpass;

}

if(!((key_press[0] == '4')&&(key_press[1] == '3')&&(key_press[2] == '2')&&(key_press[3] == '1'))) {

j='1';

goto xcpass;

}

}

 

 

 

I get the label lookup error on the first "goto xcpass: " any ideas?

 

Thanks

Share this post


Link to post
Share on other sites

bhPIC,

 

Looks like a compiler bug :(

 

As soon as { } appear around the goto it fails.

 

ie this code fails;

 

void foo()
{
   lab1:
   {
       goto lab1;
   }
}

 

Workaround for now is to re-write code so that goto does not appear inside {}

 

Using goto is generally frowned upon, must be why testing hasn't reveal this problem.

Here is your code without use of goto :)

 

void password(void)
{ 
char i,j='0';
while( 1 )
{
 if(j=='1') 
 {
	 line3();
	 lcd_str(wrong);
	 
	 for(i = 10; i > 0; i--) 
	 {
   wrt_lcd('.');
   delay_ms(i * 20);
   delay_ms(i*20);
	 }
 }

 for(i = 0; i < 3; i++)
	 key_press[i]=0;
 
 clear_LCD();
 line1();
 lcd_str(tag);
 line2();
 lcd_str(Cam_Con);
 line4();
 lcd_str(passline);
 button_handler();
 wrt_lcd('*');
 button_handler();
 wrt_lcd('*');
 button_handler();
 wrt_lcd('*');
 button_handler();
 wrt_lcd('*');

 if(	(key_press[0] == '1')
 &&	(key_press[1] == '7')
 &&	(key_press[2] == '7')
 &&	(key_press[3] == '1')) 
 {
	 configset();
 }
 else
 {
	 // 
	 if(!((key_press[0] == '4')
	 &&	(key_press[1] == '3')
	 &&	(key_press[2] == '2')
	 &&	(key_press[3] == '1'))) 
	 {
   j='1'; 
	 } 
	 else
   break; // terminate loop
 }
}
}

 

Regards

Dave

Share this post


Link to post
Share on other sites
Fixed. Fix will be available in the next release.

 

Regards,

Pavel

 

When will the next release be out? I have the same issue, but with inline assembly.

 

For example..

 

void main()
{
{
 asm
 {
	 my_label:
	 goto my_label
 }
}
}

 

I can work round it for now by putting the assembly block in a seperate subroutine.

 

Regards

 

Chris

Share this post


Link to post
Share on other sites

Forgot to mention. The C version seems fixed in 1.9.3, but the inline asm version still fails. Since 'goto' is essential in asm its a bit more serious.

 

regards

 

Chris.

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