public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/102446] New: wrong code at -O3 on x86_64-linux-gnu
@ 2021-09-22  9:00 zhendong.su at inf dot ethz.ch
  2021-09-22 10:50 ` [Bug tree-optimization/102446] " rguenth at gcc dot gnu.org
                   ` (18 more replies)
  0 siblings, 19 replies; 21+ messages in thread
From: zhendong.su at inf dot ethz.ch @ 2021-09-22  9:00 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 102446
           Summary: wrong code at -O3 on x86_64-linux-gnu
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zhendong.su at inf dot ethz.ch
  Target Milestone: ---

This seems to be a long-latent miscompilation, affecting GCC 5.1 and later.

[583] % gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/local/suz-local/software/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --disable-bootstrap
--prefix=/local/suz-local/software/local/gcc-trunk --enable-languages=c,c++
--disable-werror --enable-multilib --with-system-zlib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210922 (experimental) [master r12-3777-g578b7687338] (GCC)
[584] %
[584] % gcctk -O2 small.c; ./a.out
[585] %
[585] % gcctk -O3 small.c
[586] % ./a.out
Segmentation fault
[587] %
[587] % cat small.c
int a = 1, c, e, f, *j, k, o, *r = &f, s;
char b, l;
short d, *g;
unsigned h;
static void m(void);
static void n(int);
void p(int *q) {
  while (1) {
    if (*q)
      break;
    if (*g)
      o = c;
    while (l)
      ;
  }
}
void t() {
  for (; s < 8; s++)
    m();
}
void m() {
  int aa = 0, i = 0;
  for (; i < 3; i++)
    if (k < 0)
      aa |= *j;
  if (d)
    c = (h + *g + 2) & c;
  n(aa);
}
void n(int ac) {
  char *ad = &b, u = ac, *v = &b;
  int ae = *ad = a;
  u && (*v = e > 0);
  *r = c;
  p(&ae);
}
int main() {
  t();
  return 0;
}

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

end of thread, other threads:[~2023-07-07 10:41 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-22  9:00 [Bug tree-optimization/102446] New: wrong code at -O3 on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
2021-09-22 10:50 ` [Bug tree-optimization/102446] " rguenth at gcc dot gnu.org
2021-09-22 10:54 ` [Bug tree-optimization/102446] [9/10/11/12 Regression] " jakub at gcc dot gnu.org
2021-09-22 10:56   ` Jan Hubicka
2021-09-22 10:56 ` rguenth at gcc dot gnu.org
2021-09-22 10:56 ` hubicka at ucw dot cz
2021-09-22 10:57 ` [Bug rtl-optimization/102446] " rguenth at gcc dot gnu.org
2021-09-22 10:57 ` rguenth at gcc dot gnu.org
2021-09-22 11:01 ` jakub at gcc dot gnu.org
2021-09-22 11:02 ` jakub at gcc dot gnu.org
2021-09-22 11:11 ` pinskia at gcc dot gnu.org
2021-09-22 11:29 ` jakub at gcc dot gnu.org
2022-01-30  2:04 ` pinskia at gcc dot gnu.org
2022-01-30 12:34 ` jakub at gcc dot gnu.org
2022-01-30 20:48 ` pinskia at gcc dot gnu.org
2022-05-27  9:46 ` [Bug rtl-optimization/102446] [10/11/12/13 " rguenth at gcc dot gnu.org
2022-06-28 10:46 ` jakub at gcc dot gnu.org
2022-07-29 12:22 ` [Bug rtl-optimization/102446] [10/11 " rguenth at gcc dot gnu.org
2022-07-29 12:44 ` jakub at gcc dot gnu.org
2022-07-29 12:45 ` jakub at gcc dot gnu.org
2023-07-07 10:41 ` [Bug rtl-optimization/102446] [11 " rguenth 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).