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

[Coverage][C++] Class member initializers aren't mapped but increment wrong counters #113035

Open
chapuni opened this issue Oct 19, 2024 · 0 comments
Labels

Comments

@chapuni
Copy link
Contributor

chapuni commented Oct 19, 2024

struct Foo {
  bool f = (true ? true : true);
  Foo();
};

//Foo::Foo() : f(true ? true : true) {}
Foo::Foo() {}

(https://godbolt.org/z/n6M6fPr46)

  • Member initializer is not mapped
  • Looks like Counter 0 is increment wrongly. Finally Counter 0 is incremented twice (+=2)
  • Works as expected if the explicit member initializer is specified. (//uncomment)

As far as I investigated,

  • Counter is not assigned in CodeGenPGO.cpp
  • Class member initializer is not traversed in CoverageMappingGen.cpp
  • Instrumentations are working in CGExpr.cpp, but counter number is 0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants