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