From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 51CAA3858D35; Mon, 9 Oct 2023 12:35:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 51CAA3858D35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1696854903; bh=AHgSqSLwaO/dZP0T0eqluFAc4NmwAVJqNAmkbuJbIPI=; h=From:To:Subject:Date:From; b=GbtjcqNXVs2W8MKo6oy7HEMU4Btn8Mrm0pN0dz641rxc0GKD/km2V1+NYqhR+qpBa vaYjxKJnrwH0dlkFLbvSGKUtvOwSD9kf0aVuDDxxkpT5qhNFU3z09U2LHQeZkTJ8I0 Kor0kqY6PKSHARgnOytlyXB5OCdQCBUpQOAfj/ZU= From: "iamanonymous.cs at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/111738] New: incorrect code when PGO is enabled Date: Mon, 09 Oct 2023 12:35:02 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: iamanonymous.cs at gmail dot com 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: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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=3D111738 Bug ID: 111738 Summary: incorrect code when PGO is enabled Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: iamanonymous.cs at gmail dot com Target Milestone: --- ***************************************************************************= **** OS and Platform: $ uname -a: Linux ubuntu 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux ***************************************************************************= **** gcc version: $ gcc -v Using built-in specs. COLLECT_GCC=3D/root/gcc_set/new_gcc/bin/gcc COLLECT_LTO_WRAPPER=3D/root/gcc_set/new_gcc/libexec/gcc/x86_64-pc-linux-gnu= /14.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc/configure --prefix=3D/root/gcc_set/new_gcc --with-gmp=3D/root/build_essential --with-mpfr=3D/root/build_essential --with-mpc=3D/root/build_essential --enable-languages=3Dc,c++ --disable-mul= tilib Thread model: posix Supported LTO compression algorithms: zlib gcc version 14.0.0 20230719 (experimental) (GCC) git version:85da0b40538fb0d17d89de1e7905984668e3dfef ***************************************************************************= **** Program: $ cat a.c a =3D 4, b =3D 0, d =3D 0, e =3D 0, f =3D 0; **c =3D &b; *g =3D &a; h() { i(); if (f) e =3D 0; } i() { float j =3D 0; int **k =3D &b; *k =3D &j; *g |=3D **c; if (*g) ; else { long *l =3D d =3D (*l)++; } } main() { h(); printf("%d\n", a); } ***************************************************************************= **** Command Lines: # The profile directory is used to save profile information. $ gcc -O3 -w -fprofile-generate=3Dprofile a.c -o a.out $ ./a.out 4 $ gcc -O3 -w -fprofile-use=3Dprofile -Wno-missing-profile -fprofile-correct= ion a.c=20=20 -o a.out $ ./a.out 32764 We can found that, the output of the executable is incorrect when the profi= le guided optimization is enabled.=