public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "iamanonymous.cs at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/111739] New: incorrect code with PGO enabled Date: Mon, 09 Oct 2023 12:50:54 +0000 [thread overview] Message-ID: <bug-111739-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111739 Bug ID: 111739 Summary: incorrect code with PGO 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=/root/gcc_set/new_gcc/bin/gcc COLLECT_LTO_WRAPPER=/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=/root/gcc_set/new_gcc --with-gmp=/root/build_essential --with-mpfr=/root/build_essential --with-mpc=/root/build_essential --enable-languages=c,c++ --disable-multilib Thread model: posix Supported LTO compression algorithms: zlib gcc version 14.0.0 20230719 (experimental) (GCC) git version:85da0b40538fb0d17d89de1e7905984668e3dfef ******************************************************************************* Program: $ cat a.c c, d, e, a; union { int f; short g } h; *j = &h; k(short l, short m) { return m == 0 || l && m == 1 ?: l / m; } n(l) { return c == 0 ?: l / c; } main() { a = n(h.f++); *j = 0; int i = 0; for (; i < 2; i++) d = k(h.g || 0, 59376); short *b = &h; *b ^= e; printf("%d\n", h); } ******************************************************************************* Command Lines: # The profile directory is used to save profile information. $ gcc -O3 -w -fprofile-generate=profile a.c -o a.out $ ./a.out 0 $ gcc -O3 -w -fprofile-use=profile -Wno-missing-profile -fprofile-correction a.c -o a.out $ ./a.out 1 We can found that, the output of the executable is incorrect when the profile guided optimization is enabled.
next reply other threads:[~2023-10-09 12:50 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-10-09 12:50 iamanonymous.cs at gmail dot com [this message] 2023-10-09 13:17 ` [Bug tree-optimization/111739] " rguenth at gcc dot gnu.org 2023-10-09 13:34 ` iamanonymous.cs at gmail dot com 2023-10-19 1:37 ` pinskia at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-111739-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).