I suggest you ...

Support for labels as values (GNU extension)

GNU C / Clang support an extension where the address of a label can be taken as a value and assigned to a variable, and then jumped to using goto.
https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html

For example, this small test program:

int main(void)
{
int r;
foo:
r = 4;

void *f = &&foo;

goto *f;

return 0;
}

causes the following errors from FlexeLint:

--- Module: main.c (C)
_
void *f = &&foo;
main.c 8 Error 24: Expected an expression, found '&&'
main.c 8 Error 40: Undeclared identifier 'foo'
_
goto *f;
main.c 11 Error 10: Expecting identifier

Is there some combination of flags that can be used to check code using this extension, or does lint support it somehow?

3 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    Brendan Shanks shared this idea  ·   ·  Admin →

    0 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...

      Feedback and Knowledge Base