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

clang coverage reports zero count on line after an assert #57388

Closed
hanickadot opened this issue Aug 26, 2022 · 2 comments
Closed

clang coverage reports zero count on line after an assert #57388

hanickadot opened this issue Aug 26, 2022 · 2 comments
Labels
coverage duplicate Resolved as duplicate

Comments

@hanickadot
Copy link
Contributor

For code:

#include <cstdio>
#include <cassert>

int main(int argc, char ** argv) {
	puts("hello");
	assert(argc>=1);
	puts("ciau");
	return 0;
}

The line after assert(argc>=1); is marked as not covered:

Screenshot 2022-08-26 at 17 10 23

When I expanded the assert macro to look what's going on inside I got:

#include <cstdio>
#include <stdlib.h>

#define assert(e)  \
    ((void) ((e) ? ((void)0) : __assert (#e, __FILE_NAME__, __LINE__)))
#define __assert(e, file, line) \
    ((void)printf ("%s:%d: failed assertion `%s'\n", file, line, e), abort())

int main(int argc, char ** argv) {
	puts("hello");
	assert(argc>=1);
	puts("ciau");
	return 0;
}

The line after the assert is still not matched...

Screenshot 2022-08-26 at 17 12 13

expected behaviour:

  1. assert is marked as covered (and not expanded so the failure is not seen)
  2. line after the assert is also marked as covered
@hanickadot
Copy link
Contributor Author

tried with 14 and 15rc3

@zmodem
Copy link
Collaborator

zmodem commented Feb 14, 2023

Duplicate of #59030

@zmodem zmodem marked this as a duplicate of #59030 Feb 14, 2023
@EugeneZelenko EugeneZelenko added the duplicate Resolved as duplicate label Feb 14, 2023
@EugeneZelenko EugeneZelenko closed this as not planned Won't fix, can't repro, duplicate, stale Feb 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
coverage duplicate Resolved as duplicate
Projects
None yet
Development

No branches or pull requests

4 participants