addresses of labels don't work with today's CVS source

Brad Lucier lucier@math.purdue.edu
Wed May 3 12:25:00 GMT 2000


With this compiler:

popov-189% /export/u10/egcs-profile/bin/gcc -v
Reading specs from /export/u10/egcs-profile/lib/gcc-lib/alphaev6-unknown-linux-gnu/2.96/specs
gcc version 2.96 20000503 (experimental)

with this input:

int test (int i)
{
  static void * labels[] =
  {
    &&label_1,
    &&label_2
  };
  
  goto *(labels[i]);
  
 label_1:
  return 1;
  
 label_2:
  return 2;
}

I get these messages, which I think is an error:

popov-188% /export/u10/egcs-profile/bin/gcc -c test.c
test.c: In function `test':
test.c:5: initializer element is not computable at load time
test.c:5: (near initialization for `labels[0]')
test.c:7: initializer element is not computable at load time
test.c:7: (near initialization for `labels[1]')

I'm no expert on computed gotos, but this worked with yesterday's source
and with 2.95.1.  If there is indeed a problem, perhaps this test should
be added to the test suite.

Brad Lucier

PS:  This problem does not allow me to test Michael Matz's proposed
patch to flow.c.


More information about the Gcc-bugs mailing list