public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Jørgen Kvalsvik" <jorgen.kvalsvik@woven-planet.global>
To: Hans-Peter Nilsson <hp@bitrange.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Add condition coverage profiling
Date: Tue, 18 Oct 2022 12:13:03 +0200	[thread overview]
Message-ID: <420d48e3-a416-006d-adec-7a7cafad2149@woven-planet.global> (raw)
In-Reply-To: <alpine.BSF.2.20.16.2210171927470.42047@arjuna.pair.com>

On 18/10/2022 02:17, Hans-Peter Nilsson wrote:
> On Wed, 12 Oct 2022, Jørgen Kvalsvik via Gcc-patches wrote:
>> This patch adds support in gcc+gcov for modified condition/decision
>> coverage (MC/DC) with the -fprofile-conditions flag.
> 
> I'd love improvements in this area.
> 
> But this is a serious concern:
> 
>> gcov --conditions:
>>
>>         3:   17:void fn (int a, int b, int c, int d) {
>>         3:   18:    if ((a && (b || c)) && d)
>> condition outcomes covered 3/8
>> condition  0 not covered (true false)
>> condition  1 not covered (true)
>> condition  2 not covered (true)
>> condition  3 not covered (true)
>>         1:   19:        x = 1;
>>         -:   20:    else
>>         2:   21:        x = 2;
>>         3:   22:}
> 
> Is this the suggested output from gcov?
> 
> Sorry, but this is too hard to read; I can't read this.  What 
> does it mean?  What's 0 and what's 1 and which are the 8 
> conditions?  (Why not 16 or more; which are redundant?)  Or to 
> wit, a glance, which parts of (a && (b || c)) && d are actually 
> covered?

Hello,

Thanks for the feedback. I've modeled the output after the existing branch
coverage, but as you noticed conditions are slightly different because the
interesting output is what's _not_ taken. Like with branches, "conditions %d"
are the indices of the terms in the expression. The values in parenthesis are
the outcomes not found to be independent. Anything not listed is covered, guided
by the summary (conditions output covered n/m).

> 
> There has got to be a better *intuitively* understandable 
> presentation format than this. If you please forgive the errors 
> in not matching the partal expressions like in your proposal and 
> focus on the presentation format, I'd suggest something like, 
> for a one-time run with a=true, b=false, c=true, d=false:
> 
> "With:
>          3:   18:    if ((a && (b || c)) && d)
> 0:                       ^^^^^^^^^^^^^^^
> 1:                                          ^
> 2:                        ^
> 3:                             ^^^^^^^^
> 4:                              ^
> 5:                                   ^
> condition  0 not covered (false)
> condition  1 not covered (true)
> condition  2 not covered (false)
> condition  3 not covered (false)
> condition  4 not covered (true)
> condition  5 not covered (false)"
> (etc)
> 
> Possibly with each partial expression repeated above its 
> underscoring for readability, because of the increasing distance 
> between the underscoring and referred source.
> 
> Actually, a separate indexed table like that isn't the best 
> choice either.  Perhaps better quoting the source:
> 
> "condition (a && (b || c)) false not covered
> condition d false not covered
> condition (b || c) false not covered
> condition b true not covered
> condition c false not covered"
> 
> Or, just underscoring as instead of quoting the source:
> "        3:   18:    if ((a && (b || c)) && d)
> 
> In condition:            ^^^^^^^^^^^^^^^
> false not covered"
> (etc)
> 
> It is possible I completely misunderstand your proposal, but 
> there has to be something from the above to pick.  I'd hate to 
> see this go down because of usability problems.  Hope this was 
> constructive.
> 
> brgds, H-P

I agree, all of these are good suggestions to better outputs. The problem is
that information needed to create this output is, as far as I know, not
available when gcov runs as it is not recorded. When the instrumentation for the
condition coverage itself is determined this information *is* available (basic
blocks with locus) so it should be possible to improve both the output of
condition coverage and maybe even the branch coverage too.

Thanks,
Jørgen

  reply	other threads:[~2022-10-18 10:13 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-12 10:16 Jørgen Kvalsvik
2022-10-18  0:17 ` Hans-Peter Nilsson
2022-10-18 10:13   ` Jørgen Kvalsvik [this message]
2022-10-25  6:33 ` Ping " Jørgen Kvalsvik
2022-10-27 10:34   ` Martin Liška
2022-11-02  6:16   ` Jørgen Kvalsvik
2022-11-09 20:08     ` [Ping 2][PATCH] " Jørgen Kvalsvik
2022-11-10 14:19     ` Ping [PATCH] " Martin Liška
  -- strict thread matches above, loose matches on Subject: below --
2022-07-15 11:39 Jørgen Kvalsvik
2022-07-15 11:47 ` Jørgen Kvalsvik
2022-07-15 13:31   ` Sebastian Huber
2022-07-15 13:47     ` Jørgen Kvalsvik
2022-08-02  7:58       ` Jørgen Kvalsvik
2022-08-04  7:43         ` Sebastian Huber
2022-08-04  9:13           ` Jørgen Kvalsvik
2022-07-11 10:02 Jørgen Kvalsvik
2022-07-12 14:05 ` Sebastian Huber
2022-07-13  2:04   ` Jørgen Kvalsvik
2022-03-21 11:55 Jørgen Kvalsvik
2022-03-24 16:08 ` Martin Liška
2022-03-25 19:44   ` Jørgen Kvalsvik
2022-03-28 13:39     ` Martin Liška
2022-03-28 13:52     ` Jørgen Kvalsvik
2022-03-28 14:40       ` Jørgen Kvalsvik
2022-04-07 12:04         ` Martin Liška
2022-04-19 14:22           ` Jørgen Kvalsvik
2022-04-07 16:53         ` Sebastian Huber
2022-04-08  7:28           ` Jørgen Kvalsvik
2022-04-08  7:33             ` Jørgen Kvalsvik
2022-04-08  8:50               ` Sebastian Huber
2022-04-04  8:14 ` Sebastian Huber
2022-04-05  7:04   ` Sebastian Huber
2022-04-05 20:07   ` Jørgen Kvalsvik
2022-04-06  7:35     ` Sebastian Huber
2022-04-17 11:27       ` Jørgen Kvalsvik
2022-04-22  5:37         ` Sebastian Huber
2022-04-22 10:13           ` Jørgen Kvalsvik
2022-07-08 13:45 ` Sebastian Huber
2022-07-11  7:26   ` Jørgen Kvalsvik

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=420d48e3-a416-006d-adec-7a7cafad2149@woven-planet.global \
    --to=jorgen.kvalsvik@woven-planet.global \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hp@bitrange.com \
    /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).