From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0C8333858D1E; Mon, 6 Feb 2023 09:20:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0C8333858D1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1675675235; bh=+G+XObzEvt3broXxI+kuEswew3ak6lBld2xN8AuyRRg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=XMhAn6sdr3KHL5sBxTcpfEvPXiecn0493vMLc13JVvH4x2KX9rrO6HFYOZ8IKiZ7N /jsqlTG4aYZfIy0IH6R1h+ho6kl/wkPVUguLyKVYkjzIs8RSKGYjC8YihoBFpCLgCZ heMBjc69vbEosXzJsG9NgD7ecNjprdIm7xS2V8CA= From: "marxin at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug gcov-profile/108658] [GCOV] Function entry is not recorded in a function containing an infinite loop from another thread depending on the optimization level Date: Mon, 06 Feb 2023 09:20:33 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: gcov-profile X-Bugzilla-Version: 12.2.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: marxin at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc bug_status cf_reconfirmed_on everconfirmed Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D108658 Martin Li=C5=A1ka changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rguenth at gcc dot gnu.org Status|UNCONFIRMED |NEW Last reconfirmed| |2023-02-06 Ever confirmed|0 |1 --- Comment #5 from Martin Li=C5=A1ka --- Well, with -O2 it's dead-code elimination pass that removes the GCOV counter stores: void * idle (void * ignored) { long int __gcov0.idle_I_lsm.4; long int PROF_edge_counter_2; [local count: 10631108]: __gcov0.idle_I_lsm.4_7 =3D __gcov0.idle[0]; [local count: 1073741824]: # __gcov0.idle_I_lsm.4_6 =3D PHI <__gcov0.idle_I_lsm.4_7(2), PROF_edge_counter_2(4)> PROF_edge_counter_2 =3D __gcov0.idle_I_lsm.4_6 + 1; [local count: 1073741824]: goto ; [100.00%] } after: Eliminating unnecessary statements: Deleting : PROF_edge_counter_2 =3D __gcov0.idle_I_lsm.4_6 + 1; Deleting : __gcov0.idle_I_lsm.4_6 =3D PHI <__gcov0.idle_I_lsm.4_7(2), _2(4)> Deleting : __gcov0.idle_I_lsm.4_7 =3D __gcov0.idle[0]; Removed 2 of 2 statements (100%) Removed 1 of 2 PHI nodes (50%) Merging blocks 3 and 4 fix_loop_structure: fixing up loops for function void * idle (void * ignored) { long int __gcov0.idle_I_lsm.4; [local count: 10631108]: [local count: 1073741824]: goto ; [100.00%] } @Richi: is it expected behavior?=