OrangeC
OrangeC copied to clipboard
FR: add support for GCC extension values for labels / computed goto
This is a GCC extension (not high priority to add, but would be nice to be added later) documented at https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html
It allows to assign a label address to a void pointer and issue a goto on it:
int test ()
{
void *test_ptr;
test_ptr = &&lab;
goto *test_ptr;
return 1;
lab:
return 0;
as it is currently not supported occ says:
Warning(137) conftest.c(4): 'test_ptr' used without prior assignment in function test
Error(147) conftest.c(4): Expression syntax error in function test
Error( 18) conftest.c(4): Undefined symbol 'lab' in function test
Error(183) conftest.c(6): goto statement needs a label specifier in function test
Error( 11) conftest.c(7): Syntax error: ; expected in function test
4 Errors
Just wanted to leave a ping on this (still no urgency).
found a program that implements this to test with : https://github.com/marcobambini/gravity
There is a most simple testcase in the start of this issue.
... and:
You can also "create" those very easy: compile with a cobc that was compiled with OrangeC before and add -fcomputed-goto or run its configure script - which tests for that feature (not checked, but very likely with that test program above) and if available makes -fcomputed-goto the default so running make checkall give you some thousand tests of this feature (even if that means likely only 5-10 real different tests).
It seems that this should have been closed with 057df1b, right?
Did you gave that a try with GnuCOBOL (configure should find it working and the GnuCOBOL testsuite will then use it a lot), especially with the NIST testsuite?
yes this should have been closed... don't think I ran it against gnu cobol though...
So... should we just close it or do you plan to run the test before?
if i have time i'll run the tests this weekend, otherwise i might close it...
I'm going to close this. eventually I will get back to gnu cobol and it will get tested as part of other tests...