From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by sourceware.org (Postfix) with ESMTPS id 2DA9E3858CDA for ; Wed, 13 Jul 2022 02:04:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2DA9E3858CDA Received: by mail-pj1-x1030.google.com with SMTP id a15so10018417pjs.0 for ; Tue, 12 Jul 2022 19:04:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=P5AOBz/Tm4lDPRdhtaiSKb6rqCusuznZHGFEbAeaTNY=; b=FjDVxhm+eqqA85pkcv9ScFUYjznFW0i910Qm9a32CidXckirQtfVwh0VoqlV+Y+tE2 dF43N5OwdZ3O4TX1ZVab8CQsDvDk0pugC5QhakN561H9wK92JOHsQyzgDy+jlZkSlsq8 vbCP2S1p4LGtoUP4tIeEaU7AqvcNRRiDrOUcvCiHgh4BMY4Ta1ahegNQ8lHl49INMMkF N3vdXeurj5CgB98yOvnzfU2JDQUHeJH1tNNtSt0A7rfA4GuNFQSgx1v/5FPBsXsIInS4 J+lkiLwKjhls1eB8eDRGn1lNvUFdVpl5rM+dWCBosKY/f2Dd7fm7tZeZZreIxh0/qNhn 45JQ== X-Gm-Message-State: AJIora8VLQ14QFkuJ7MNgJj/DW48omcUHC9YxwH6HapuaSnlpp08yobi lrAoZt4E2xgnX+wUFdchwM4BTsqzH00iEA== X-Google-Smtp-Source: AGRyM1sMcgs+aqUNAmQkTuxW4ogFcgFwshSF6+uDqJ9c8y7Ii1GdpMRWS79/omK24wcxbw50nGedUQ== X-Received: by 2002:a17:90b:4d8a:b0:1ef:da53:e126 with SMTP id oj10-20020a17090b4d8a00b001efda53e126mr7626757pjb.116.1657677869047; Tue, 12 Jul 2022 19:04:29 -0700 (PDT) Received: from [172.18.16.197] ([103.175.111.222]) by smtp.gmail.com with ESMTPSA id n67-20020a632746000000b003fbfe88be17sm6824453pgn.24.2022.07.12.19.04.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 12 Jul 2022 19:04:28 -0700 (PDT) Message-ID: Date: Wed, 13 Jul 2022 04:04:26 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH] Add condition coverage profiling Content-Language: en-US To: Sebastian Huber , gcc-patches@gcc.gnu.org References: <20220711100237.22030-1-jorgen.kvalsvik@woven-planet.global> From: =?UTF-8?Q?J=c3=b8rgen_Kvalsvik?= In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00, BODY_8BITS, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2022 02:04:34 -0000 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