Skip to content

goto-instrument: handling of VarArgs #934

Closed
@stahlbauer

Description

@stahlbauer

It would be great if goto-instrument would be able to handle variable arguments and dump valid C code; example of a program that is not yet fully covered by the implementation:

#include<stdarg.h>
#include<stdlib.h>

void bb_verror_msg(const char *s, va_list p, const char *strerr) {
}

void bb_error_msg(const char *s, ...)
{
    va_list p;
    va_start(p, s);
    bb_verror_msg(s, p, NULL);
    va_end(p);
}

int main() {
    bb_error_msg("FOOO");
    return 0;
}

GCC complains about when parsing the file that was produced by goto-instrument:

error: cast specifies array type
   va_list p=(va_list)&s;
             ^
error: cast specifies array type
   p = ((va_list)NULL);

clang states that:

error: used type 'va_list' (aka
      '__builtin_va_list') where arithmetic or pointer type is
      required
  va_list p=(va_list)&s;
            ^        ~~
error: used type 'va_list' (aka
      '__builtin_va_list') where arithmetic or pointer type is
      required
  p = ((va_list)((void*)0));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions