public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/111738] New: incorrect code when PGO is enabled
@ 2023-10-09 12:35 iamanonymous.cs at gmail dot com
  2023-10-09 13:14 ` [Bug tree-optimization/111738] " rguenth at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: iamanonymous.cs at gmail dot com @ 2023-10-09 12:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111738

            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=/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
a = 4, b = 0, d = 0, e = 0, f = 0;
**c = &b;
*g = &a;
h() {
  i();
  if (f)
    e = 0;
}
i() {
  float j = 0;
  int **k = &b;
  *k = &j;
  *g |= **c;
  if (*g)
    ;
  else {
    long *l = d = (*l)++;
  }
}
main() {
  h();
  printf("%d\n", a);
}
*******************************************************************************
Command Lines:
# The profile directory is used to save profile information.
$ gcc -O3 -w -fprofile-generate=profile a.c -o a.out
$ ./a.out
4
$ gcc -O3 -w -fprofile-use=profile -Wno-missing-profile -fprofile-correction
a.c  
 -o a.out
$ ./a.out
32764

We can found that, the output of the executable is incorrect when the profile
guided optimization is enabled.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-10-19  1:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-09 12:35 [Bug tree-optimization/111738] New: incorrect code when PGO is enabled iamanonymous.cs at gmail dot com
2023-10-09 13:14 ` [Bug tree-optimization/111738] " rguenth at gcc dot gnu.org
2023-10-09 13:38 ` iamanonymous.cs at gmail dot com
2023-10-10  1:50 ` iamanonymous.cs at gmail dot com
2023-10-19  1:26 ` pinskia at gcc dot gnu.org

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).