public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Jørgen Kvalsvik" <jorgen.kvalsvik@woven-planet.global>
To: Sebastian Huber <sebastian.huber@embedded-brains.de>,
	gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Add condition coverage profiling
Date: Wed, 13 Jul 2022 04:04:26 +0200	[thread overview]
Message-ID: <c2c3cf24-3861-d612-4ea1-4cd0dfe22054@woven-planet.global> (raw)
In-Reply-To: <ad3f098f-9caa-b656-47e8-6cd1b216fec4@embedded-brains.de>

On 12/07/2022 16:05, Sebastian Huber wrote:
> Hello Jørgen,
> 
> thanks for the updated patch. I used it for a test suite run and the results
> look quite good.
> 
> Could you please add this hunk to your patch set:
> 
> diff --git a/libgcc/libgcov-merge.c b/libgcc/libgcov-merge.c
> index 89741f637e1..9e3e8ee5657 100644
> --- a/libgcc/libgcov-merge.c
> +++ b/libgcc/libgcov-merge.c
> @@ -33,6 +33,11 @@ void __gcov_merge_add (gcov_type *counters __attribute__
> ((unused)),
>                         unsigned n_counters __attribute__ ((unused))) {}
>  #endif
> 
> +#ifdef L_gcov_merge_ior
> +void __gcov_merge_ior (gcov_type *counters  __attribute__ ((unused)),
> +                      unsigned n_counters __attribute__ ((unused))) {}
> +#endif
> +
>  #ifdef L_gcov_merge_topn
>  void __gcov_merge_topn (gcov_type *counters  __attribute__ ((unused)),
>                         unsigned n_counters __attribute__ ((unused))) {}
> 
> It is necessary to use gcov in freestanding environments (inhibit_libc is defined).
> 
> The condition profiling found one spot for which we have insufficient condition
> coverage:
> 
> function _Leap_year called 227 returned 100% blocks executed 100%
>       227:   54:static bool _Leap_year(
>         -:   55:  uint32_t year
>         -:   56:)
>         -:   57:{
>       227:   58:  return (((year % 4) == 0) && ((year % 100) != 0)) || ((year %
> 400) == 0);
> branch  0 taken 19% (fallthrough)
> branch  1 taken 81%
> branch  2 taken 16% (fallthrough)
> branch  3 taken 84%
> branch  4 taken 4% (fallthrough)
> branch  5 taken 96%
> conditions covered 5/6
> condition  1 not covered (false)
>         -:   59:}
> 
> This is because we don't test with the year 2100 for example. This value would
> result in:
> 
> year % 4 == 0: true
> year % 100 != 0: false
> year % 400 == 0: false
> 
> It was not immediately clear to me what the
> 
> "conditions covered 5/6
> condition  1 not covered (false)"
> 
> is supposed to tell me. I guess a reasonable interpretation is: condition 1
> (which is "(year % 100) != 0" should be false and determine the outcome of the
> decision.
> 
> What could be a bit confusing is that we have "conditions covered 5/6", however,
> there are only three conditions (0: (year % 4) == 0, 1: (year % 100) != 0, 2:
> (year % 400) == 0). Maybe it would be more clear if the report says "condition
> variants covered 5/6" or something like this.
> 

Hello,

Thanks for the feedback. I'll apply the patch, no problem.

As for output I was honestly never really too happy with the output, and hoped
something would leap out during development (it didn't). I modeled most of it
after what the branch coverage output, and I'll give it a bit of thinking to see
if I can make it more intuitive at least.

Thanks,
Jørgen

  reply	other threads:[~2022-07-13  2:04 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-11 10:02 Jørgen Kvalsvik
2022-07-12 14:05 ` Sebastian Huber
2022-07-13  2:04   ` Jørgen Kvalsvik [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-10-12 10:16 Jørgen Kvalsvik
2022-10-18  0:17 ` Hans-Peter Nilsson
2022-10-18 10:13   ` Jørgen Kvalsvik
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-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=c2c3cf24-3861-d612-4ea1-4cd0dfe22054@woven-planet.global \
    --to=jorgen.kvalsvik@woven-planet.global \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=sebastian.huber@embedded-brains.de \
    /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).