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

            Bug ID: 110376
           Summary: Wrong code at -O1 on x86_64-linux-gnu
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: shaohua.li at inf dot ethz.ch
  Target Milestone: ---

This seems to be a recent regression bug. gcc at -O1 produces wrong code.

Compiler explorer: https://godbolt.org/z/EnMfs9oxe

$ cat a.c
int f, g, a, c;
char k = 204;
char *l = &k;
short m, n;
static long b;
unsigned *h = &c;
unsigned **i = &h;
int p(char *aa) {
  aa[0] && aa[1] && aa[2];
  return 1;
}
int q(char c) {
  char d[] = {c};
  int e = p(d);
  return e;
}
int r(int j, int h) {
  f = h / 4;
  g = f * 6;
  return g;
}
short s() { return **i; }
void t() {
  for (; r(9, *l) <= 1;) {
    int j;
    long *o = &b;
    *o = 0 >= 0;
    for (; q(0) + a > 1; a++)
      *o = 0 > m;
    j = s();
    for (; a;)
      n = j;
    for (; (char)(1 + k + b) + k; --k)
      ;
  }
}
int main() { t(); }
$
$ gcc-tk -O0 a.c &&./a.out
$
$ gcc-tk -O1 a.c &&./a.out
Killed - processing time exceeded
$
$ gcc-tk -v
Using built-in specs.
COLLECT_GCC=gcc-tk
COLLECT_LTO_WRAPPER=/zdata/shaoli/compilers/ccbuilder-compilers/gcc-577223aebc7acdd31e62b33c1682fe54a622ae27/libexec/gcc/x86_64-pc-linux-gnu/14.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure --disable-multilib --disable-bootstrap
--enable-languages=c,c++
--prefix=/zdata/shaoli/compilers/ccbuilder-compilers/gcc-577223aebc7acdd31e62b33c1682fe54a622ae27
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.0 20230621 (experimental) (GCC)
$

Reply via email to