Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 332228 - Parser doesn't like GCC labels as values
Summary: Parser doesn't like GCC labels as values
Status: RESOLVED DUPLICATE of bug 84144
Alias: None
Product: CDT
Classification: Tools
Component: cdt-parser (show other bugs)
Version: 8.0   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Markus Schorn CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-09 12:19 EST by James Blackburn CLA
Modified: 2010-12-09 12:25 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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 ***