public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug gcov-profile/110827] C++20 coroutines aren't being measured by gcov
Date: Thu, 27 Jul 2023 07:48:20 +0000	[thread overview]
Message-ID: <bug-110827-4-EVwhpxbq3b@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-110827-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110827

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2023-07-27
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
                 CC|                            |iains at gcc dot gnu.org

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
I'm seeing all code properly instrumented.  The coverage I see is

        -:    1:#include <coroutine>
        -:    2:#include <iostream>
        -:    3:
        -:    4:struct task {
        -:    5:  struct promise {
        -:    6:    using handle_t = std::coroutine_handle<promise>;
        1:    7:    task get_return_object() {
        1:    8:      return task{handle_t::from_promise(*this)};
        -:    9:    }
        1:   10:    std::suspend_never initial_suspend() noexcept { return {};
}
        1:   11:    std::suspend_always final_suspend() noexcept { return {}; }
    #####:   12:    void unhandled_exception() { std::terminate(); }
        1:   13:    void return_void() noexcept {}
        -:   14:    friend task;
        -:   15:  };
        -:   16:  using promise_type = promise;
        1:   17:  task(promise_type::handle_t handle) : handle_{handle} {}
        1:   18:  ~task() {
        1:   19:    if (handle_) {
        1:   20:      handle_.destroy();
        -:   21:    }
        1:   22:  }
        -:   23: private:
        -:   24:  promise_type::handle_t handle_;
        -:   25:};
        -:   26:
        1:   27:task foo() {
        -:   28:  std::cout << "Running..." << std::endl;
        -:   29:  co_return;
        2:   30:}
        -:   31:
        1:   32:int main(int argc, char **argv) {
        1:   33:  foo();
        1:   34:  return 0;
        -:   35:}

I have no idea why for example line 28 isn't marked executed.

  reply	other threads:[~2023-07-27  7:48 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-27  2:34 [Bug gcov-profile/110827] New: " mwd at md5i dot com
2023-07-27  7:48 ` rguenth at gcc dot gnu.org [this message]
2023-07-27  8:06 ` [Bug gcov-profile/110827] " iains at gcc dot gnu.org
2023-07-27 13:56 ` mwd at md5i dot com
2023-07-27 17:34 ` mwd at md5i dot com
2023-07-28  6:17 ` rguenth at gcc dot gnu.org
2023-07-28  9:41 ` iains at gcc dot gnu.org
2023-08-29 16:21 ` mwd at md5i dot com
2023-08-29 16:40 ` mwd at md5i dot com
2023-08-31 16:53 ` mwd at md5i dot com
2023-09-25 18:05 ` mwd at md5i dot com
2023-09-26 14:54 ` iains at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-110827-4-EVwhpxbq3b@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).