Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 332228

Summary: Parser doesn't like GCC labels as values
Product: [Tools] CDT Reporter: James Blackburn <jamesblackburn+eclipse>
Component: cdt-parserAssignee: Project Inbox <cdt-parser-inbox>
Status: RESOLVED DUPLICATE QA Contact: Markus Schorn <mschorn.eclipse>
Severity: normal    
Priority: P3 CC: Alex.Burr, cdtdoug
Version: 8.0   
Target Milestone: ---   
Hardware: PC   
OS: All   
Whiteboard:

Description James Blackburn CLA 2010-12-09 12:19:40 EST
GCC supports Labels as Values:
http://gcc.gnu.org/onlinedocs/gcc-4.5.0/gcc/Labels-as-Values.html#Labels-as-Values

For this code:
int main(void) {
	foo:
	puts("!!!Hello World!!!"); /* prints !!!Hello World!!! */
	void* foo_p = &&foo;
	goto *foo_p;
	return EXIT_SUCCESS;
}

There are two syntax annotations - though the code builds an runs without error on Linux.
Comment 1 James Blackburn CLA 2010-12-09 12:21:55 EST
Or Alex's more realistic jumptable use case:

int func(int i)
{
  void *jumptable[4] =   {&&lab0, &&lab1, &&lab2, &&lab3};

  goto *jumptable[i];

lab0:	return 0;
lab1:   return 1;
lab2:   return 2;
lab3:   return 3;

  return 4;
}
Comment 2 James Blackburn CLA 2010-12-09 12:25:41 EST
Duplicate

*** This bug has been marked as a duplicate of bug 84144 ***