From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A7666385624C; Wed, 27 Sep 2023 08:03:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A7666385624C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1695801838; bh=tNyNtgPid9GcnYZkuV8X0r9so6DZXtfTxQi5rj50CuA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ETKz3Gh+05UCyxJuIPL8CqWFgkyjtBCXK4CFX01CnnrtuOIb+l7OWitKpNaETefDF Euq9hzVlyr4HnhdPbGp2IX1XWAdWeSlSoZ9y4+WUu6Y+yW8Cyg/Wg5HuWIPeWOLYHO v/vvAzR3WvO3ofRxEHpvO8sXbvdxGc8Yw3OxMk2I= From: "slyfox at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug gcov-profile/111559] [14 regression] ICE when building Python with PGO Date: Wed, 27 Sep 2023 08:03:56 +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: 14.0 X-Bugzilla-Keywords: ice-checking, ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: slyfox at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 14.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: 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=3D111559 --- Comment #4 from Sergei Trofimovich --- Looks like identical code folding creates uninitialized profile counters if there are any edges in folded functions. I think cvise did a decent job extracting the reproducer below. Here is a single-file trigger on `--enable-checking=3Dyes` `gcc` from `master`: ``` // $ cat bug.c __attribute__((noipa)) static void edge(void) {} static void rule1(int *p) { edge(); if (*p) edge(); } static void rule1_same(int *p) { edge(); if (*p) edge(); } __attribute__((noipa)) int main(void) { int p =3D 0; rule1(&p); rule1_same(&p); } ``` Trigger: ``` $ echo PG $ gcc -O2 -fprofile-generate bug.c -o b -fopt-info $ echo RUN $ ./b $ echo PU $ gcc -O2 -fprofile-use -fprofile-correction bug.c -o b -fopt-info ``` Running: ``` PG $ gcc -O2 -fprofile-generate bug.c -o b -fopt-info bug.c:15:5: optimized: Inlined rule1.constprop/28 into main/3 which now has time 75.280000 and size 51, net change of -6. bug.c:16:5: optimized: Inlined rule1_same.constprop/27 into main/3 which n= ow has time 94.560000 and size 72, net change of -6. RUN $ ./b PU $ gcc -O2 -fprofile-use -fprofile-correction bug.c -o b -fopt-info bug.c:3:13: optimized: Semantic equality hit:rule1/1->rule1_same/2 bug.c:3:13: optimized: Assembler symbol names:rule1/1->rule1_same/2 bug.c:15:5: optimized: Inlined rule1.constprop/5 into main/3 which now has time 26.000000 and size 10, net change of +2. bug.c:16:5: optimized: Inlined rule1.constprop/4 into main/3 which now has time 27.000000 and size 12, net change of -6. bug.c: In function 'main': bug.c:13:28: error: probability of edge 3->4 not initialized 13 | __attribute__((noipa)) int main(void) { | ^~~~ bug.c:13:28: error: probability of edge 5->6 not initialized during IPA pass: inline bug.c:13:28: internal compiler error: verify_flow_info failed ```=