From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from arjuna.pair.com (arjuna.pair.com [209.68.5.131]) by sourceware.org (Postfix) with ESMTPS id 24F523858D32 for ; Tue, 18 Oct 2022 00:17:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 24F523858D32 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=bitrange.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=bitrange.com Received: by arjuna.pair.com (Postfix, from userid 3006) id A641D8A7F7; Mon, 17 Oct 2022 20:17:42 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by arjuna.pair.com (Postfix) with ESMTP id A59F68A7F2; Mon, 17 Oct 2022 20:17:42 -0400 (EDT) Date: Mon, 17 Oct 2022 20:17:42 -0400 (EDT) From: Hans-Peter Nilsson X-X-Sender: hp@arjuna.pair.com To: =?ISO-8859-1?Q?J=F8rgen_Kvalsvik?= cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH] Add condition coverage profiling In-Reply-To: <20221012101619.7221-1-jorgen.kvalsvik@woven-planet.global> Message-ID: References: <20221012101619.7221-1-jorgen.kvalsvik@woven-planet.global> User-Agent: Alpine 2.20.16 (BSF 172 2016-09-29) MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT X-Scanned-By: mailmunge 3.09 on 209.68.5.131 X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00,KAM_DMARC_STATUS,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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? 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