From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by sourceware.org (Postfix) with ESMTPS id DC9D43858C83 for ; Tue, 18 Oct 2022 10:13:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DC9D43858C83 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=woven-planet.global Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=woven-planet.global Received: by mail-lf1-x130.google.com with SMTP id j4so21783437lfk.0 for ; Tue, 18 Oct 2022 03:13:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=woven-planet.global; s=google; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=OCwCgO7u5Ep58vqTsx8Rs4mEgmML+XqdFp+wxNPM25E=; b=e97PU87G7zt11pL+GhFrfL5pYSRzN2yaAgedNwObxuGUl/z4kagWzTcr8mWAGpTMUU J89nVxRErJcHT1wY6EruESUgGQlgjL4mx//7RL26WuAyXUuhM3qb4e7Qxw5K9gaqBlce TLy5RAB93nquoaxmqcrNTD+Dm/jaGMOTQHEAo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=OCwCgO7u5Ep58vqTsx8Rs4mEgmML+XqdFp+wxNPM25E=; b=7830IHZHzhGyK7TsNYWmJX3lq7VD+sV8n8/cMy/P9pl+MR3trdf9Wz+eeG5/FNty4H Xz3naNV77GGVDdGTakH8PNFy5GO3hXS8nSXlsTVyd57EqtqUTAVeY6j9OIWasaR4tNIM uAKMVaOcBnRN6vadY9LVg20tCk0R+WNktc8g4v/iIdep9YDjXBJsN61Fw0ExDJN2LKAK mcSHhPDGoTXZN+ilF+pbWedbkZ2AxippGOd/snIe46hQRYfK9aDKybW5IFN45nuYXr1J xdq8E83uSxJxgbQFH/Z8+SPq1ZHAgWRWmDqsVy3pYNrCnDVCD4rEB0oxHKAiNjAoG1p7 t0jQ== X-Gm-Message-State: ACrzQf0OLTkQ7a+3QQMLeol12npbxVOV4rBjfrtxqmOEgP7k8VgdVgPZ tzi5rjNNH4KupRRy+hTK+SN0yN9zNokdBSPf X-Google-Smtp-Source: AMsMyM5UDrCTA2clCvWg26yDpL/1jluIviDRNtpbQwobHR2S2WLHsFCZjgrk7/z0t5i19fTEzMrw8Q== X-Received: by 2002:ac2:47e1:0:b0:4a2:40e5:781a with SMTP id b1-20020ac247e1000000b004a240e5781amr693479lfp.335.1666087985064; Tue, 18 Oct 2022 03:13:05 -0700 (PDT) Received: from [192.168.10.110] (173.80-203-8.customer.lyse.net. [80.203.8.173]) by smtp.gmail.com with ESMTPSA id f28-20020a05651c03dc00b0026dced9840dsm1850902ljp.61.2022.10.18.03.13.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 18 Oct 2022 03:13:04 -0700 (PDT) Message-ID: <420d48e3-a416-006d-adec-7a7cafad2149@woven-planet.global> Date: Tue, 18 Oct 2022 12:13:03 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.3.2 Subject: Re: [PATCH] Add condition coverage profiling Content-Language: en-US To: Hans-Peter Nilsson Cc: gcc-patches@gcc.gnu.org References: <20221012101619.7221-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=-5.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,TXREP,T_SPF_PERMERROR 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 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