Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False Positive in Uninitialized Value Report #1864

Open
thanhtoantnt opened this issue Sep 2, 2024 · 0 comments
Open

False Positive in Uninitialized Value Report #1864

thanhtoantnt opened this issue Sep 2, 2024 · 0 comments

Comments

@thanhtoantnt
Copy link

thanhtoantnt commented Sep 2, 2024

I run infer with the following example using infer -- clang example.c

struct struct_ex {
	int arg0;
	int arg1;
	int arg2;
};

struct struct_ex assign_fields(struct struct_ex value)
{
	return value;
}

struct struct_ex error_triggering_fun(struct struct_ex args)
{
	struct struct_ex value = args;

	return value;
}

static struct struct_ex foo(struct struct_ex value)
{
	struct struct_ex args;
	args = assign_fields(value);
	return error_triggering_fun(args);
}

int main(){
    return 0;
}

infer reports an error which I think is a false positive since all fields of the data structure are assigned values.

uninit_ex.c:23: error: Uninitialized Value
  `args.arg0` is read without initialization during the call to `error_triggering_fun()`. 
  21.   struct struct_ex args;
  22.   args = assign_fields(value);
  23.   return error_triggering_fun(args);
              ^
  24. }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant