Message ID | 20231004123921.634024-12-j@lambda.is |
---|---|
State | Unresolved |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:254a:b0:403:3b70:6f57 with SMTP id hf10csp108140vqb; Wed, 4 Oct 2023 05:52:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IER+nGhO88A7HmhkBbAUxTHlaMg2ppi3ofnqCYdpz0nKA2zFDGfu75qNwjYqGMgS4i6aZm3 X-Received: by 2002:a17:906:1daa:b0:9aa:63d:9ede with SMTP id u10-20020a1709061daa00b009aa063d9edemr1930266ejh.9.1696423939193; Wed, 04 Oct 2023 05:52:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696423939; cv=none; d=google.com; s=arc-20160816; b=mglZMpNkZ+qPrZGBhw8IwW+VudxaGJSyBe7rivHUZDo4u9mXMc7TWUCCYtKqAjdNbD Ho1oJdUVNSUqwKQBYDX53nwof9W9ws4npbvhFH6XK9g2SZpgmwycCyrCKb3+WVECAzy/ y9D+61XyOihmLPQcacZ7Gwy2FfHXyymISb6HMkYsXc+dCrSKN4cIx56E0QDondYctkvq kzqx774zN71zgBAC2zlG7UVcATF1ovuf/6c7RMbe0RfcanoPKWb0UR896heMUucxJSQ3 /lv5pi1BS/H0P1SJbpw1glie9eIaAJd5B4MyfQW8cMYCl4G0BIqx8TwNEQ1nrX7xcyu2 KYhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:dmarc-filter:delivered-to; bh=e+xY4aghT1KsSbyPpqPJlQkaMY78hpV+//L/SSfM7aI=; fh=9YvKuYzPOH4H8p6ZxADoseEyE0mG6135swhZOYPib+Q=; b=t1pKCzybLdRTc2+U0aFSEbNWvNltMECyXRduTQ9FKZmOxa5DqDHqwbPw23wqmk3xD3 FVMXrQKQw4ex+ZP5mJ4eCr6UooErGRkl0d/mcb+6CY0WGa6pLH55ETEe6PTv3Uj1Pn/1 KZd7cWmBi72fsE2BsQKQoUlBCC5QGV52jBAlmxria8OqxdAg755F+mTEM1A4eNFNm4H+ bXLorUCNVqxSR9Izrbl9q/y4a2s3PpTMmgsCiUysyS5I7eljzVZAWxlnpYMrt6NSWDrs X2JVIiz/R31+oen4bc6zlEX2BoTnNF/79VWsjy1aMHdQuNkfNrchIgp+alVLA5rJJBbd /i7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kolabnow.com header.s=dkim20160331 header.b=BLozT0Qw; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id h22-20020a17090634d600b0099bd6ea3798si1724662ejb.136.2023.10.04.05.52.18 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 05:52:19 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@kolabnow.com header.s=dkim20160331 header.b=BLozT0Qw; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DE4913881D3F for <ouuuleilei@gmail.com>; Wed, 4 Oct 2023 12:43:59 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx.kolabnow.com (mx.kolabnow.com [212.103.80.155]) by sourceware.org (Postfix) with ESMTPS id 072663870918 for <gcc-patches@gcc.gnu.org>; Wed, 4 Oct 2023 12:40:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 072663870918 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=lambda.is Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=lambda.is Received: from localhost (unknown [127.0.0.1]) by mx.kolabnow.com (Postfix) with ESMTP id 3782C20AB2EE; Wed, 4 Oct 2023 14:40:48 +0200 (CEST) Authentication-Results: ext-mx-out011.mykolab.com (amavis); dkim=pass (4096-bit key) reason="pass (just generated, assumed good)" header.d=kolabnow.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kolabnow.com; h= content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:date:subject:subject:from:from:received :received:received; s=dkim20160331; t=1696423247; x=1698237648; bh=e+xY4aghT1KsSbyPpqPJlQkaMY78hpV+//L/SSfM7aI=; b=BLozT0Qwk2j2 +0g6YtsZwoRUG3SDitxgp4q5tVUpnLtPVrEmh59I+KzI/Zi2+MmbJTid44+D/RMe vYcO47M+CPaUsSTd2B96Sp4/n/kF3CaFJ8wgGbXZJDjbVqf6djr6WYfKsOn+2Bk9 0m0Fqp8hq+nOx82yLXo9uGJbl/NQ/bWmeEuw4wD9oni81Omc5S8UTnDls1aaI7dq NyVI0gyPab1hxecRyIAwjuDqcjLKU3HOdVMXM3On3ZB/oJyaoHl0CthqUDB/+DkG M2tBQSpwoAFeAUUBBljdDHwpoOw4U1UxLD4/2UaD28UPThaCNPJ82UBv2ACu+jMY p8lSpW0pNofC8s7CV+Fh1wfn9A4xwmtjJMjogR71zntFpw291V9T6tWm7CzhC6YC E9semjZUc5xBp3SaFoPXkSAi7VwoPk0UyYKheTe/QT7KtijxiVUXUGD4OgoxAOfN kbauzZtJW3EA3OQWmW4ko4Hlxq3S71lU9P8enAGZssREuBVhDpLHrHzBXmah/u0w F7beLfO4ZqLQPEkHqS/nEUPksuu7Bog+Q/OF5E2sdTbdJ3Q7bSYL3XLy+/zvXGFI 6TC1Pz+cy2IG4hrpvY2bmlFR3rm6lvjqb6bUydrZRz08OGQ70IXVKz2yXsBtnFRG BW+lS7C9gT0bjMF95ol4MZnU+L+8jGY= X-Virus-Scanned: amavis at mykolab.com X-Spam-Score: -1 X-Spam-Level: X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 Received: from mx.kolabnow.com ([127.0.0.1]) by localhost (ext-mx-out011.mykolab.com [127.0.0.1]) (amavis, port 10024) with ESMTP id 4T_OVgh053Vl; Wed, 4 Oct 2023 14:40:47 +0200 (CEST) Received: from int-mx011.mykolab.com (unknown [10.9.13.11]) by mx.kolabnow.com (Postfix) with ESMTPS id 91C0E20AB2E2; Wed, 4 Oct 2023 14:40:47 +0200 (CEST) Received: from ext-subm010.mykolab.com (unknown [10.9.6.10]) by int-mx011.mykolab.com (Postfix) with ESMTPS id 7D3F13081E51; Wed, 4 Oct 2023 14:40:47 +0200 (CEST) From: =?utf-8?q?J=C3=B8rgen_Kvalsvik?= <j@lambda.is> To: gcc-patches@gcc.gnu.org Cc: mliska@suse.cz, jh@suse.cz, =?utf-8?q?J=C3=B8rgen_Kvalsvik?= <j@lambda.is> Subject: [PATCH 11/22] Add test case showing cross-decision fusing Date: Wed, 4 Oct 2023 21:39:11 +0900 Message-Id: <20231004123921.634024-12-j@lambda.is> In-Reply-To: <20231004123921.634024-1-j@lambda.is> References: <20231004123921.634024-1-j@lambda.is> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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.30 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778829428571656248 X-GMAIL-MSGID: 1778829428571656248 |
Series |
[01/22] Add condition coverage profiling
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | warning | Git am fail log |
Commit Message
Jørgen Kvalsvik
Oct. 4, 2023, 12:39 p.m. UTC
Some expressions create CFGs isomorphic to those with multi-term expressions, e.g. if (a) if (b) {} is equivalent to if (a && b) {}, and there is no real recovery for this. The test is added to 1. document the behaviour and 2. detect if the cfg generation changes in a way that (correctly) splits the ifs. Note that some arithmetic is performed between the else-if and the following if. This is not sufficient to create a new basic block, and all sorts of arithmetic and side effect is possible between terms in an arbitrary boolean expression anyway, for example if (a++ && --b). --- gcc/testsuite/gcc.misc-tests/gcov-19.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
diff --git a/gcc/testsuite/gcc.misc-tests/gcov-19.c b/gcc/testsuite/gcc.misc-tests/gcov-19.c index 662f4ca2864..5b5c1c275b0 100644 --- a/gcc/testsuite/gcc.misc-tests/gcov-19.c +++ b/gcc/testsuite/gcc.misc-tests/gcov-19.c @@ -146,6 +146,26 @@ mcdc004e (int a, int b, int c) } } +/* else-if is not immune to the else-less fuse. This test is also put in as a + * detection mechanism - sif this should register as 3 individual decisions + * then the test should be updated and fixed to reflect it. */ +int +mcdc004f (int a, int b, int c) +{ + if (a) /* conditions(1/2) false(0) */ + /* conditions(end) */ + { + x = 1; + } + else if (b) /* conditions(0/4) true(0 1) false(0 1) */ + /* conditions(end) */ + { + x = 2; + if (c) + x = 3; + } +} + /* mixing && and || works */ void mcdc005a (int a, int b, int c) @@ -1137,6 +1157,8 @@ int main () mcdc004e (0, 0, 0); mcdc004e (1, 1, 1); + mcdc004f (1, 1, 1); + mcdc005a (1, 0, 1); mcdc005b (1, 1, 0, 0);