Skip to content

Tracking function pointers in indirectly pointed structures #1951

@jprotopopov-ut

Description

@jprotopopov-ut

Goblint revision: e816b4a
The following snippet:

struct S {
	int type;
	void (*cb)(void);
	struct S *nested;
};

void test(const struct S *s) {
	for (; s && s->type; s++) {
		if (s->type == 1) {
			test(s->nested);
		} else {
			s->cb();
		}
	}
}

void dummy(void) {}

int main() {
	struct S s1[] = {
		{2, dummy},
		{0}
	};
	struct S s2[] = {
		{1, 0, s1},
		{0}
	};

	test(s2);
	return 0;
}

causes Goblint to output soundness warning:

[Warning][Unsound][Call] No suitable function to be called at call site. Continuing with state before call.

The snippet has been manually extracted from invokeCallbacksPRE_230228 function of AnalyzeThat rsync, where the same soundness warning is observed.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions