[Bug ipa/99373] New: [missed optimization] dead code not eliminated from short circuiting

2021-03-03 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99373

Bug ID: 99373
   Summary: [missed optimization] dead code not eliminated from
short circuiting
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ipa
  Assignee: unassigned at gcc dot gnu.org
  Reporter: zhendong.su at inf dot ethz.ch
CC: marxin at gcc dot gnu.org
  Target Milestone: ---

[538] % 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/11.0.1/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 11.0.1 20210303 (experimental) [master revision
d97a92dca90:bc15d73426f:9b2084db9f9917eb9b19b1eb5ec03cdcb05f349e] (GCC) 
[539] % 
[539] % gcctk -O3 -S -o small.s small.c
[540] % 
[540] % cat small.c
extern void foo();

struct a {
  int b;
  long c;
} g;
static int d = 1;
int e, *f, *h;
long *i;

static long j() {
  struct a k;
  struct a *m = &g;
  struct a **n[] = {&m};
  long **l = 0;
  int o[42];
  foo();
  int p[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
  int *d[] = {&p[3]};
  i = &k.c;
  long ***a[] = {&l};
  int b[5];
  f = &b[3];
  if (e)
while (1)
  h = &o[7];
  return 0;
}
int main() {
  d || j();
  return 0;
}
[541] % 
[541] % cat small.s
.file   "small.c"
.text
.p2align 4
.type   j.isra.0, @function
j.isra.0:
.LFB2:
.cfi_startproc
subq$56, %rsp
.cfi_def_cfa_offset 64
xorl%eax, %eax
callfoo
leaq8(%rsp), %rax
movq%rax, i(%rip)
leaq28(%rsp), %rax
movq%rax, f(%rip)
movle(%rip), %eax
testl   %eax, %eax
jne .L3
addq$56, %rsp
.cfi_remember_state
.cfi_def_cfa_offset 8
ret
.L3:
.cfi_restore_state
jmp .L3
.cfi_endproc
.LFE2:
.size   j.isra.0, .-j.isra.0
.section.text.startup,"ax",@progbits
.p2align 4
.globl  main
.type   main, @function
main:
.LFB1:
.cfi_startproc
xorl%eax, %eax
ret
.cfi_endproc
.LFE1:
.size   main, .-main
.globl  i
.bss
.align 8
.type   i, @object
.size   i, 8
i:
.zero   8
.globl  h
.align 8
.type   h, @object
.size   h, 8
h:
.zero   8
.globl  f
.align 8
.type   f, @object
.size   f, 8
f:
.zero   8
.globl  e
.align 4
.type   e, @object
.size   e, 4
e:
.zero   4
.globl  g
.align 16
.type   g, @object
.size   g, 16
g:
.zero   16
.ident  "GCC: (GNU) 11.0.1 20210303 (experimental) [master revision
d97a92dca90:bc15d73426f:9b2084db9f9917eb9b19b1eb5ec03cdcb05f349e]"
.section.note.GNU-stack,"",@progbits

[Bug ipa/99373] unused static function not being removed in some cases after optimization

2021-03-04 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99373

--- Comment #2 from Zhendong Su  ---
The following might be the same/related. The dead call is eliminated if b is
changed to:

static int b(int *c) {
foo();
d++;
}

[623] % gcctk -O3 -S small.c
[624] %
[624] % cat small.c
extern void foo(void);

static int a, d;

static int b(int *c) {
  while (1) {
foo();
d++;
  }
}

int main () {
  a && b(&a);
  return 0;
}
[625] %
[625] % cat small.s
.file   "small.c"
.text
.section.text.startup,"ax",@progbits
.p2align 4
.globl  main
.type   main, @function
main:
.LFB1:  
.cfi_startproc
movla(%rip), %edx
testl   %edx, %edx
jne .L7
xorl%eax, %eax
ret
.L7:
pushq   %rax
.cfi_def_cfa_offset 16
.L3:
callfoo
addl$1, d(%rip)
jmp .L3
.cfi_endproc
.LFE1:  
.size   main, .-main
.local  d
.comm   d,4,4
.local  a
.comm   a,4,4
.ident  "GCC: (GNU) 11.0.1 20210304 (experimental) [master revision
cdfc2f6a6dc:ab3cea6cccd:f3641ac70eb0ae9f8983b7ddb1660c92439565de]"
.section.note.GNU-stack,"",@progbits

[Bug ipa/99419] New: possible missed optimization for dead code elimination

2021-03-05 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99419

Bug ID: 99419
   Summary: possible missed optimization for dead code elimination
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ipa
  Assignee: unassigned at gcc dot gnu.org
  Reporter: zhendong.su at inf dot ethz.ch
CC: marxin at gcc dot gnu.org
  Target Milestone: ---

[552] % 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/11.0.1/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 11.0.1 20210305 (experimental) [master revision
9ee91079fd5:70357716fd6:3d9577c254003f2d18185015b75ce6e3e4af9ca2] (GCC) 
[553] % 
[553] % gcctk -O3 -S small.c
[554] % 
[554] % cat small.c
extern void foo(void);

int a;
static int b[2] = {0,0};

int main() {
  if (b[a])
foo();
  return 0;
}
[555] % 
[555] % cat small.s
.file   "small.c"
.text
.section.text.startup,"ax",@progbits
.p2align 4
.globl  main
.type   main, @function
main:
.LFB0:
.cfi_startproc
movslq  a(%rip), %rax
movlb(,%rax,4), %ecx
testl   %ecx, %ecx
jne .L8
xorl%eax, %eax
ret
.L8:
pushq   %rax
.cfi_def_cfa_offset 16
callfoo
xorl%eax, %eax
popq%rdx
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE0:
.size   main, .-main
.section.rodata
.align 8
.type   b, @object
.size   b, 8
b:
.zero   8
.globl  a
.bss
.align 4
.type   a, @object
.size   a, 4
a:
.zero   4
.ident  "GCC: (GNU) 11.0.1 20210305 (experimental) [master revision
9ee91079fd5:70357716fd6:3d9577c254003f2d18185015b75ce6e3e4af9ca2]"
.section.note.GNU-stack,"",@progbits

[Bug tree-optimization/99428] New: possible missed optimization for dead code elimination

2021-03-05 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99428

Bug ID: 99428
   Summary: possible missed optimization for dead code elimination
   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: ---

[604] % 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/11.0.1/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 11.0.1 20210306 (experimental) [master revision
02a35548790:4487c1830cf:ceae9533826aabaf4c78d173c60e3bedeffc6955] (GCC)
[605] %
[605] % gcctk -O3 -S small.c
[606] %
[606] % cat small.c
extern void foo(void);

static int a;
static int *b = &a;

int main() {
  if (*b)
foo();
  return 0;
}
[607] %
[607] % cat small.s
.file   "small.c"
.text
.section.text.startup,"ax",@progbits
.p2align 4
.globl  main
.type   main, @function
main:
.LFB0:  
.cfi_startproc
movla(%rip), %ecx
testl   %ecx, %ecx
jne .L8
xorl%eax, %eax
ret
.L8:
pushq   %rax
.cfi_def_cfa_offset 16
callfoo
xorl%eax, %eax
popq%rdx
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE0:  
.size   main, .-main
.local  a
.comm   a,4,4
.ident  "GCC: (GNU) 11.0.1 20210306 (experimental) [master revision
02a35548790:4487c1830cf:ceae9533826aabaf4c78d173c60e3bedeffc6955]"
.section.note.GNU-stack,"",@progbits

[Bug tree-optimization/99751] New: wrong code at -O1

2021-03-24 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99751

Bug ID: 99751
   Summary: wrong code at -O1
   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: ---

[549] % 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/11.0.1/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 11.0.1 20210324 (experimental) [master revision
be70bb5e4ba:220fd7ed5f2:bf1f3168f474734400e7a97660d1e7dec664bca9] (GCC) 
[550] % 
[550] % gcctk -O0 small.c; ./a.out
[551] % 
[551] % gcctk -O1 small.c
[552] % ./a.out
Aborted
[553] % 
[553] % cat small.c
int *a, **c = &a;
int *b(int *d) { return d; }
void e(int *d) { *c = b(d); }
int main() {
  int f = (e(&f), 0);
  if (a != &f)
__builtin_abort();
  return 0;
}

[Bug ipa/99776] New: missed optimization for dead code elimination at -O3 (vs. -O1)

2021-03-25 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99776

Bug ID: 99776
   Summary: missed optimization for dead code elimination at -O3
(vs. -O1)
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ipa
  Assignee: unassigned at gcc dot gnu.org
  Reporter: zhendong.su at inf dot ethz.ch
CC: marxin at gcc dot gnu.org
  Target Milestone: ---

[687] % 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/11.0.1/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 11.0.1 20210325 (experimental) [master revision
08103e4d6ad:4e4f8ee0bf5:a29124d28253cdf603ba1977db2f09c9f233fea5] (GCC) 
[688] % 
[688] % gcctk -O1 -S -o small_O1.s small.c
[689] % gcctk -O3 -S -o small_O3.s small.c
[690] % 
[690] % wc small_O1.s small_O3.s 
  23   52  455 small_O1.s
  37   82  682 small_O3.s
  60  134 1137 total
[691] % 
[691] % grep foo small_O1.s 
[692] % grep foo small_O3.s 
callfoo
[693] % 
[693] % cat small.c
extern void foo(void);

static int a[2], b, *c[2];

int main() {
  for (b = 0; b < 2; b++)
c[b] = &a[1];
  if (!c[0])
foo();
  return 0;
}

[Bug tree-optimization/99776] missed optimization for dead code elimination at -O3 (vs. -O1)

2021-03-26 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99776

--- Comment #3 from Zhendong Su  ---
Awesome!  Thanks for looking into this so quickly, Richard!

[Bug ipa/99788] New: missed optimization for dead code elimination at -O3 (vs. -O1)

2021-03-26 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99788

Bug ID: 99788
   Summary: missed optimization for dead code elimination at -O3
(vs. -O1)
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ipa
  Assignee: unassigned at gcc dot gnu.org
  Reporter: zhendong.su at inf dot ethz.ch
CC: marxin at gcc dot gnu.org
  Target Milestone: ---

[606] % 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/11.0.1/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 11.0.1 20210326 (experimental) [master revision
9d45e848d02:ca344bbd24f:6081d8994ed1a0aef6b7f5fb34f091faa3580416] (GCC) 
[607] % 
[607] % gcctk -O1 -S -o O1.s small.c
[608] % gcctk -O3 -S -o O3.s small.c
[609] % 
[609] % wc O1.s O3.s
  79  162  986 O1.s
 109  229 1433 O3.s
 188  391 2419 total
[610] % 
[610] % grep foo O1.s
[611] % grep foo O3.s
callfoo
[612] % 
[612] % cat small.c
extern void foo(void);

char a;
int b, *c, g, h = 1, i = 1, j, *k = &i;

static void d();
static int *e() {
  for (a = 1; a; a = a+2)
;
  foo();
  h = (g % h) % i;
  *k = -j;
  return 0;
}
static void f() {
  if (b)
d(e);
}
void d() {
  for (;;)
c = e();
}
int main() {
  f();
  return 0;
}

[Bug tree-optimization/99793] New: missed optimization for dead code elimination at -Os, -O2 and -O3 (vs. -O1)

2021-03-26 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99793

Bug ID: 99793
   Summary: missed optimization for dead code elimination at -Os,
-O2 and -O3 (vs. -O1)
   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: ---

[610] % 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/11.0.1/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 11.0.1 20210326 (experimental) [master revision
9d45e848d02:ca344bbd24f:6081d8994ed1a0aef6b7f5fb34f091faa3580416] (GCC) 
[611] % 
[611] % gcctk -O1 -S -o O1.s small.c
[612] % gcctk -O3 -S -o O3.s small.c
[613] % 
[613] % wc O1.s O3.s
 17  38 365 O1.s
 37  78 633 O3.s
 54 116 998 total
[614] % 
[614] % grep foo O1.s
[615] % grep foo O3.s
callfoo
[616] % 
[616] % cat small.c
extern void foo(void);
static int a, *b = &a, c, *d = &c;
int main() {
  int **e = &d;
  if (!((unsigned)((*e = d) == 0) - (*b = 1)))
foo();
  return 0;
}

[Bug ipa/99834] New: missed optimization for dead code elimination at -O3 (vs. -O2)

2021-03-30 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99834

Bug ID: 99834
   Summary: missed optimization for dead code elimination at -O3
(vs. -O2)
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ipa
  Assignee: unassigned at gcc dot gnu.org
  Reporter: zhendong.su at inf dot ethz.ch
CC: marxin at gcc dot gnu.org
  Target Milestone: ---

[590] % 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/11.0.1/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 11.0.1 20210330 (experimental) [master revision
8aac913adfc:ff4ebc2f17c:65374af219f9c5c594951a07e766fe70c1136a1f] (GCC) 
[591] % 
[591] % gcctk -O2 -S -o O2.s small.c
[592] % gcctk -O3 -S -o O3.s small.c
[593] % 
[593] % wc O2.s O3.s
  43   90  704 O2.s
  61  126  950 O3.s
 104  216 1654 total
[594] % 
[594] % grep foo O2.s
[595] % grep foo O3.s
callfoo
callfoo
[596] % 
[596] % cat small.c
extern void foo(void);
static int a, b, c;
static int d() {
  for (a = 0; a < 1; a++)
b = 1;
  for (; b; b--)
for (; c; c--)
  ;
  return 0;
}
static void e() {
  if (d())
foo();
}
int main() {
  e();
  e();
  return 0;
}

[Bug tree-optimization/99835] New: missed optimization for dead code elimination at -O3 (vs. -O1)

2021-03-30 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99835

Bug ID: 99835
   Summary: missed optimization for dead code elimination at -O3
(vs. -O1)
   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: ---

[558] % 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/11.0.1/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 11.0.1 20210330 (experimental) [master revision
8aac913adfc:ff4ebc2f17c:65374af219f9c5c594951a07e766fe70c1136a1f] (GCC) 
[559] % 
[559] % gcctk -O1 -S -o O1.s small.c
[560] % gcctk -O3 -S -o O3.s small.c
[561] % 
[561] % wc O1.s O3.s
  23   45  420 O1.s
  35   66  615 O3.s
  58  111 1035 total
[562] % 
[562] % grep foo O1.s
[563] % grep foo O3.s
jmp foo
[564] % 
[564] % cat small.c
extern void foo(void);
static int a, d;
void b();
static int c() {
  foo();
  b();
}
void b() {
  while (d) {
if (!a)
  break;
c();
  }
}
int main() {
  b();
  return 0;
}

[Bug ipa/99834] missed optimization for dead code elimination at -O3 (vs. -O2)

2021-03-31 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99834

--- Comment #2 from Zhendong Su  ---
Hi Richard and all, thanks for analyzing these reports! 

I have some more cases, and wonder whether you folks would prefer that I open a
meta issue report and append these (and others that we find) to that report
(rather than filing these one by one). Thanks.

[Bug ipa/99862] New: [meta-issue] various missed optimizations for dead code elimination

2021-04-01 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99862

Bug ID: 99862
   Summary: [meta-issue] various missed optimizations for dead
code elimination
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ipa
  Assignee: unassigned at gcc dot gnu.org
  Reporter: zhendong.su at inf dot ethz.ch
CC: marxin at gcc dot gnu.org
  Target Milestone: ---

[561] % 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/11.0.1/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 11.0.1 20210401 (experimental) [master revision
e4bb1bd60a9:c23a685bf70:95d217ab52d31dc06fda42fc136dea165909e88b] (GCC) 
[562] % 
[562] % gcctk -O1 -S -o O1.s small.c
[563] % gcctk -O3 -S -o O3.s small.c
[564] % 
[564] % wc O1.s O3.s
  23   45  420 O1.s
  39   74  669 O3.s
  62  119 1089 total
[565] % 
[565] % grep foo O1.s
[566] % grep foo O3.s
callfoo
[567] % 
[567] % cat small.c
extern void foo(void);
static int a, b;
static int c() {
  foo();
  while (1)
while (b)
  foo();
}
void d() {
  if (a)
c();
}
int main() {
  d();
  return 0;
}

[Bug ipa/99862] [meta-issue] various missed optimizations for dead code elimination

2021-04-01 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99862

--- Comment #1 from Zhendong Su  ---
[578] % gcctk -O1 -S -o O1.s small.c
[579] % gcctk -O3 -S -o O3.s small.c
[580] % 
[580] % wc O1.s O3.s
  22   43  410 O1.s
  37   77  682 O3.s
  59  120 1092 total
[581] % 
[581] % grep foo O1.s
[582] % grep foo O3.s
callfoo
[583] % 
[583] % cat small.c
extern void foo(void);
static int a, b;
static void c() {
  if (a) {
foo();
for (; b < 1; b++)
  ;
  }
}
int main() {
  c();
  c();
  return 0;
}

[Bug ipa/99862] [meta-issue] various missed optimizations for dead code elimination

2021-04-01 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99862

--- Comment #2 from Zhendong Su  ---
[659] % gcctk -O1 -S -o O1.s small.c
[660] % gcctk -O3 -S -o O3.s small.c
[661] % 
[661] % wc O1.s O3.s
  40   86  599 O1.s
  68  138 1047 O3.s
 108  224 1646 total
[662] % 
[662] % grep foo O1.s
[663] % grep foo O3.s
callfoo
[664] % 
[664] % cat small.c
extern void foo(void);
int a, b, *c;
static void d(int f) {
  if (f)
foo();
}
static int e(int f) {
  int g[] = {2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2};
  int h[60];
  h[0] = g != c;
  if (b)
while (a) {
  int *i[1] = {&h[6]};
}
  return f;
}
static int *j(int *p) { return 0; }
int main () {
  int m = e(0);
  d(m);
  int l[8];
  if (j(l))
while (1)
  ;
  return 0;
}

[Bug ipa/99862] [meta-issue] various missed optimizations for dead code elimination

2021-04-02 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99862

--- Comment #4 from Zhendong Su  ---
(In reply to Eric Gallager from comment #3)
> generally meta-bugs are created to collect other issues under their "Depends
> On" field; do you have any other bug numbers to add here?

Hi Eric, no, I don't, but all these instances are related in the sense that
they all show missed optimizations for dead code. Instead of filing them
separately, I thought it might work better if I file them together as a meta
issue. 

If you folks prefer these being filed separately, I'm also happy to do so. 

Please just let me know whichever works better; thanks. 

(See also https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99834#c2)

[Bug tree-optimization/99943] New: wrong code at -Os

2021-04-06 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99943

Bug ID: 99943
   Summary: wrong code at -Os
   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: ---

[538] % 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/11.0.1/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 11.0.1 20210406 (experimental) [master revision
62321ab477e:8aa4f7b4faf:d48f87d5c1927b1bf2009af3251fe8757e823713] (GCC) 
[539] % 
[539] % gcctk -O1 small.c; ./a.out
[540] % 
[540] % gcctk -Os small.c
[541] % ./a.out
Aborted
[542] % 
[542] % cat small.c
char a;
int b, c[8];
int main() {
  for (; a < 8; a++) {
for (b = 0; b < 8; b++)
  c[a] = 1;
c[a] = 0;
  }
  if (c[0] != 0)
__builtin_abort ();
  return 0;
}

[Bug ipa/99986] New: missed optimization for dead code elimination at -O3 (vs. -O1)

2021-04-09 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99986

Bug ID: 99986
   Summary: missed optimization for dead code elimination at -O3
(vs. -O1)
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ipa
  Assignee: unassigned at gcc dot gnu.org
  Reporter: zhendong.su at inf dot ethz.ch
CC: marxin at gcc dot gnu.org
  Target Milestone: ---

[599] % 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/11.0.1/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 11.0.1 20210409 (experimental) [master revision
96292c3e343:4e14cad25b9:019a922063f26784d5a070d9198a1f937b8a8343] (GCC) 
[600] % 
[600] % gcctk -O1 -S -o O1.s small.c
[601] % gcctk -O3 -S -o O3.s small.c
[602] % 
[602] % wc O1.s O3.s
  38   86  669 O1.s
  48  107  845 O3.s
  86  193 1514 total
[603] % 
[603] % grep foo O1.s
[604] % grep foo O3.s
callfoo
[605] % 
[605] % cat small.c
extern void foo(void);
static int a, *b[8] = {&a}, **c[8];
static void d() {
  int e = 0;
  for (; e < 8; e++)
c[e] = &b[1];
  if (!c[0])
foo();
}
int main() {
  if (a)
d();
  return 0;
}

[Bug ipa/99987] New: missed optimization for dead code elimination at -O3 (vs. -O2)

2021-04-09 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99987

Bug ID: 99987
   Summary: missed optimization for dead code elimination at -O3
(vs. -O2)
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ipa
  Assignee: unassigned at gcc dot gnu.org
  Reporter: zhendong.su at inf dot ethz.ch
CC: marxin at gcc dot gnu.org
  Target Milestone: ---

[748] % 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/11.0.1/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 11.0.1 20210409 (experimental) [master revision
96292c3e343:4e14cad25b9:019a922063f26784d5a070d9198a1f937b8a8343] (GCC) 
[749] % 
[749] % 
[749] % gcctk -O2 -S -o O2.s small.c
[750] % gcctk -O3 -S -o O3.s small.c
[751] % 
[751] % wc O2.s O3.s
  68  150  961 O2.s
  89  195 1278 O3.s
 157  345 2239 total
[752] % 
[752] % grep foo O2.s
[753] % grep foo O3.s
callfoo
[754] % 
[754] % cat small.c
extern void foo(void);
static int a[8] = {0,0,0,0,0,0,0,0};
int b, c, j;
static int *e(int k) {
  if (k && b)
j = 0;
  while (j)
if (!k)
  foo();
  return 0;
}
static void d() {
  long g;
  unsigned h = 8;
  if (b)
for (g = 2; 1; g--) {
  int i = 0;
  h--;
  c = (a[g] == (&i != e(h)));
}
}
void f() { d(); }

[Bug tree-optimization/99986] missed optimization for dead code elimination at -O3 (vs. -O1)

2021-04-09 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99986

--- Comment #2 from Zhendong Su  ---
(In reply to Richard Biener from comment #1)
> I think this is a duplicate of PR99776 since I can't reproduce with this fix
> in.

Thanks for looking into it, Richard! 

Would you mind also checking the few tests for
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99862
whenever you get a chance? 

I'm happy to file them as separate reports if that would be more convenient.

Thank you.

[Bug ipa/99862] [meta-issue] various missed optimizations for dead code elimination

2021-04-09 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99862

--- Comment #9 from Zhendong Su  ---
> For the future please open separate bugs for separate testcases.

Thanks, Richard; will do.

[Bug tree-optimization/100033] New: missed optimization for dead code elimination at -O3 (vs. -O2)

2021-04-11 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100033

Bug ID: 100033
   Summary: missed optimization for dead code elimination at -O3
(vs. -O2)
   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: ---

[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/11.0.1/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 11.0.1 20210411 (experimental) [master revision
1d54b138417:e83b9cf4549:936d500dfc17f58f2507ecd0f7f26e4f197052ee] (GCC) 
[584] % 
[584] % gcctk -O2 -S -o O2.s small.c
[585] % gcctk -O3 -S -o O3.s small.c
[586] % 
[586] % wc O2.s O3.s
  52  112  797 O2.s
  56  119  850 O3.s
 108  231 1647 total
[587] % 
[587] % grep foo O2.s
[588] % grep foo O3.s
callfoo
[589] % 
[589] % cat small.c
extern void foo(void);
static volatile int a;
int b, i;
static void c() {
  unsigned d = i;
  a = d && a;
  if (d) {
int e;
while (b) {
  int *f, *g = &e, **h = &f;
  *h = g;
  *f = d;
}
if (!e)
  foo();
  }
}
int main() {
  c();
  return 0;
}

[Bug ipa/100034] New: missed optimization for dead code elimination at -O3 (vs. -O1, -Os, -O2)

2021-04-11 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100034

Bug ID: 100034
   Summary: missed optimization for dead code elimination at -O3
(vs. -O1, -Os, -O2)
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ipa
  Assignee: unassigned at gcc dot gnu.org
  Reporter: zhendong.su at inf dot ethz.ch
CC: marxin at gcc dot gnu.org
  Target Milestone: ---

[641] % 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/11.0.1/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 11.0.1 20210411 (experimental) [master revision
1d54b138417:e83b9cf4549:936d500dfc17f58f2507ecd0f7f26e4f197052ee] (GCC) 
[642] % 
[642] % gcctk -O1 -S -o O1.s small.c
[643] % gcctk -O3 -S -o O3.s small.c
[644] % 
[644] % wc O1.s O3.s
  23   45  420 O1.s
  41   78  697 O3.s
  64  123 1117 total
[645] % 
[645] % grep foo O1.s
[646] % grep foo O3.s
callfoo
[647] % 
[647] % cat small.c
extern void foo(void);
static int a, b, f, g;
static int d() {
  while (g)
f = 0;
  while (1)
foo();
}
static void c() { d (); }
void e() {
  while (b) {
if (!a)
  continue;
c();
  }
}
int main() {
  e();
  return 0;
}

[Bug ipa/100036] New: missed optimization for dead code elimination at -Os, -O2 and -O3 (vs. -O1)

2021-04-11 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100036

Bug ID: 100036
   Summary: missed optimization for dead code elimination at -Os,
-O2 and -O3 (vs. -O1)
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ipa
  Assignee: unassigned at gcc dot gnu.org
  Reporter: zhendong.su at inf dot ethz.ch
CC: marxin at gcc dot gnu.org
  Target Milestone: ---

[562] % 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/11.0.1/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 11.0.1 20210411 (experimental) [master revision
1d54b138417:e83b9cf4549:936d500dfc17f58f2507ecd0f7f26e4f197052ee] (GCC) 
[563] % 
[563] % gcctk -O1 -S -o O1.s small.c
[564] % gcctk -O3 -S -o O3.s small.c
[565] % 
[565] % wc O1.s O3.s
  27   58  454 O1.s
  38   77  665 O3.s
  65  135 1119 total
[566] % 
[566] % grep foo O1.s
[567] % grep foo O3.s
jmp foo
[568] % 
[568] % cat small.c
extern void foo(void);
int a, *b;
static int c, f;
inline int *d() {
  int g[100] = {0};
  if (a) {
int h = g[0];
foo();
return b;
  }
}
int main() {
  while (1) {
if (!c)
  return f;
d();
  }
  return 0;
}

[Bug tree-optimization/100050] New: missed optimization for dead code elimination at -O3 (vs. -O1, -Os, -O2)

2021-04-12 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100050

Bug ID: 100050
   Summary: missed optimization for dead code elimination at -O3
(vs. -O1, -Os, -O2)
   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: ---

[598] % 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/11.0.1/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 11.0.1 20210412 (experimental) [master revision
46c47420a5f:66634f1d5eb:8f17d44ad986e0ae7e81c81179463000ee9d7f43] (GCC) 
[599] % 
[599] % gcctk -O1 -S -o O1.s small.c
[600] % gcctk -O3 -S -o O3.s small.c
[601] % 
[601] % wc O1.s O3.s
  19   44  412 O1.s
  35   77  683 O3.s
  54  121 1095 total
[602] % 
[602] % grep foo O1.s
[603] % grep foo O3.s
callfoo
[604] % 
[604] % cat small.c
extern void foo(void);
static int *a[2];
int main() {
  int c = 0;
  for (; c < 2; c++)
a[c] = &c;
  if (!a[0])
foo();
  return 0;
}

[Bug tree-optimization/100051] New: missed optimization for dead code elimination at -Os, -O2 and -O3 (vs. -O1)

2021-04-12 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100051

Bug ID: 100051
   Summary: missed optimization for dead code elimination at -Os,
-O2 and -O3 (vs. -O1)
   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: ---

[719] % 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/11.0.1/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 11.0.1 20210412 (experimental) [master revision
46c47420a5f:66634f1d5eb:8f17d44ad986e0ae7e81c81179463000ee9d7f43] (GCC) 
[720] % 
[720] % gcctk -O1 -S -o O1.s small.c
[721] % gcctk -O3 -S -o O3.s small.c
[722] % 
[722] % wc O1.s O3.s
  56  121  784 O1.s
  68  148  996 O3.s
 124  269 1780 total
[723] % 
[723] % grep foo O1.s
[724] % grep foo O3.s
callfoo
[725] % 
[725] % cat small.c
extern void foo(void);
int a, c, *f, **d = &f;
char b;
static void e() {
  if ((2 ^ b) == 0)
foo();
}
int main() {
  if (a) {
b = 0;
int *g = &c;
*g = 0;
f = *d;
*d = f;
e();
  }
  return 0;
}

[Bug tree-optimization/100080] New: missed optimization for dead code elimination at -O3 (vs. -O2)

2021-04-14 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100080

Bug ID: 100080
   Summary: missed optimization for dead code elimination at -O3
(vs. -O2)
   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: ---

[604] % 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/11.0.1/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 11.0.1 20210414 (experimental) [master revision
006783f4b16:29da9c11552:0589be0c59767cf4cbb0ef0e7d918cf6aa3d606c] (GCC) 
[605] % 
[605] % gcctk -O2 -S -o O2.s small.c
[606] % gcctk -O3 -S -o O3.s small.c
[607] % 
[607] % wc O2.s O3.s
  68  147  999 O2.s
  95  202 1373 O3.s
 163  349 2372 total
[608] % 
[608] % grep foo O2.s
[609] % grep foo O3.s
callfoo
[610] % 
[610] % cat small.c
extern void foo(void);
int a, b, d, f;
static unsigned c;
void e(int g, int *k) {
  int h, *i = &b, *j = &b;
  *i = g;
  c = &b == i;
  d = c >= (*j = b | *k) && b & (*i == 0);
  h = a ? 0 : d;
  if (h)
foo();
}
int main() {
  while (f) {
int l;
e(1, &l);
  }
  return 0;
}

[Bug tree-optimization/100082] New: missed optimization for dead code elimination at -O3 (vs. -O2)

2021-04-14 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100082

Bug ID: 100082
   Summary: missed optimization for dead code elimination at -O3
(vs. -O2)
   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: ---

[528] % 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/11.0.1/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 11.0.1 20210414 (experimental) [master revision
006783f4b16:29da9c11552:0589be0c59767cf4cbb0ef0e7d918cf6aa3d606c] (GCC) 
[529] % 
[529] % gcctk -O2 -S -o O2.s small.c
[530] % gcctk -O3 -S -o O3.s small.c
[531] % 
[531] % wc O2.s O3.s
 101  229 1393 O2.s
 145  329 2038 O3.s
 246  558 3431 total
[532] % 
[532] % grep foo O2.s
[533] % grep foo O3.s
callfoo
[534] % 
[534] % cat small.c
extern void foo(void);
volatile int a, b, h;
int *c, d[4], f, i, j;
long g;
static unsigned e() {
  int k;
  while (b) {
for (k = 0; k < 4; k++) {
  d[k] && a;
  h = j ? 0 : i;
}
*c = 0;
  }
  return 0;
}
int main() {
  for (f = 0; f < 5; f++)
g = 1;
  if (!e() ^ g)
foo();
  return 0;
}

[Bug tree-optimization/100095] New: missed optimization for dead code elimination at -O3 (vs. -O2)

2021-04-15 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100095

Bug ID: 100095
   Summary: missed optimization for dead code elimination at -O3
(vs. -O2)
   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: ---

[654] % 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/11.0.1/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 11.0.1 20210415 (experimental) [master revision
4dd9e1c541e:7315804b0a0:b5f644a98b3f3543d3a8d2dfea7785c22879013f] (GCC) 
[655] % 
[655] % gcctk -O2 -S -c -o O2.s small.c
[656] % gcctk -O3 -S -c -o O3.s small.c
[657] % 
[657] % wc O2.s O3.s
  75  164  982 O2.s
 121  269 1617 O3.s
 196  433 2599 total
[658] % 
[658] % grep foo O2.s
[659] % grep foo O3.s
jmp foo
[660] % 
[660] % cat small.c
extern void foo(void);
int a, b, c, d, g, h;
static int *e = &d;
volatile int f;
void i() {
  for (d = 5; d >= 0; d--)
for (c = 0; c < 4; c++)
  while (1) {
h = b ? a % b : 0;
if (g)
  f;
if (*e)
  break;
  }
  foo();
}

[Bug ipa/100100] New: missed optimization for dead code elimination at -O3 (vs. -O1, -Os, -O2)

2021-04-15 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100100

Bug ID: 100100
   Summary: missed optimization for dead code elimination at -O3
(vs. -O1, -Os, -O2)
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ipa
  Assignee: unassigned at gcc dot gnu.org
  Reporter: zhendong.su at inf dot ethz.ch
CC: marxin at gcc dot gnu.org
  Target Milestone: ---

[538] % 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/11.0.1/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 11.0.1 20210415 (experimental) [master revision
4dd9e1c541e:7315804b0a0:b5f644a98b3f3543d3a8d2dfea7785c22879013f] (GCC) 
[539] % 
[539] % gcctk -O1 -S -o O1.s small.c
[540] % gcctk -O3 -S -o O3.s small.c
[541] % 
[541] % wc O1.s O3.s
  79  175 1126 O1.s
  98  196 1466 O3.s
 177  371 2592 total
[542] % 
[542] % grep foo O1.s
[543] % grep foo O3.s
jmp foo
[544] % 
[544] % cat small.c
extern void foo(void);
static int a, d, e, h, o, p;
static short b, c, f, *i = &b;
static char g;
static void l() {
  d = 0;
  for (; d < 4; d++)
for (; f; f++)
  c = 0;
  for (; c; c++)
;
}
static void k(unsigned short q) {
  l();
  for (; g; g++)
h = e == p;
}
static void j(int q) {
  k(q);
  unsigned char m = q;
  o = m;
  if (m)
foo();
}
void n() {
  j(a);
  *i = 0;
}
int main() {
  n();
  return 0;
}

[Bug tree-optimization/100112] New: missed optimization for dead code elimination at -O3, -Os (vs. -O1, -O2)

2021-04-16 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100112

Bug ID: 100112
   Summary: missed optimization for dead code elimination at -O3,
-Os (vs. -O1, -O2)
   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: ---

[545] % 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/11.0.1/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 11.0.1 20210416 (experimental) [master revision
89c863488bc:10ed13839be:76c7e7d6b003a17d183d0571bf9b34c691819d25] (GCC) 
[546] % 
[546] % gcctk -O1 -S -o O1.s small.c
[547] % gcctk -O3 -S -o O3.s small.c
[548] % 
[548] % wc O1.s O3.s
 17  38 365 O1.s
 37  78 633 O3.s
 54 116 998 total
[549] % 
[549] % grep foo O1.s
[550] % grep foo O3.s
callfoo
[551] % 
[551] % cat small.c
extern void foo(void);
static int e, *a = &e, b, *c = &b;
static int d(int f, int i) {
  if (f ^ i)
foo();
}
int main() {
  int **g = &c;
  (*a)++;
  *g = c;
  d(1, c != 0);
  return 0;
}

[Bug tree-optimization/100113] New: missed optimization for dead code elimination at -O3 (vs. -O1)

2021-04-16 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100113

Bug ID: 100113
   Summary: missed optimization for dead code elimination at -O3
(vs. -O1)
   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: ---

[584] % 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/11.0.1/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 11.0.1 20210416 (experimental) [master revision
89c863488bc:10ed13839be:76c7e7d6b003a17d183d0571bf9b34c691819d25] (GCC) 
[585] % 
[585] % gcctk -O1 -S -o O1.s small.c
[586] % gcctk -O3 -S -o O3.s small.c
[587] % 
[587] % wc O1.s O3.s
  84  185 1140 O1.s
 120  254 1768 O3.s
 204  439 2908 total
[588] % 
[588] % grep foo O1.s
[589] % grep foo O3.s
callfoo
[590] % 
[590] % cat small.c
extern void foo(void);
int a, b, d, *c = &a, e, k;
static int f(int *h, int i, int **l) {
  for (b = 0; b < 1; b++) {
int *f = &d;
for (; d < 1; d++)
  f = c;
if (f != &a)
  __builtin_abort();
if (k)
  *c = 0;
  }
  *c = 0;
  return **l;
}
int main() {
  int *j = &b;
  if (!f(j, e, &j))
foo();
  return 0;
}

[Bug tree-optimization/100145] New: missed optimization for dead code elimination at -O3 (vs. -O2)

2021-04-19 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100145

Bug ID: 100145
   Summary: missed optimization for dead code elimination at -O3
(vs. -O2)
   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: ---

[639] % 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/11.0.1/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 11.0.1 20210419 (experimental) [master revision
b412ce8e961:756887f4cee:d64720a07f611c55e8c815c775a852d650a2e738] (GCC)
[640] %
[640] % gcctk -O2 -S -o O2.s small.c
[641] % gcctk -O3 -S -o O3.s small.c
[642] %
[642] % wc O2.s O3.s
  77  164 1080 O2.s
  88  187 1234 O3.s
 165  351 2314 total
[643] %
[643] % grep foo O2.s
[644] % grep foo O3.s
callfoo
[645] %
[645] % cat small.c
int b, c, d, e;
void foo();
int a(int f, int p) { return (p && f) || (f && p < 0 && p + 1) ? 0 : f + p; }
static int g() {
  int *h = &c;
  *h = 0;
  if (b) {
int *i = &e;
while (1) {
  *h = a(0, i != 0);
  if (*h)
return 0;
}
  }
  return 0;
}
int main() {
  int *k = &c;
  g();
  d = 1;
  if (*k > 100)
foo();
  return 0;
}

[Bug tree-optimization/100162] New: missed optimization for dead code elimination at -O3 (vs. -O2)

2021-04-20 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100162

Bug ID: 100162
   Summary: missed optimization for dead code elimination at -O3
(vs. -O2)
   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: ---

[720] % 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/11.0.1/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 11.0.1 20210420 (experimental) [master revision
67378cd63d6:5e36407d599:250f234988b6231669a720c52101d3686d645072] (GCC) 
[721] % 
[721] % gcctk -O2 -S -o O2.s small.c
[722] % gcctk -O3 -S -o O3.s small.c
[723] % 
[723] % wc O2.s O3.s
  52  119  923 O2.s
  70  150 1143 O3.s
 122  269 2066 total
[724] % 
[724] % grep foo O2.s
[725] % grep foo O3.s
callfoo
[726] % 
[726] % cat small.c
extern void foo(void);
int printf(const char *, ...);
int a, b, c[5][1];
int main() {
  for (a = 0; a < 5; a++)
c[a][b] = 2;
  if ((b || 0) / c[0][0])
foo();
  printf("checksum=0");
  return 0;
}

[Bug tree-optimization/100188] New: missed optimization for dead code elimination at -O3 (vs. -O1)

2021-04-21 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100188

Bug ID: 100188
   Summary: missed optimization for dead code elimination at -O3
(vs. -O1)
   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: ---

[529] % 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 20210421 (experimental) [master revision
7f9b7ccf0c1:344da81f015:5445da1a94bb4df752209e54f4aa21702609a20a] (GCC) 
[530] % 
[530] % gcctk -O1 -S -o O1.s small.c
[531] % gcctk -O3 -S -o O3.s small.c
[532] % 
[532] % wc O1.s O3.s
 14  31 324 O1.s
 35  72 615 O3.s
 49 103 939 total
[533] % 
[533] % grep foo O1.s
[534] % grep foo O3.s
jmp foo
[535] % 
[535] % cat small.c
extern void foo(void);
static int b = 1, c, *f;
static int a() { return 0; }
static void d(int j) {
  int g, *h[36] = {&g, &g}, **i[1] = {&h[0]};
  if (!j) {
c = 0;
foo();
  }
}
int main() {
  int k[8];
  d(b);
  if (a())
f = &k[0];
  return 0;
}

[Bug ipa/100191] New: missed optimization for dead code elimination at -O3 (vs. -O2)

2021-04-21 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100191

Bug ID: 100191
   Summary: missed optimization for dead code elimination at -O3
(vs. -O2)
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ipa
  Assignee: unassigned at gcc dot gnu.org
  Reporter: zhendong.su at inf dot ethz.ch
CC: marxin at gcc dot gnu.org
  Target Milestone: ---

[538] % 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 20210421 (experimental) [master revision
7f9b7ccf0c1:344da81f015:5445da1a94bb4df752209e54f4aa21702609a20a] (GCC)
[539] %
[539] % gcctk -O2 -S -o O2.s small.c
[540] % gcctk -O3 -S -o O3.s small.c
[541] %
[541] % wc O2.s O3.s
  38   73  629 O2.s
  48   96  769 O3.s
  86  169 1398 total
[542] %
[542] % grep foo O2.s
[543] % grep foo O3.s
jmp foo
[544] %
[544] % cat small.c
extern void foo(void);
static int a, b, d, *e;
int c(int f) { return f < 0 || a || f; }
static int *g() {
  int *l[24], j = 0;
  for (; j < 6; j++)
l[j] = &d;
  return l[0];
}
static inline int k() {
  long c[48] = {9};
  while (1)
if (c[b])
  return 0;
}
static void i() {
  k();
  e = g();
}
static void h(int f) {
  i();
  if (!f)
foo();
}
int main() {
  int m = c(1);
  h(m);
  return 0;
}

[Bug ipa/100220] New: missed optimization for dead code elimination at -O3 (vs. -O1, -Os, -O2)

2021-04-22 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100220

Bug ID: 100220
   Summary: missed optimization for dead code elimination at -O3
(vs. -O1, -Os, -O2)
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ipa
  Assignee: unassigned at gcc dot gnu.org
  Reporter: zhendong.su at inf dot ethz.ch
CC: marxin at gcc dot gnu.org
  Target Milestone: ---

[638] % 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 20210422 (experimental) [master revision
3cf04d1afa8:0e51007a40c:d42088e453042f4f8ba9190a7e29efd937ea2181] (GCC) 
[639] % 
[639] % gcctk -O1 -S -o O1.s small.c
[640] % gcctk -O3 -S -o O3.s small.c
[641] % 
[641] % wc O1.s O3.s
  62  135  857 O1.s
  93  200 1337 O3.s
 155  335 2194 total
[642] % 
[642] % grep foo O1.s
[643] % grep foo O3.s
callfoo
[644] % 
[644] % cat small.c
extern void foo(void);
int b, c, d, e, *h;
static int *f = &e;
static int a() { return 1; }
static void g() {
  if (!*f)
for (; 1; d++)
  ;
  foo();
}
static void i() {
  int j, l = 0, k[24] = {0}, *m[2] = {&k[4], &l}, n[27];
  h = n;
  if (a() & n[0])
for (; c; c--)
  ;
  int p[8];
  h = p;
  p[0] && (h = &j);
  e = 0;
}
static void o() {
  int *q, **r = &q, ***s[1];
  s[0] = &r;
  i();
  g();
}
int main() {
  if (b)
o();
  return 0;
}

[Bug tree-optimization/100221] New: missed optimization for dead code elimination at -O3 (vs. -O1, -Os, -O2)

2021-04-22 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100221

Bug ID: 100221
   Summary: missed optimization for dead code elimination at -O3
(vs. -O1, -Os, -O2)
   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: ---

[551] % 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 20210422 (experimental) [master revision
3cf04d1afa8:0e51007a40c:d42088e453042f4f8ba9190a7e29efd937ea2181] (GCC) 
[552] % 
[552] % gcctk -O1 -S -o O1.s small.c
[553] % gcctk -O3 -S -o O3.s small.c
[554] % 
[554] % wc O1.s O3.s
  49  100  693 O1.s
  73  151 1072 O3.s
 122  251 1765 total
[555] % 
[555] % grep foo O1.s 
[556] % grep foo O3.s
callfoo
[557] % 
[557] % cat small.c
extern void foo(void);
int a, b;
static int c;
static void f() {
  while (a)
for (; b; b--)
  ;
}
void i() {
  if (c)
foo();
  int *g = &c;
  {
int **h[1] = {&g};
f();
  }
}
int main() {
  i();
  return 0;
}

[Bug tree-optimization/97695] New: wrong code at -O3 on x86_64-pc-linux-gnu

2020-11-03 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97695

Bug ID: 97695
   Summary: wrong code at -O3 on x86_64-pc-linux-gnu
   Product: gcc
   Version: 11.0
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: ---

[508] % 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/11.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 11.0.0 20201103 (experimental) [master revision
682ed7ad230:259379fab27:0caf400a865cb771f76bf1025cfc2a83e8ef00ed] (GCC) 
[509] % 
[509] % gcctk -O2 small.c; ./a.out
[510] % 
[510] % gcctk -O3 small.c; ./a.out
Floating point exception
[511] % 
[511] % cat small.c
int *a, b, **c = &a, d, e;

int f(int g, int h) { return !h || (g && h == 1) ? 0 : g / h; }

static void *i(int g) {
  while (e < 2)
if (!f(g, 9)) {
  while (b)
;
  return 0;
}
  return 0;
}

void j() {
  i(1);
  *c = i(d);
}

int main() { j(); return 0; }

[Bug ipa/97695] [11 Regression] wrong code at -O3 on x86_64-pc-linux-gnu since r11-4587-gae7a23a3fab74.

2020-11-03 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97695

--- Comment #6 from Zhendong Su  ---
Another repro for the same issue (as -fno-ipa-cp also avoids it): 

[579] % gcctk -O2 small.c; ./a.out
[580] % gcctk -O3 small.c; ./a.out
Aborted
[581] % gcctk -O3 -fno-ipa-cp small.c; ./a.out
[582] % 
[582] % cat small.c
int a, b, c, *d = &c, e, f;

char g (char h)
{
  return h < 0 || a || h ? h : 0;
}

static int i (int h)
{
  f = g (1);
  e = *d = f && h;
  a = 0;
  return b;
}

int main ()
{
  e = i (1);
  while (b)
i (0);
  if (!c)
__builtin_abort ();
  return 0;
}

[Bug tree-optimization/97559] [11 Regression] ICE at -O1 and above on x86_64-pc-linux-gnu: verify_ssa failed

2020-11-03 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97559

Zhendong Su  changed:

   What|Removed |Added

 CC||zhendong.su at inf dot ethz.ch

--- Comment #4 from Zhendong Su  ---
Another repro for the same ICE (but only at -Os):

[541] % gcctk -O1 -c small.c
[542] % gcctk -O2 -c small.c
[543] % gcctk -O3 -c small.c
[544] %
[544] % gcctk -Os -c small.c
small.c: In function ‘e’:
small.c:3:6: error: stmt with wrong VUSE
3 | void e() {
  |  ^
# VUSE <.MEM_7(D)>
f_8 = b;
expected .MEM_5
during GIMPLE pass: sink
small.c:3:6: internal compiler error: verify_ssa failed
0xf707cb verify_ssa(bool, bool)
../../gcc-trunk/gcc/tree-ssa.c:1208
0xbfe3e7 execute_function_todo
../../gcc-trunk/gcc/passes.c:2046
0xbff192 execute_todo
../../gcc-trunk/gcc/passes.c:2093
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.
[545] %
[545] % cat small.c
int a, b, c, d;

void e() {
  int f = b;
  if (a) {
  L1:
a = 0;
  L2:
if (a) {
  c = b;
  goto L1;
}
  }
  if (d)
goto L2;
}

[Bug tree-optimization/97725] New: ICE at -Os and above: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in useless_type_conversion_p, at gimple-expr.c:87

2020-11-05 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97725

Bug ID: 97725
   Summary: ICE at -Os and above: tree check: expected class
‘type’, have ‘exceptional’ (error_mark) in
useless_type_conversion_p, at gimple-expr.c:87
   Product: gcc
   Version: 11.0
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: ---

[555] % 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/11.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 11.0.0 20201105 (experimental) [master revision
8f565d255a3:fff11f1136a:35c125cb6ac47fa97aa5ee22f987a38e63adad08] (GCC)
[556] %
[556] % gcctk -O1 -c small.c
[557] %
[557] % gcctk -Os -c small.c
during GIMPLE pass: evrp
small.c: In function ‘main’:
small.c:25:1: internal compiler error: tree check: expected class ‘type’, have
‘exceptional’ (error_mark) in useless_type_conversion_p, at gimple-expr.c:87
   25 | }
  | ^
0x5fdbc9 tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
../../gcc-trunk/gcc/tree.c:9802
0x9bb5c3 tree_class_check(tree_node*, tree_code_class, char const*, int, char
const*)
../../gcc-trunk/gcc/tree.h:3436
0x9bb5c3 useless_type_conversion_p(tree_node*, tree_node*)
../../gcc-trunk/gcc/gimple-expr.c:87
0xd514f0 verify_gimple_phi
../../gcc-trunk/gcc/tree-cfg.c:5013
0xd514f0 verify_gimple_in_cfg(function*, bool)
../../gcc-trunk/gcc/tree-cfg.c:5342
0xc0102e execute_function_todo
../../gcc-trunk/gcc/passes.c:2039
0xc01f12 execute_todo
../../gcc-trunk/gcc/passes.c:2093
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.
[558] %
[558] % cat small.c
int a;
unsigned b;

int main() {
  if (a) {
goto L1;
while (1)
  while (1) {
long e = -1L, g;
int f, h, i;
  L1:
a = f;
  L2:
g = e;
f = h || g;
e = ~(f & b);
if (i || g < -1L) {
  ~(g || 0);
  break;
}
goto L2;
  }
  }
  return 0;
}

[Bug tree-optimization/97737] New: ICE at -Os and above: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in useless_type_conversion_p, at gimple-expr.c:88

2020-11-05 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97737

Bug ID: 97737
   Summary: ICE at -Os and above: tree check: expected class
‘type’, have ‘exceptional’ (error_mark) in
useless_type_conversion_p, at gimple-expr.c:88
   Product: gcc
   Version: 11.0
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: ---

Related to the fixed PR 97725. 

[521] % 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/11.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 11.0.0 20201106 (experimental) [master revision
6483f05989e:058c571d79e:32ee472864ada44ef05b2a3b087b8ce413bee282] (GCC) 
[522] % 
[522] % gcctk -O1 -c small.c
[523] % 
[523] % gcctk -Os -c small.c
during GIMPLE pass: evrp
small.c: In function ‘d’:
small.c:13:1: internal compiler error: tree check: expected class ‘type’, have
‘exceptional’ (error_mark) in useless_type_conversion_p, at gimple-expr.c:88
   13 | }
  | ^
0x5fdd79 tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
../../gcc-trunk/gcc/tree.c:9802
0x9bbf87 tree_class_check(tree_node*, tree_code_class, char const*, int, char
const*)
../../gcc-trunk/gcc/tree.h:3436
0x9bbf87 useless_type_conversion_p(tree_node*, tree_node*)
../../gcc-trunk/gcc/gimple-expr.c:88
0xd3b622 verify_gimple_comparison
../../gcc-trunk/gcc/tree-cfg.c:3477
0xd52240 verify_gimple_in_cfg(function*, bool)
../../gcc-trunk/gcc/tree-cfg.c:5397
0xc019ae execute_function_todo
../../gcc-trunk/gcc/passes.c:2039
0xc02892 execute_todo
../../gcc-trunk/gcc/passes.c:2093
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.
[524] % 
[524] % cat small.c
int a = 1, b, c;

void d() {
  int e = 1;
L1:
  b = e;
L2:
  e = e / a;
  if (!(e || c || e - 1))
goto L1;
  if (!b)
goto L2;
}

[Bug tree-optimization/97737] [11 Regression] ICE at -Os and above: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in useless_type_conversion_p, at gimple-expr.c:88

2020-11-06 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97737

--- Comment #4 from Zhendong Su  ---
I would guess that it makes more sense to mark PR 97741 as a dup of this bug.

[Bug c/97746] ice in vect_init_pattern_stmt, at tree-vect-patterns.c:116

2020-11-07 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97746

Zhendong Su  changed:

   What|Removed |Added

 CC||zhendong.su at inf dot ethz.ch

--- Comment #1 from Zhendong Su  ---
Another reproducer for the same crash with "-O1 -ftree-slp-vectorize": 

[566] % gcctk -O1 -ftree-slp-vectorize small.c
during GIMPLE pass: slp
small.c: In function ‘d’:
small.c:6:6: internal compiler error: in vect_init_pattern_stmt, at
tree-vect-patterns.c:116
6 | void d() {
  |  ^
0x18be859 vect_init_pattern_stmt
../../gcc-trunk/gcc/tree-vect-patterns.c:115
0x18bfeee vect_set_pattern_stmt
../../gcc-trunk/gcc/tree-vect-patterns.c:133
0x18bfeee vect_mark_pattern_stmts
../../gcc-trunk/gcc/tree-vect-patterns.c:5327
0x18bfeee vect_pattern_recog_1
../../gcc-trunk/gcc/tree-vect-patterns.c:5443
0x18c86e1 vect_pattern_recog(vec_info*)
../../gcc-trunk/gcc/tree-vect-patterns.c:5583
0x10054a2 vect_slp_analyze_bb_1
../../gcc-trunk/gcc/tree-vect-slp.c:4124
0x10054a2 vect_slp_region
../../gcc-trunk/gcc/tree-vect-slp.c:4226
0x1006a8a vect_slp_bbs
../../gcc-trunk/gcc/tree-vect-slp.c:4374
0x1006fcc vect_slp_function(function*)
../../gcc-trunk/gcc/tree-vect-slp.c:4460
0x10090f2 execute
../../gcc-trunk/gcc/tree-vectorizer.c:1437
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.
[567] %
[567] % cat small.c
int a, b;
short c;

extern void f (short*);

void d() {
  short e[2] = {0, 0};
  while (a) {
f(e);
int g = 0 || a, h = 8 && c;
short i = c;
c = h & g;
if (b)
  b = g || i;
  }
}

[Bug tree-optimization/97764] New: wrong code at -O1 and above on x86_64-pc-linux-gnu

2020-11-09 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97764

Bug ID: 97764
   Summary: wrong code at -O1 and above on x86_64-pc-linux-gnu
   Product: gcc
   Version: 11.0
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: ---

[514] % 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/11.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 11.0.0 20201109 (experimental) [master revision
946b73c1132:a700e491347:dc7e8839c92c4bc3c3741cf27b0af81edb803fe7] (GCC) 
[515] % 
[515] % gcctk -O0 small.c; ./a.out
[516] % 
[516] % gcctk -O1 small.c
[517] % ./a.out
Aborted
[518] % 
[518] % cat small.c
struct S {
  int b : 3;
  int c : 28;
  int d : 1;
};

int main() {
  struct S e = {1, -1};
  if (e.d)
__builtin_abort();
  return 0;
}

[Bug tree-optimization/97765] New: ICE at -Os: in clear_slot, at hash-table.h:891

2020-11-09 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97765

Bug ID: 97765
   Summary: ICE at -Os: in clear_slot, at hash-table.h:891
   Product: gcc
   Version: 11.0
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: ---

The test is hard to reduce and is still quite hairy. 

[534] % 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/11.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 11.0.0 20201109 (experimental) [master revision
946b73c1132:a700e491347:dc7e8839c92c4bc3c3741cf27b0af81edb803fe7] (GCC) 
[535] % 
[535] % 
[535] % gcctk -O1 -c -w small.c
[536] % 
[536] % gcctk -Os -c -w small.c
during GIMPLE pass: pre
small.c: In function ‘ae’:
small.c:69:6: internal compiler error: in clear_slot, at hash-table.h:891
   69 | void ae() {
  |  ^~
0xed6b05 hash_table::clear_slot(expr_pred_trans_d*)
../../gcc-trunk/gcc/hash-table.h:890
0xed6b05 phi_translate
../../gcc-trunk/gcc/tree-ssa-pre.c:1745
0xed6b6c phi_translate_set
../../gcc-trunk/gcc/tree-ssa-pre.c:1773
0xed6fea compute_antic_aux
../../gcc-trunk/gcc/tree-ssa-pre.c:2112
0xed6fea compute_antic
../../gcc-trunk/gcc/tree-ssa-pre.c:2458
0xedaf3a execute
../../gcc-trunk/gcc/tree-ssa-pre.c:4295
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.
[537] % 
[537] % cat small.c
static short a, c;
char b, d;
static char e;
int f, h;
long g;
short *i;
unsigned j;

extern void ad ();

static unsigned aa() {
  int l, m = l & e, n;
  char o, p, r = j;
  long q;
  short s;
  if (!d)
goto L2;
  q = s = h;
L1:
  b = -(e >> (h / ~0 & m + g) & ~s);
  char v = ~(f % c);
  unsigned short w = b | j < h | c;
  char x = -c & b | h % l ^ e + g;
  int y = ~(x | b > ((l | j) & g & h % f) ^ e);
  unsigned long z = -(j & (l & a)) | ~f | ~(y % b) ^ g & (h ^ ~0) ^ v;
  unsigned char k = ~(j | v + d | (b | ~(y % h)) + (-(x % g & ~c) ^ e ^ a) &
z);
  short t = ~f & l ^ (g ^ -z & ~b & d >> ~0) + (v | h) & j ^ k ^ e & c ^ y;
  int u = ~(~x & (f | h ^ -j & y >> e >> g % (l + c + b)));
  int ab =
  ~(~(l ^ f ^ v & x) % (-k | z & y | b + a) % ((g & h) + u + -e) - (d & w)
&
j);
  if (b && j) {
w = a;
e = -((-(w ^ -k & l) ^ x ^ ~g + h & y | (a ^ ab) + f) + (-e | v + j) & ~t);
a = -((a ^ y ^ (a ^ ~h ^ j % e ^ w + l) ^ g + t + ~(x ^ v)) %
  (c ^ (b ^ ~0) | d));
d = -(-(k | j & ~(h << d)) << ~(e | v | (l | g ^ y) % -c ^ j) | ab);
f = l % d + ~a | x % h | -f ^ y & b ^ w | -v - j + (c | b < 0);
b = ~(~(a + ~e + ~v & b) %
  ~((b & g | j % w) + (-~j ^ h + d & -y % h ^ f & c + d)));
c = -((j ^ a + f ^ g + ~(h ^ x) % ~d | h & c) % d | e & b + j ^ (k | ~l));
h = -(b | a + (~t | d & (~(j > h) ^ v | j ^ f | x) % ~k) ^ h + c % l |
  y & ~(-g % -d));
l = ~(~(g | e) % a ^ ~(-l & j) % ~b & c % d % ab & (~k ^ h & f) + (b + j));
if (a)
  goto L1;
goto L3;
  }
L2:
  c = -(a && o & (b & d)) & ~(e && q) > ~g ^ p;
  if (j || ab)
ad();
  if (!(e || h || ab && c && (l = n) && n - 1 && s)) {
ad();
goto L1;
  }
  if (n || a >= d) {
ad((long)e);
goto L1;
  }
  p = h && r;
  if (p)
o = ~(j | (d && c | e) | o);
  *i += 1;
  goto L1;
L3:;
}

void ae() {
  aa();
  for (;;)
;
}

[Bug tree-optimization/97808] New: ICE at -Os and above: in clean, at tree-ssa-pre.c:2053

2020-11-12 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97808

Bug ID: 97808
   Summary: ICE at -Os and above: in clean, at tree-ssa-pre.c:2053
   Product: gcc
   Version: 11.0
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: ---

[514] % 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/11.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 11.0.0 20201112 (experimental) [master revision
7ea19dcafb8:c6f488d83fd:5d9ade39b8720b61cf63a8be181fb3b487f6ac5b] (GCC) 
[515] % 
[515] % gcctk -O1 -c small.c
[516] % 
[516] % gcctk -Os -c small.c
during GIMPLE pass: pre
small.c: In function ‘g’:
small.c:5:6: internal compiler error: in clean, at tree-ssa-pre.c:2053
5 | void g() {
  |  ^
0xed6c52 clean
../../gcc-trunk/gcc/tree-ssa-pre.c:2053
0xedced5 compute_antic
../../gcc-trunk/gcc/tree-ssa-pre.c:2539
0xedeb19 execute
../../gcc-trunk/gcc/tree-ssa-pre.c:4363
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.
[517] % 
[517] % cat small.c
int a, e, f;
volatile int b;
unsigned c, d;

void g() {
  int h = b;
  d = e;
  a = -(~h + d);
  c = d >> (b && f) ^ -~h;
}

[Bug tree-optimization/97821] New: wrong code with -ftree-vectorize at -O1 on x86_64-pc-linux-gnu

2020-11-13 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97821

Bug ID: 97821
   Summary: wrong code with -ftree-vectorize at -O1 on
x86_64-pc-linux-gnu
   Product: gcc
   Version: 11.0
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: ---

The code is valid, but it is hard to reduce, so still quite large.

[509] % 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/11.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 11.0.0 20201113 (experimental) [master revision
54896b10dbe:c3a97a9df4b:a514934a0565255276adaa4fbd4aa35579ec33c6] (GCC) 
[510] % 
[510] % gcctk -O1 small.c; ./a.out
5030-170
[511] % gcctk -O1 -ftree-vectorize small.c; ./a.out
5030-176
[512] % 
[512] % cat small.c
int printf (const char *, ...);

static unsigned a, f, v;
int b, h, aa, ab, ac, ad, ae, y, z, af;
static long c, m, t, ag, ah = 3;
static signed d;
static char e, ai;
static short g, j = 1, o, w;
int *i, *s;
long long l;
static int *n;
char p;
static int q;
static int r;
static int u;
short x;
long long *aj = &l;
static signed ak;
static volatile unsigned al = 5;
static volatile short am = 1;
int *an(int *ao, int *ap) { return ap; }
static int aq() {
  int ar[] = {2, 2, 2, 2, 2, 2};
  short *as = &x;
  int at[] = {0, 1, 0, 1};
  int au = ab = 0;
  for (; m <= 1; m++) {
int av = 0, k, aw = e && u, ax = aw || ag;
int **ay = &n;
for (; ab; ab++)
  ac = 0;
for (; ac; ac++)
  am;
u &&am;
short az = am || a ^ w;
unsigned bc = am & w | am || ag;
  ba:
aw = u;
i = 0;
for (; i; i++)
  b = a;
printf("0");
if (p) {
  printf("%ld", ag);
  continue;
}
if (ag) {
  printf("7");
  e = w | ag c < ax;
}
if (w) {
  printf("%d", u);
  goto bb;
}
if (u)
  printf("%d", e);
s = &k;
u = aw;
t = 0;
for (; t <= 1; t++)
  *ay = an(&au, &av);
e++;
  }
  for (; r >= 0;)
for (; ag <= 5;) {
  signed bd[6];
  int be = 0, bf = am % al;
  for (; be < 6; be++)
bd[0] = 9;
  h = 0;
  for (; h <= 5; h++)
*aj = *as = aa;
  for (; w; w = d)
;
  short bg = d + j ^ e + r;
  al % am;
  int bi = bg & al >> am;
  am ^ al;
  am / al;
  am &al;
  al;
  am / al;
  if (c)
if (q) {
  be = 0;
  for (; be; be++)
z = 0;
}
  am;
  int bj = 0;
  if (m || q) {
  bh:
l = ad = c;
int bm = al || q;
al;
al;
char bn = al || q;
al;
al;
bm = q;
ae = a;
  bk:
ai = h || q > d;
ag = d;
al;
al;
printf("%d", q);
if (a > 1)
  break;
if (q)
  printf("%d", d);
if (q) {
  printf("3");
  h = d | bm > q;
  goto bk;
}
if (!ai || al && 0) {
  printf("%d", d);
  al;
  printf("%d", a);
  goto bb;
}
d = al;
printf("%lld", l);
m = q;
if (ak) {
  printf("%ld", c);
  ad = c & q;
}
if (!ah) {
  printf("%d", q);
  goto bh;
}
  }
  if (c)
s = &bj;
  m = q = d && c;
  r = ~(e / j & al > r);
  f |= d = al;
  v |= am;
  al / al ^ am;
  ak = am + al | al;
  am / al + al ^ am;
  j = am;
  al;
bb:
  if (c)
g++;
  a = q || e & d;
  am || al;
  am;
  am;
  am;
  al &am;
  am;
  am;
bl:
  am;
  if (q) {
printf("%d", q);
a = q - am;
goto bl;
  }
  am;
  printf("%d", d);
  m = q & am;
  am;
  printf("%d", a);
  if (d < -41) {
printf("%ld", ag);
goto ba;
  }
  h = *n;
  printf("3");
  c = e / d;
  printf("%ld", m);
  d = d << q / ag;
  o = 2;
  for (; o; o++)
i = &be;
  x = m = e;
  printf("%d", r) && (ah = r) || (d = ak && e);
  printf("%d", ak);
  if (!bf) {
printf("%d", e);
*as = a;
i = n;
bi = ak / am > r;
*n = 0;
for (; n; n++)
  ;
  }
  y = bi;
}
  return 0;
}
int main() {
  for (; af < 6; af++) {
d = 8;
aq();
  }
  printf("%d\n", h);
  return 0;
}

[Bug rtl-optimization/97836] New: wrong code at -O1 on x86_64-pc-linux-gnu

2020-11-15 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97836

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

[510] % 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/11.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 11.0.0 20201115 (experimental) [master revision
406b452dc0e:d88ff5a679d:faab61b585a8b4a42454f085dd6b7815992a98f5] (GCC) 
[511] % 
[511] % gcctk -O0 small.c; ./a.out
[512] % 
[512] % gcctk -O1 small.c; ./a.out
Aborted
[513] % 
[513] % cat small.c
int *a, b;

int *f(int *c) {
  b = 0;
  return c;
}

int main() {
  int d;
  a = f(&d);
  if (a != &d)
__builtin_abort ();
  return 0;
}

[Bug rtl-optimization/97836] wrong code at -O1 on x86_64-pc-linux-gnu

2020-11-15 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97836

--- Comment #1 from Zhendong Su  ---
Another related test that triggers the miscompilation at -Os, but not -O1: 

[621] % gcctk -O1 small.c; ./a.out
[622] % 
[622] % gcctk -Os small.c; ./a.out
Aborted
[623] % 
[623] % cat small.c
int a;

int b(int c) { return 0; }

static int *d(int *e) {
  if (a) {
a = a && b(*e);
  }
  return e;
}

int main() {
  int f;
  if (d(&f) != &f)
__builtin_abort();
  return 0;
}

[Bug tree-optimization/97838] New: ICE at -O3 on x86_64-pc-linux-gnu: Segmentation fault

2020-11-15 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97838

Bug ID: 97838
   Summary: ICE at -O3 on x86_64-pc-linux-gnu: Segmentation fault
   Product: gcc
   Version: 11.0
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: ---

[530] % 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/11.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 11.0.0 20201115 (experimental) [master revision
406b452dc0e:d88ff5a679d:faab61b585a8b4a42454f085dd6b7815992a98f5] (GCC)
[531] %
[531] % gcctk -O2 -c small.c
[532] %
[532] % gcctk -O3 -c small.c
during GIMPLE pass: vect
small.c: In function ‘f’:
small.c:3:6: internal compiler error: Segmentation fault
3 | void f() {
  |  ^
0xd0426f crash_signal
../../gcc-trunk/gcc/toplev.c:330
0x1006810 auto_vec::auto_vec()
../../gcc-trunk/gcc/vec.h:1540
0x1006810 vect_optimize_slp(vec_info*)
../../gcc-trunk/gcc/tree-vect-slp.c:2702
0xfea9c7 vect_analyze_loop_2
../../gcc-trunk/gcc/tree-vect-loop.c:2300
0xfea9c7 vect_analyze_loop(loop*, vec_info_shared*)
../../gcc-trunk/gcc/tree-vect-loop.c:2895
0x1015dbc try_vectorize_loop_1
../../gcc-trunk/gcc/tree-vectorizer.c:995
0x1016949 vectorize_loops()
../../gcc-trunk/gcc/tree-vectorizer.c:1229
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.
[533] %
[533] % cat small.c
int a, b, c, d;

void f() {
  while (c++) {
int e = -1;
d = a ? e / a : e;
b ^= ~d;
  }
}

[Bug tree-optimization/97888] New: wrong code at -Os and above on x86_64-pc-linux-gnu

2020-11-18 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97888

Bug ID: 97888
   Summary: wrong code at -Os and above on x86_64-pc-linux-gnu
   Product: gcc
   Version: 11.0
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: ---

[525] % 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/11.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 11.0.0 20201118 (experimental) [master revision
b03be74bad0:b7ec4b4b7a1:4b81528241ca682025d92558ff6aeec91dafdca8] (GCC) 
[526] % 
[526] % gcctk -O1 small.c; ./a.out
[527] % 
[527] % gcctk -Os small.c
[528] % ./a.out
Illegal instruction
[529] % 
[529] % cat small.c
int a = 1, b, c = 4, d, e;

int main() {
  int f = 2273363750;
  for (; b < 10; b++) {
int g = f % (~0 && a) && g, h = 0, i = 0;
if (c)
  h = f;
if (h > -2021603546)
  e = d / i;
f = h;
  }
  return 0;
}

[Bug tree-optimization/97901] New: ICE at -Os: verify_gimple failed

2020-11-18 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97901

Bug ID: 97901
   Summary: ICE at -Os: verify_gimple failed
   Product: gcc
   Version: 11.0
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: ---

[539] % 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/11.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 11.0.0 20201119 (experimental) [master revision
25bb75f841c:9f334878639:700337494e1b0d5ff608e1a3c77852381e264653] (GCC)
[540] %
[540] % gcctk -Os small.c
small.c: In function ‘main’:
small.c:3:5: error: invalid address operand in ‘mem_ref’
3 | int main() {
  | ^~~~
a[0];

# VUSE <.MEM_22>
_5 = a[0];
during GIMPLE pass: loopdone
small.c:3:5: internal compiler error: verify_gimple failed
0xd62975 verify_gimple_in_cfg(function*, bool)
../../gcc-trunk/gcc/tree-cfg.c:5461
0xc118ee execute_function_todo
../../gcc-trunk/gcc/passes.c:2039
0xc127d2 execute_todo
../../gcc-trunk/gcc/passes.c:2093
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.
[541] %
[541] % cat small.c
int a[1], b, *c, *d;

int main() {
L:
  d = c;
  for (b = 0; b < 2; b++)
d = &a[0];
  if (c)
goto L;
  if (*d)
__builtin_abort ();
  return 0;
}

[Bug ipa/98222] New: ICE at -O3 on x86_64-pc-linux-gnu: verify_cgraph_node failed

2020-12-10 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98222

Bug ID: 98222
   Summary: ICE at -O3 on x86_64-pc-linux-gnu: verify_cgraph_node
failed
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ipa
  Assignee: unassigned at gcc dot gnu.org
  Reporter: zhendong.su at inf dot ethz.ch
CC: marxin at gcc dot gnu.org
  Target Milestone: ---

[517] % 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/11.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 11.0.0 20201210 (experimental) [master revision
66dea8899df:e246cb295db:680e4202f23ce74f3b26c7f090b9d22a56765554] (GCC) 
[518] % 
[518] % gcctk -O2 small.c; ./a.out
[519] % 
[519] % gcctk -O3 small.c
small.c: In function ‘f’:
small.c:3:5: error: edge points to wrong declaration:
3 | int f (int j, int k) {
  | ^
 >
QI
size 
unit-size 
align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7f73b4e72d20
arg-types >>
addressable used nothrow static decl_5 QI small.c:3:5 align:8
warn_if_not_align:0 context >
 Instead of: 
unit-size 
align:32 warn_if_not_align:0 symtab:0 alias-set 1 canonical-type
0x7f73b4d565e8 precision:32 min  max

pointer_to_this >
QI
size 
unit-size 
align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7f73b4d6e348
arg-types 
chain 
chain >>>
pointer_to_this >
addressable used nothrow public static decl_5 QI small.c:3:5 align:8
warn_if_not_align:0 context 
initial 
result 
ignored SI small.c:3:5 size  unit-size

align:32 warn_if_not_align:0 context >
arguments 
used read SI small.c:3:12 size 
unit-size 
align:32 warn_if_not_align:0 context 
arg-type 
chain 
used read SI small.c:3:19 size 
unit-size 
align:32 warn_if_not_align:0 context  arg-type >>
struct-function 0x7f73b4e99000 chain >
f/42 (f) @0x7f73b4eb0440
  Type: function definition analyzed
  Visibility: artificial
  next sharing asm name: 41
  previous sharing asm name: 44
  References: b/1 (write) a/0 (read) b/1 (read) a/0 (read) c/2 (read) 
  Referring: 
  Function f/42 is inline copy in f/3
  Availability: local
  Function flags: count:462210652 (estimated locally) body local nonfreeing_fn
  Called by: f/41 (inlined) (462210652 (estimated locally),0.43 per call) 
  Calls: f/3 (415989587 (estimated locally),0.39 per call)
f.constprop.0.isra.0/6 (152529514 (estimated locally),0.14 per call) 
during IPA pass: inline
small.c:3:5: internal compiler error: verify_cgraph_node failed
0x83d218 cgraph_node::verify_node()
../../gcc-trunk/gcc/cgraph.c:3809
0x82956c symtab_node::verify()
../../gcc-trunk/gcc/symtab.c:1356
0xab2017 save_inline_function_body
../../gcc-trunk/gcc/ipa-inline-transform.c:679
0xab2017 inline_transform(cgraph_node*)
../../gcc-trunk/gcc/ipa-inline-transform.c:750
0xc29a49 execute_one_ipa_transform_pass
../../gcc-trunk/gcc/passes.c:2290
0xc29a49 execute_all_ipa_transforms(bool)
../../gcc-trunk/gcc/passes.c:2337
0x8422d5 cgraph_node::expand()
../../gcc-trunk/gcc/cgraphunit.c:1822
0x843c76 expand_all_functions
../../gcc-trunk/gcc/cgraphunit.c:1997
0x843c76 symbol_table::compile()
../../gcc-trunk/gcc/cgraphunit.c:2361
0x84721f symbol_table::compile()
../../gcc-trunk/gcc/cgraphunit.c:2545
0x84721f symbol_table::finalize_compilation_unit()
../../gcc-trunk/gcc/cgraphunit.c:2542
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.
[520] % 
[520] % cat small.c
int a, b, *c;

int f (int j, int k) {
  b = k / j;
  if (a)
f(0, 0);
  *c = f(b & a, 0);
  return 0;
}

int main() {
  if (a)
while (1)
  f(0, 0);
  return 0;
}

[Bug rtl-optimization/98229] New: ICE at -O1 in 32-bit mode on x86_64-pc-linux-gnu in decompose, at rtl.h:2282

2020-12-10 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98229

Bug ID: 98229
   Summary: ICE at -O1 in 32-bit mode on x86_64-pc-linux-gnu in
decompose, at rtl.h:2282
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: rtl-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: zhendong.su at inf dot ethz.ch
  Target Milestone: ---

[555] % 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/11.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 11.0.0 20201210 (experimental) [master revision
b46dd03fe94:30c63a5c82a:afc14c8d0a9e7af13698a7eec84226a3cc4b0e67] (GCC) 
[556] % 
[556] % gcctk -m32 -O0 -c small.c
[557] % 
[557] % gcctk -m32 -O1 -c small.c
during RTL pass: expand
small.c: In function ‘f’:
small.c:2:14: internal compiler error: in decompose, at rtl.h:2282
2 | void f() { a = a % ~0UL; }
  |~~^~
0x927acb wi::int_traits >::decompose(long*,
unsigned int, std::pair const&)
../../gcc-trunk/gcc/rtl.h:2280
0x927acb wide_int_ref_storage::wide_int_ref_storage
>(std::pair const&)
../../gcc-trunk/gcc/wide-int.h:1025
0x927acb generic_wide_int
>::generic_wide_int >(std::pair const&)
../../gcc-trunk/gcc/wide-int.h:782
0x927acb wide_int_storage::wide_int_storage
>(std::pair const&)
../../gcc-trunk/gcc/wide-int.h:1115
0x927acb
generic_wide_int::generic_wide_int >(std::pair const&)
../../gcc-trunk/gcc/wide-int.h:782
0x927acb expand_divmod(int, tree_code, machine_mode, rtx_def*, rtx_def*,
rtx_def*, int, optab_methods)
../../gcc-trunk/gcc/expmed.c:4214
0xbec854 expand_doubleword_mod
../../gcc-trunk/gcc/optabs.c:1085
0xbecca1 expand_doubleword_divmod(machine_mode, rtx_def*, rtx_def*, rtx_def**,
bool)
../../gcc-trunk/gcc/optabs.c:1159
0xbea858 expand_binop(machine_mode, optab_tag, rtx_def*, rtx_def*, rtx_def*,
int, optab_methods)
../../gcc-trunk/gcc/optabs.c:2119
0xbedf03 sign_expand_binop(machine_mode, optab_tag, optab_tag, rtx_def*,
rtx_def*, rtx_def*, int, optab_methods)
../../gcc-trunk/gcc/optabs.c:2282
0x928606 expand_divmod(int, tree_code, machine_mode, rtx_def*, rtx_def*,
rtx_def*, int, optab_methods)
../../gcc-trunk/gcc/expmed.c:5216
0x938553 expand_expr_real_2(separate_ops*, rtx_def*, machine_mode,
expand_modifier)
../../gcc-trunk/gcc/expr.c:9243
0x93f5e0 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
../../gcc-trunk/gcc/expr.c:10177
0x94b9d1 store_expr(tree_node*, rtx_def*, int, bool, bool)
../../gcc-trunk/gcc/expr.c:5859
0x94d84f expand_assignment(tree_node*, tree_node*, bool)
../../gcc-trunk/gcc/expr.c:5595
0x7f483a expand_gimple_stmt_1
../../gcc-trunk/gcc/cfgexpand.c:3901
0x7f483a expand_gimple_stmt
../../gcc-trunk/gcc/cfgexpand.c:3999
0x7fc087 expand_gimple_basic_block
../../gcc-trunk/gcc/cfgexpand.c:6036
0x7fe9d6 execute
../../gcc-trunk/gcc/cfgexpand.c:6720
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.
[558] % 
[558] % cat small.c
unsigned long long a;
void f() { a = a % ~0UL; }

[Bug tree-optimization/98255] New: wrong code at -Os and above with -fPIC on x86_64-pc-linux-gnu

2020-12-12 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98255

Bug ID: 98255
   Summary: wrong code at -Os and above with -fPIC on
x86_64-pc-linux-gnu
   Product: gcc
   Version: 11.0
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: ---

[510] % 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/11.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 11.0.0 20201212 (experimental) [master revision
ff2dfdef2f2:87144b47033:815eb852a2d293331eba2e241a986b8641d4da1f] (GCC) 
[511] % 
[511] % gcctk -Os small.c; ./a.out
[512] % 
[512] % gcctk -Os -fPIC small.c
[513] % ./a.out
Segmentation fault
[514] % 
[514] % cat small.c
struct a {
  volatile unsigned b;
  unsigned c;
};

int d, *e, h, k, l;
static struct a f;
long g;
static unsigned i = 4294967294;
volatile int j;

long m() {
  char n[4][4][3] = {{{9, 2, 8}, {9, 2, 8}, {9, 2, 8}, {9}}, {{8}}, {{8}},
{{2}}};
  while (d) {
for (; f.c < 4; f.c++) {
  *e = 0;
  h = n[f.c + 4][0][d];
}
while (g)
  return n[0][3][i];
while (1) {
  if (k) {
j = 0;
if (j)
  continue;
  }
  if (l)
break;
}
  }
  return 0;
}

int main() {
  m();
  return 0;
}

[Bug tree-optimization/98256] New: ICE at -Os and above: verify_ssa failed

2020-12-12 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98256

Bug ID: 98256
   Summary: ICE at -Os and above: verify_ssa failed
   Product: gcc
   Version: 11.0
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: ---

[547] % 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/11.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 11.0.0 20201212 (experimental) [master revision
ff2dfdef2f2:87144b47033:815eb852a2d293331eba2e241a986b8641d4da1f] (GCC) 
[548] % 
[548] % gcctk -O1 -c small.c
[549] % 
[549] % gcctk -Os -c small.c
small.c: In function ‘g’:
small.c:3:6: error: definition in block 2 follows the use
3 | void g() { f(1 && ~a / b); }
  |  ^
for SSA_NAME: b.1_3 in statement:
_8 = .ADD_OVERFLOW (a.0_1, b.1_3);
during GIMPLE pass: widening_mul
small.c:3:6: internal compiler error: verify_ssa failed
0xfa18ab verify_ssa(bool, bool)
../../gcc-trunk/gcc/tree-ssa.c:1214
0xc26fe7 execute_function_todo
../../gcc-trunk/gcc/passes.c:2049
0xc27d92 execute_todo
../../gcc-trunk/gcc/passes.c:2096
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.
[550] % 
[550] % cat small.c
extern void f (int);
unsigned a, b;
void g() { f(1 && ~a / b); }

[Bug tree-optimization/100314] New: missed optimization for dead code elimination at -O3 (vs. -O1)

2021-04-28 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100314

Bug ID: 100314
   Summary: missed optimization for dead code elimination at -O3
(vs. -O1)
   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: ---

[592] % 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 20210428 (experimental) [master revision
852dd866e2f:9b04e5b2651:b81e2d5e76a6bcc71f45b122e8b5538ddb7ebf4c] (GCC) 
[593] % 
[593] % gcctk -O1 -S -o O1.s small.c
[594] % gcctk -O3 -S -o O3.s small.c
[595] % 
[595] % wc O1.s O3.s
  21   45  392 O1.s
  42   86  686 O3.s
  63  131 1078 total
[596] % 
[596] % grep foo O1.s
[597] % grep foo O3.s
jmp foo
[598] % 
[598] % cat small.c
extern void foo(void);
static int a, *c, g, **j;
int b;
static void e() {
  int k, *l[5] = {&k, &k, &k, &k, &k};
  while (g) {
j = &l[0];
b++;
  }
}
static void d(int m) {
  int **h[30] = {&c}, ***i[1] = {&h[3]};
  if (m)
foo();
  e();
}
int main() {
  d(a);
  return 0;
}

[Bug tree-optimization/100315] New: missed optimization for dead code elimination at -O3, -O2 (vs. -O1, -Os)

2021-04-28 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100315

Bug ID: 100315
   Summary: missed optimization for dead code elimination at -O3,
-O2 (vs. -O1, -Os)
   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: ---

[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 20210428 (experimental) [master revision
852dd866e2f:9b04e5b2651:b81e2d5e76a6bcc71f45b122e8b5538ddb7ebf4c] (GCC) 
[584] % 
[584] % gcctk -O1 -S -o O1.s small.c
[585] % gcctk -O3 -S -o O3.s small.c
[586] % 
[586] % wc O1.s O3.s
 14  30 303 O1.s
 18  39 364 O3.s
 32  69 667 total
[587] % 
[587] % grep foo O1.s
[588] % grep foo O3.s
callfoo
[589] % 
[589] % cat small.c
extern void foo(void);
static int a;
static void b(int c) {
  if (c) {
foo();
while (1)
  ;
  }
}
void d() {
  int e = 0;
  while (1) {
b(a);
e++;
  }
}

[Bug tree-optimization/100359] New: missed optimization for dead code elimination at -O3 (vs. -O2)

2021-04-30 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100359

Bug ID: 100359
   Summary: missed optimization for dead code elimination at -O3
(vs. -O2)
   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 very recent regression as it does not reproduce for GCC 11.1
(and earlier).  

[524] % 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 20210430 (experimental) [master revision
4cf3b10f27b:939d67a66c9:c111f6066043d3b7bc4141ca0411eae9294aa6c5] (GCC) 
[525] % 
[525] % gcctk -O2 -S -o O2.s small.c
[526] % gcctk -O3 -S -o O3.s small.c
[527] % 
[527] % wc O2.s O3.s
  37   83  635 O2.s
  49  109  808 O3.s
  86  192 1443 total
[528] % 
[528] % grep foo O2.s
[529] % grep foo O3.s
callfoo
[530] % 
[530] % cat small.c
extern void foo(void);
static int b, f, *a = &b;
int **c = &a;
static void d() {
  int g, h;
  for (f = 0; f < 1; f++) {
int *i = &b;
{
  int *j[3], **k = &a;
  for (g = 0; g < 3; g++)
for (h = 0; h < 1; h++)
  j[g] = &b;
  *k = j[0];
}
*c = i;
  }
}
int main() {
  d();
  *a = 0;
  if (**c)
foo();
  return 0;
}

[Bug tree-optimization/100453] New: wrong code at -O1 and above

2021-05-06 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100453

Bug ID: 100453
   Summary: wrong code at -O1 and above
   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: ---

It seems to be a recent regression.

[513] % 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 20210506 (experimental) [master revision
1698f496c5e:27b373b33d4:a1ac9ffb5a7f44b2e2633b7265c21ce803c8e854] (GCC) 
[514] % 
[514] % gcctk -O0 small.c; ./a.out
[515] % gcc110 -O1 small.c; ./a.out
[516] % 
[516] % gcctk -O1 small.c
[517] % ./a.out
Segmentation fault
[518] % 
[518] % cat small.c
struct a {
  int b : 4;
} d;
static int c, e;
static const struct a f;
static void g(const struct a h) {
  for (; c < 1; c++)
d = h;
  e = h.b;
  c = h.b;
}
int main() {
  g(f);
  return 0;
}

[Bug tree-optimization/100492] New: wrong code at -O3 (generated code hangs)

2021-05-09 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100492

Bug ID: 100492
   Summary: wrong code at -O3 (generated code hangs)
   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: ---

It seems to be a recent regression.

[619] % 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 20210509 (experimental) [master revision
56103737f17:37fd4fac862:5e0236d3b0e0d7ad98bcee36128433fa755b5558] (GCC) 
[620] % 
[620] % gcctk -O2 small.c; ./a.out
0
[621] % gcc110 -O3 small.c; ./a.out
0
[622] % 
[622] % gcctk -O3 small.c
[623] % timeout -s 9 10 ./a.out
Killed
[624] % 
[624] % cat small.c
int printf (const char *, ...);
char a, c;
int b, d, *e = &d, g;
static char f;
int main() {
  int h = 0;
  for (; a < 1; a++) {
int *i[5], **j = &i[4], ***k[3][2] = {{&j}}, l = &k[2][1], *m = &l;
char *n = &c;
f = *e = g = 0;
for (; g < 2; g++) {
  for (b = 0; b < 3; b++)
h = (h && (*n = 0)) == 0;
  if (g)
break;
}
  }
  printf("%d\n", f);
  return 0;
}

[Bug tree-optimization/100539] New: wrong code at -Os and above with "-fno-dce -fno-inline-small-functions -fno-tree-dce"

2021-05-11 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100539

Bug ID: 100539
   Summary: wrong code at -Os and above with "-fno-dce
-fno-inline-small-functions -fno-tree-dce"
   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: ---

[514] % 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 20210511 (experimental) [master revision
15e6b45c9ad:45dc47d4720:cf43636a74a028daf2024b33d1915274a2ff9655] (GCC) 
[515] % 
[515] % gcctk -Os small.c; ./a.out
[516] % 
[516] % gcctk -Os -fno-dce -fno-inline-small-functions -fno-tree-dce small.c
[517] % ./a.out
Segmentation fault
[518] % 
[518] % cat small.c
int a, b;
static void c(int *d) {
  int e = 0;
  for (; a < 1; a++)
e |= (b == *d);
}
int main() {
  int g = 0;
  c(&g);
  return 0;
}

[Bug tree-optimization/100601] New: wrong code at -O1 on x86_64-linux-gnu

2021-05-14 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100601

Bug ID: 100601
   Summary: wrong code at -O1 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 recent regression.

[563] % 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 20210514 (experimental) [master revision
df18a1343dd:515cc33a922:40a2f88838e5119799649a74692cbf38d774b706] (GCC) 
[564] % 
[564] % gcctk -O0 small.c; ./a.out
[565] % gcc110 -O1 small.c; ./a.out
[566] % 
[566] % gcctk -O1 small.c
[567] % ./a.out
Segmentation fault
[568] % 
[568] % cat small.c
struct a {
  unsigned b : 10;
} const c;
int d;
static void i(const struct a f) {
  unsigned j = f.b;
  for (; d < 1; d++)
if (f.b) {
  int g = f.b;
}
}
int main() {
  i(c);
  return 0;
}

[Bug tree-optimization/100601] wrong code at -O1 on x86_64-linux-gnu

2021-05-17 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100601

--- Comment #2 from Zhendong Su  ---
(In reply to Eric Botcazou from comment #1)
> Please avoid creating trivial duplicates.
> 
> *** This bug has been marked as a duplicate of bug 100453 ***

Okay Eric; I had overlooked this one.

[Bug tree-optimization/100636] New: ICE at -Os and above: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in useless_type_conversion_p, at gimple-expr.c:88

2021-05-17 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100636

Bug ID: 100636
   Summary: ICE at -Os and above: tree check: expected class
‘type’, have ‘exceptional’ (error_mark) in
useless_type_conversion_p, at gimple-expr.c:88
   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: ---

[547] % 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 20210517 (experimental) [master revision
e49ff61d419:73ee0e029f5:1dfb5d8ab52c3c76c877077d8d6dc4eaae3c6153] (GCC)
[548] %
[548] % gcctk -O1 -c small.c
[549] %
[549] % gcctk -Os -c small.c
during GIMPLE pass: evrp
small.c: In function ‘b’:
small.c:12:1: internal compiler error: tree check: expected class ‘type’, have
‘exceptional’ (error_mark) in useless_type_conversion_p, at gimple-expr.c:88
   12 | }
  | ^
0x60e331 tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
../../gcc-trunk/gcc/tree.c:8724
0x9eae57 tree_class_check(tree_node*, tree_code_class, char const*, int, char
const*)
../../gcc-trunk/gcc/tree.h:3479
0x9eae57 useless_type_conversion_p(tree_node*, tree_node*)
../../gcc-trunk/gcc/gimple-expr.c:88
0xd83552 verify_gimple_comparison
../../gcc-trunk/gcc/tree-cfg.c:3515
0xd9a0a0 verify_gimple_in_cfg(function*, bool)
../../gcc-trunk/gcc/tree-cfg.c:5443
0xc43b3e execute_function_todo
../../gcc-trunk/gcc/passes.c:2042
0xc44a22 execute_todo
../../gcc-trunk/gcc/passes.c:2096
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.
[550] %
[550] % cat small.c
static int a;
void b() {
  int c;
  while (a) {
while (a)
  if (c)
b();
if (--c)
  while (1)
;
  }
}

[Bug tree-optimization/100740] New: wrong code at -O1 and above on x86_64-linux-gnu

2021-05-24 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100740

Bug ID: 100740
   Summary: wrong code at -O1 and above 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 quite long-latent, impacting GCC 9.1 and later. 

[636] % 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 20210524 (experimental) [master revision
dc084c487e9:bd7ae6b8ef8:9d38e096c5e3b1c2233b28d0e6ff8ee81517af56] (GCC) 
[637] % 
[637] % gcctk -O0 small.c; ./a.out
[638] % 
[638] % gcctk -O1 small.c
[639] % ./a.out
Aborted
[640] % 
[640] % cat small.c
unsigned a, b;
int main() {
  unsigned c = 0;
  for (a = 0; a < 2; a++)
for (b = 0; b < 2; b++)
  if (++c < a)
__builtin_abort ();
  return 0;
}

[Bug tree-optimization/100810] New: wrong code at -O1 and above on x86_64-linux-gnu

2021-05-28 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100810

Bug ID: 100810
   Summary: wrong code at -O1 and above 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: ---

[511] % 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 20210528 (experimental) [master revision
4774807e6e5:0e2d976f72b:cd62d089f6021fd1ad4537b8182836d15b14514f] (GCC) 
[512] % 
[512] % gcctk -O0 small.c; ./a.out
[513] % 
[513] % gcctk -O1 small.c
[514] % ./a.out
Aborted
[515] % 
[515] % cat small.c
int a, b = 1, c = 1, e, f = 1, g, h, j;
volatile int d;
static void k() {
  int i;
  h = b;
  if (c && a >= 0) {
while (a) {
  i++;
  h--;
}
if (g)
  for (h = 0; h < 2; h++)
;
if (!b)
  i &&d;
  }
}
static void l() {
  for (; j < 1; j++)
if (!e && c && f)
  k();
}
int main() {
  if (f)
l();
  if (h != 1)
__builtin_abort();
  return 0;
}

[Bug tree-optimization/100923] New: wrong code at -Os and above on x86_64-linux-gnu

2021-06-05 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100923

Bug ID: 100923
   Summary: wrong code at -Os and above 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: ---

[560] % 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 20210605 (experimental) [master revision
549d7f4310f:e97b11a9189:f31729d794c4150f6cba97f33ec125e180abd7dd] (GCC) 
[561] % 
[561] % gcctk -O1 small.c; ./a.out
[562] % 
[562] % gcctk -Os small.c
[563] % ./a.out
Floating point exception
[564] % 
[564] % cat small.c
int a = 1, b, c, *d = &a, *e = &a, f;
void g(int h) {}
void k(int *l) {
  int ***j;
  if (c) {
*j = &l;
***j;
  }
  g(*l);
  *e = f;
  if (*l) {
int i = b / a;
a = i;
  }
}
int main() {
  k(d);
  return 0;
}

[Bug tree-optimization/100923] wrong code at -Os and above on x86_64-linux-gnu

2021-06-05 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100923

--- Comment #1 from Zhendong Su  ---
It seems to affect all versions since 9.*, but not 8.*.

[Bug tree-optimization/100934] New: wrong code at -O3 on x86_64-linux-gnu

2021-06-06 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100934

Bug ID: 100934
   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: ---

It seems to affect all versions since GCC 8.4 (but not GCC 8.3). 

[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 20210606 (experimental) [master revision
28c62475050:a6bc26893ec:a589877a0036fc2f66b7a957859940c53efdc7c9] (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, b, c, d, e;
int main() {
  int f = 0, g = 0;
  for (; f < 2; f++) {
int h, i;
for (h = 0; h < 2; h++) {
  b = e = g ? a % g : 0;
  c = d;
  for (i = 0; i < 1; i++)
g = 0;
  for (; g < 2; g++)
;
}
  }
  return 0;
}

[Bug rtl-optimization/101086] New: ICE at -O2 and -O3 on x86_64-linux-gnu with "-ftracer -fvar-tracking-assignments -fsel-sched-pipelining -fselective-scheduling -fschedule-insns": in create_block_for

2021-06-15 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101086

Bug ID: 101086
   Summary: ICE at -O2 and -O3 on x86_64-linux-gnu with "-ftracer
-fvar-tracking-assignments -fsel-sched-pipelining
-fselective-scheduling -fschedule-insns": in
create_block_for_bookkeeping, at sel-sched.c:4537
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: rtl-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: zhendong.su at inf dot ethz.ch
  Target Milestone: ---

It seems to affect GCC 10.* and later. 

[516] % 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 20210615 (experimental) [master revision
4602714382f:c4ce2fa5b57:6d43ec50966cafb339eb6a370a5d767a24f673e1] (GCC) 
[517] % 
[517] % gcctk -O2 -c -ftracer -fvar-tracking-assignments -fsel-sched-pipelining
-fselective-scheduling -fschedule-insns small.c
cc1: warning: var-tracking-assignments changes selective scheduling
during RTL pass: sched1
small.c: In function ‘main’:
small.c:12:1: internal compiler error: in create_block_for_bookkeeping, at
sel-sched.c:4537
   12 | }
  | ^
0xd63b4c create_block_for_bookkeeping
../../gcc-trunk/gcc/sel-sched.c:4537
0xd63b4c find_place_for_bookkeeping
../../gcc-trunk/gcc/sel-sched.c:4686
0xd63b4c generate_bookkeeping_insn
../../gcc-trunk/gcc/sel-sched.c:4786
0xd63b4c move_op_at_first_insn
../../gcc-trunk/gcc/sel-sched.c:6063
0xd6435d code_motion_path_driver
../../gcc-trunk/gcc/sel-sched.c:6657
0xd64c6b code_motion_process_successors
../../gcc-trunk/gcc/sel-sched.c:6342
0xd64c6b code_motion_path_driver
../../gcc-trunk/gcc/sel-sched.c:6608
0xd64c6b code_motion_process_successors
../../gcc-trunk/gcc/sel-sched.c:6342
0xd64c6b code_motion_path_driver
../../gcc-trunk/gcc/sel-sched.c:6608
0xd64c6b code_motion_process_successors
../../gcc-trunk/gcc/sel-sched.c:6342
0xd64c6b code_motion_path_driver
../../gcc-trunk/gcc/sel-sched.c:6608
0xd653e3 move_op
../../gcc-trunk/gcc/sel-sched.c:6702
0xd653e3 move_exprs_to_boundary
../../gcc-trunk/gcc/sel-sched.c:5223
0xd653e3 schedule_expr_on_boundary
../../gcc-trunk/gcc/sel-sched.c:5436
0xd6928b fill_insns
../../gcc-trunk/gcc/sel-sched.c:5578
0xd6ae60 schedule_on_fences
../../gcc-trunk/gcc/sel-sched.c:7353
0xd6ae60 sel_sched_region_2
../../gcc-trunk/gcc/sel-sched.c:7491
0xd6bd98 sel_sched_region_1
../../gcc-trunk/gcc/sel-sched.c:7533
0xd6d1f4 sel_sched_region(int)
../../gcc-trunk/gcc/sel-sched.c:7634
0xd6da89 run_selective_scheduling()
../../gcc-trunk/gcc/sel-sched.c:7720
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.
[518] % 
[518] % cat small.c
extern int k(int);
int a, b;
int c(int d) { return d ? 0 : a; }
unsigned e(int d, int f) { return f < 0 ? d : d << f; }
int main() {
  int h;
  long i = 2412553438;
  while (b)
if (k(c(e(h, i
  i = 0;
  return 0;
}

[Bug tree-optimization/101151] New: ICE at -O1 and above on x86_64-linux-gnu: verify_ssa failed

2021-06-21 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101151

Bug ID: 101151
   Summary: ICE at -O1 and above on x86_64-linux-gnu: verify_ssa
failed
   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: ---

It appears to be a recent regression.

[511] % 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 20210621 (experimental) [master revision
edf0c3ffb59:30584177106:12bdd39755a25d237b7776153cbe03e171396fc5] (GCC)
[512] %
[512] % gcctk -O0 small.c; ./a.out
[513] %
[513] % gcctk -O1 small.c
small.c: In function ‘main’:
small.c:2:5: error: stmt with wrong VUSE
2 | int main() {
  | ^~~~
# VUSE <.MEM_8(D)>
b.0_1 = b;
expected .MEM_6
during GIMPLE pass: sink
small.c:2:5: internal compiler error: verify_ssa failed
0x1038aeb verify_ssa(bool, bool)
../../gcc-trunk/gcc/tree-ssa.c:1214
0xcb0437 execute_function_todo
../../gcc-trunk/gcc/passes.c:2049
0xcb11e2 execute_todo
../../gcc-trunk/gcc/passes.c:2096
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.
[514] %
[514] % cat small.c
int a, *b = &a, c, d;
int main() {
  *b;
  if (a) {
  L1:
a = 0;
  L2:
if (d) {
  while (b)
;
  goto L1;
}
  }
  if (c)
goto L2;
  return 0;
}

[Bug tree-optimization/101189] New: ICE at -Os and above on x86_64-linux-gnu: in fold_cond, at vr-values.c:3471

2021-06-24 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101189

Bug ID: 101189
   Summary: ICE at -Os and above on x86_64-linux-gnu: in
fold_cond, at vr-values.c:3471
   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: ---

[535] % 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 20210624 (experimental) [master revision
fcf617f0d2a:8f55dced666:3bd86940c428de9dde53e41265fb1435ed236f5e] (GCC)
[536] %
[536] % gcctk -O1 small.c; ./a.out
[537] %
[537] % gcctk -Os small.c
during GIMPLE pass: evrp
small.c: In function ‘main’:
small.c:13:1: internal compiler error: in fold_cond, at vr-values.c:3471
   13 | }
  | ^
0x1189432 simplify_using_ranges::fold_cond(gcond*)
../../gcc-trunk/gcc/vr-values.c:3470
0x1189465 simplify_using_ranges::simplify_cond_using_ranges_1(gcond*)
../../gcc-trunk/gcc/vr-values.c:3513
0x119194f simplify_using_ranges::simplify(gimple_stmt_iterator*)
../../gcc-trunk/gcc/vr-values.c:4229
0x184ffb8 hybrid_folder::fold_stmt(gimple_stmt_iterator*)
../../gcc-trunk/gcc/gimple-ssa-evrp.c:527
0xfa5116 substitute_and_fold_dom_walker::before_dom_children(basic_block_def*)
../../gcc-trunk/gcc/tree-ssa-propagate.c:870
0x1808717 dom_walker::walk(basic_block_def*)
../../gcc-trunk/gcc/domwalk.c:309
0xfa42d5 substitute_and_fold_engine::substitute_and_fold(basic_block_def*)
../../gcc-trunk/gcc/tree-ssa-propagate.c:987
0x184f0ef execute_early_vrp
../../gcc-trunk/gcc/gimple-ssa-evrp.c:690
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.
[538] %
[538] % cat small.c
static int a, b;
int main() {
  int d = 0, e, f = 5;
  if (a)
f = 0;
  for (; f < 4; f++)
;
  e = f ^ -f;
  e && d;
  if (!e)
e || b;
  return 0;
}

[Bug tree-optimization/101202] New: ICE at -O3 on x86_64-linux-gnu: Segmentation fault

2021-06-24 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101202

Bug ID: 101202
   Summary: ICE at -O3 on x86_64-linux-gnu: Segmentation fault
   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 very recent regression.

[529] % 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 20210624 (experimental) [master revision
a0accaa9984:cc7f2982315:ce3316e9c02c81c509173572c71a101f4eb62a24] (GCC) 
[530] % 
[530] % gcctk -O2 small.c; ./a.out
[531] % 
[531] % gcctk -O3 small.c
during GIMPLE pass: slp
small.c: In function ‘main’:
small.c:4:5: internal compiler error: Segmentation fault
4 | int main() {
  | ^~~~
0xdb35cf crash_signal
../../gcc-trunk/gcc/toplev.c:327
0x10cf440 vect_optimize_slp(vec_info*)
../../gcc-trunk/gcc/tree-vect-slp.c:3694
0x10d7d77 vect_optimize_slp(vec_info*)
../../gcc-trunk/gcc/vec.h:1448
0x10d7d77 vect_slp_analyze_bb_1
../../gcc-trunk/gcc/tree-vect-slp.c:5608
0x10d7d77 vect_slp_region
../../gcc-trunk/gcc/tree-vect-slp.c:5695
0x10d9a0a vect_slp_bbs
../../gcc-trunk/gcc/tree-vect-slp.c:5845
0x10d9f4c vect_slp_function(function*)
../../gcc-trunk/gcc/tree-vect-slp.c:5931
0x10e12a6 execute
../../gcc-trunk/gcc/tree-vectorizer.c:1445
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.
[532] % 
[532] % cat small.c
int printf(const char *, ...);
unsigned a, b, d;
int c, e, f;
int main() {
  while (a)
if (b) {
  f = a;
  while (e) {
int h, i;
if (d) {
  h = a;
  i = d;
L:
  d = a | d && c;
  if (a) {
printf("%d", a);
goto L;
  }
}
a = h;
d = i;
  }
}
  return 0;
}

[Bug tree-optimization/101223] New: wrong code at -Os and above on x86_64-linux-gnu

2021-06-26 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101223

Bug ID: 101223
   Summary: wrong code at -Os and above 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: ---

It also affects GCC 11.*, but not GCC 10.*. 

[516] % 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 20210626 (experimental) [master revision
2168bfb8144:f9d3bc42803:5b1ce655b25040048861af6c0264cb667b66fcd7] (GCC) 
[517] % 
[517] % gcctk -O1 small.c; ./a.out
[518] % 
[518] % gcctk -Os small.c
[519] % ./a.out
Aborted
[520] % 
[520] % cat small.c
struct {
  int a : 1;
} b;
int c = 1, d;
int main() {
  for (; d < 2; d++) {
int e = ~c, f = 0, g;
if (e) {
  f = c;
  g = b.a;
  b.a = f;
  if (b.a >= g)
__builtin_abort();
}
c = f;
b.a = g;
  }
  return 0;
}

[Bug tree-optimization/108574] New: wrong code at -Os and above on x86_64-linux-gnu

2023-01-27 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108574

Bug ID: 108574
   Summary: wrong code at -Os and above 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: ---

It appears to be a recent regression from 12.2.

Compiler Explorer: https://godbolt.org/z/4T3xMvsab


[578] % 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/13.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --disable-bootstrap
--enable-checking=yes --prefix=/local/suz-local/software/local/gcc-trunk
--enable-sanitizers --enable-languages=c,c++ --disable-werror
--disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 13.0.1 20230127 (experimental) [master r12-4647-g3f861a5c8fd] (GCC) 
[579] % 
[579] % gcctk -O3 small.c
[580] % ./a.out
Floating point exception
[581] % 
[581] % cat small.c
int a = 1, b, c = 2, d;
int main() {
  if (b)
goto L2;
 L1:
  {
int e = c;
a = 1 % a;
while (e && 1 <= d)
  ;
d >= b;
  L2:
if (1 >= e)
  goto L1;
  }
  return 0;
}

[Bug tree-optimization/108574] wrong code at -Os and above on x86_64-linux-gnu

2023-01-27 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108574

--- Comment #1 from Zhendong Su  ---
Here is another reproducer likely for the same bug.

Compiler Explorer: https://godbolt.org/z/Efvczc6f8


[556] % gcctk -O3 small.c
[557] % ./a.out
Floating point exception
[558] % 
[558] % cat small.c
int a, b, c, d, e, f, g = -1, h;
void l() {
  if (!e)
goto i;
  for (; g; g++) {
b = ~d;
int j = 0, k = 1;
if (k && (b || f))
  j = b;
  i:
a = ~j;
  }
}
int main() {
  h = 3;
  for (; h; h--) {
e = 1;
int m = ~a, n = 1 % m;
c = n;
l();
  }
  return 0;
}

[Bug tree-optimization/108574] wrong code at -Os and above on x86_64-linux-gnu

2023-01-27 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108574

--- Comment #2 from Zhendong Su  ---
Another likely related test case.

Compiler Explorer: https://godbolt.org/z/G514hnMeY


[537] % gcctk -O3 small.c
[538] % timeout -s 9 5 ./a.out
Killed
[539] % gcctk -O1 small.c
[540] % ./a.out
[541] % 
[541] % cat small.c
int a = 3557301289, d;
char b, f;
unsigned short c = 241;
short e, g;
static void h() {
  if (!a)
goto i;
  b = a;
  for (; a < 2; a = b) {
unsigned short j;
if (c || !g) {
  j = c;
i:
  e = j;
}
f = j;
d = ~(f & ~2880764155);
while (d > -2316069)
  ;
  }
}
int main() {
  h();
  return 0;
}

[Bug tree-optimization/108582] New: ICE on valid code at -Os and above with "-fno-tree-ccp -fno-tree-dce": tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in useless_type_conversion

2023-01-28 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108582

Bug ID: 108582
   Summary: ICE on valid code at -Os and above with "-fno-tree-ccp
-fno-tree-dce": tree check: expected class ‘type’,
have ‘exceptional’ (error_mark) in
useless_type_conversion_p, at gimple-expr.cc:87
   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: ---

It appears to be a recent regression from 12.2. 

Compiler Explorer: https://godbolt.org/z/91oGh1W8K


[617] % 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/13.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --disable-bootstrap
--enable-checking=yes --prefix=/local/suz-local/software/local/gcc-trunk
--enable-sanitizers --enable-languages=c,c++ --disable-werror
--disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 13.0.1 20230128 (experimental) [master r12-4647-g3f861a5c8fd] (GCC)
[618] %
[618] % gcctk -O3 small.c; ./a.out
[619] %
[619] % gcctk -O3 -fno-tree-ccp -fno-tree-dce small.c
during GIMPLE pass: phiopt
small.c: In function ‘main’:
small.c:3:5: internal compiler error: tree check: expected class ‘type’, have
‘exceptional’ (error_mark) in useless_type_conversion_p, at gimple-expr.cc:87
3 | int main() {
  | ^~~~
0x6e9981 tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
../../gcc-trunk/gcc/tree.cc:8959
0xbad6e3 tree_class_check(tree_node*, tree_code_class, char const*, int, char
const*)
../../gcc-trunk/gcc/tree.h:3653
0xbad6e3 useless_type_conversion_p(tree_node*, tree_node*)
../../gcc-trunk/gcc/gimple-expr.cc:87
0xfb106c verify_gimple_assign_binary
../../gcc-trunk/gcc/tree-cfg.cc:4292
0xfc1897 verify_gimple_assign
../../gcc-trunk/gcc/tree-cfg.cc:4829
0xfc1897 verify_gimple_stmt
../../gcc-trunk/gcc/tree-cfg.cc:5088
0xfc9448 verify_gimple_in_cfg(function*, bool, bool)
../../gcc-trunk/gcc/tree-cfg.cc:5583
0xe5a333 execute_function_todo
../../gcc-trunk/gcc/passes.cc:2091
0xe5adb2 execute_todo
../../gcc-trunk/gcc/passes.cc:2145
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See  for instructions.
[620] %
[620] % cat small.c
int a, c, d, e, f;
char b;
int main() {
  int g = 1;
  char h[1] = {0};
  while (a) {
if (f) {
  b = 0;
  if (d)
continue;
}
if (a < 1) {
  g = 0;
  goto L;
}
  }
  while (c) {
char *j = h;
int k;
  L:
if (e && !g)
  k |= 2 | (*j < 0);
  }
  return 0;
}

[Bug tree-optimization/108584] New: wrong code at -O2 and -O3 with "-fno-tree-ccp" on x86_64-linux-gnu

2023-01-28 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108584

Bug ID: 108584
   Summary: wrong code at -O2 and -O3 with "-fno-tree-ccp" 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: ---

It appears to be a recent regression from 12.2. 

Compiler Explorer: https://godbolt.org/z/ssjeaxd8a

[594] % 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/13.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --disable-bootstrap
--enable-checking=yes --prefix=/local/suz-local/software/local/gcc-trunk
--enable-sanitizers --enable-languages=c,c++ --disable-werror
--disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 13.0.1 20230128 (experimental) [master r12-4647-g3f861a5c8fd] (GCC)
[595] %
[595] % gcctk -O3 small.c; ./a.out
[596] %
[596] % gcctk -O3 -fno-tree-ccp small.c
[597] % ./a.out
Floating point exception
[598] %
[598] % cat small.c
char a;
volatile int b;
short c;
void d() {
  int e = 0, f;
  b = 1;
  if (!b)
goto L;
  unsigned h = 1;
  for (f = 0; f < 2; f++) {
char i = ~c % h;
short j = ~(i & e & (0 || a & c));
h && a;
if (h < 3)
L:
  j = h;
e = c = h = j;
  }
}
int main() {
  d();
  return 0;
}

[Bug tree-optimization/108639] New: ICE on valid code at -O1 and above: in decompose, at wide-int.h:984

2023-02-02 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108639

Bug ID: 108639
   Summary: ICE on valid code at -O1 and above: in decompose, at
wide-int.h:984
   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: ---

It appears to be a recent regression.

Compiler Explorer: https://godbolt.org/z/aE6Tssrq6

[538] % 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/13.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --disable-bootstrap
--enable-checking=yes --prefix=/local/suz-local/software/local/gcc-trunk
--enable-sanitizers --enable-languages=c,c++ --disable-werror --enable-multilib
--with-system-zlib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 13.0.1 20230202 (experimental) [master r13-5642-g66d700af5bb] (GCC)
[539] %
[539] % gcctk -O1 small.c
small.c: In function ‘main’:
small.c:3:18: warning: division by zero [-Wdiv-by-zero]
3 |   a = a ? 0 || 0 % 0 : 0;
  |  ^
during GIMPLE pass: dom
small.c:2:5: internal compiler error: in decompose, at wide-int.h:984
2 | int main() {
  | ^~~~
0x7b6a92 wi::int_traits >
>::decompose(long*, unsigned int, generic_wide_int > const&)
../../gcc-trunk/gcc/wide-int.h:984
0x7b7838 wi::int_traits >::decompose(long*,
unsigned int, generic_wide_int const&)
../../gcc-trunk/gcc/value-range.h:940
0x7b7838 wide_int_ref_storage::wide_int_ref_storage
>(generic_wide_int const&, unsigned int)
../../gcc-trunk/gcc/wide-int.h:1034
0x7b7838 generic_wide_int
>::generic_wide_int
>(generic_wide_int const&, unsigned int)
../../gcc-trunk/gcc/wide-int.h:790
0x7b7838 bool wi::eq_p,
generic_wide_int >(generic_wide_int const&,
generic_wide_int const&)
../../gcc-trunk/gcc/wide-int.h:1873
0x7b7838 wi::binary_traits,
generic_wide_int,
wi::int_traits >::precision_type,
wi::int_traits
>::precision_type>::predicate_result
operator==,
generic_wide_int >(generic_wide_int const&,
generic_wide_int const&)
../../gcc-trunk/gcc/wide-int.h:3307
0x7b7838 irange::operator==(irange const&) const
../../gcc-trunk/gcc/value-range.cc:1297
0x7b7838 irange::operator==(irange const&) const
../../gcc-trunk/gcc/value-range.cc:1266
0x1e4fc26 range_operator::fold_range(irange&, tree_node*, irange const&, irange
const&, relation_trio) const
../../gcc-trunk/gcc/range-op.cc:271
0x1e5030c operator_lshift::fold_range(irange&, tree_node*, irange const&,
irange const&, relation_trio) const
../../gcc-trunk/gcc/range-op.cc:2246
0x1d4db80 fold_using_range::range_of_range_op(vrange&,
gimple_range_op_handler&, fur_source&)
../../gcc-trunk/gcc/gimple-range-fold.cc:589
0x1d4f56a fold_using_range::fold_stmt(vrange&, gimple*, fur_source&,
tree_node*)
../../gcc-trunk/gcc/gimple-range-fold.cc:489
0x1d40d7c gimple_ranger::fold_range_internal(vrange&, gimple*, tree_node*)
../../gcc-trunk/gcc/gimple-range.cc:257
0x1d40d7c gimple_ranger::range_of_stmt(vrange&, gimple*, tree_node*)
../../gcc-trunk/gcc/gimple-range.cc:318
0x1d42ac0 gimple_ranger::range_of_expr(vrange&, tree_node*, gimple*)
../../gcc-trunk/gcc/gimple-range.cc:126
0x1028acf cprop_operand
../../gcc-trunk/gcc/tree-ssa-dom.cc:1972
0x102a969 cprop_into_stmt
../../gcc-trunk/gcc/tree-ssa-dom.cc:2049
0x102a969 dom_opt_dom_walker::optimize_stmt(basic_block_def*,
gimple_stmt_iterator*, bool*)
../../gcc-trunk/gcc/tree-ssa-dom.cc:2277
0x102bd13 dom_opt_dom_walker::before_dom_children(basic_block_def*)
../../gcc-trunk/gcc/tree-ssa-dom.cc:1682
0x1d0a0f7 dom_walker::walk(basic_block_def*)
../../gcc-trunk/gcc/domwalk.cc:311
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See  for instructions.
[540] %
[540] % cat small.c
long a;
int main() {
  a = a ? 0 || 0 % 0 : 0;
  a = a << a;
  return 0;
}

[Bug tree-optimization/108819] New: ICE on valid code at -O1 with "-fno-tree-ccp -fno-tree-forwprop" on x86_64-linux-gnu: tree check: expected ssa_name, have integer_cst in number_of_iterations_cltz,

2023-02-16 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108819

Bug ID: 108819
   Summary: ICE on valid code at -O1 with "-fno-tree-ccp
-fno-tree-forwprop" on x86_64-linux-gnu: tree check:
expected ssa_name, have integer_cst in
number_of_iterations_cltz, at
tree-ssa-loop-niter.cc:2394
   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: ---

It appears to be a recent regression. 

Compiler Explorer: https://godbolt.org/z/a7zzhcxhz

[570] % 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/13.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --disable-bootstrap
--enable-checking=yes --prefix=/local/suz-local/software/local/gcc-trunk
--enable-sanitizers --enable-languages=c,c++ --disable-werror --enable-multilib
--with-system-zlib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 13.0.1 20230216 (experimental) [master r13-6073-g441c466fd4d] (GCC)
[571] %
[571] % gcctk -O1 small.c; ./a.out
[572] %
[572] % gcctk -O1 -fno-tree-ccp -fno-tree-forwprop small.c
during GIMPLE pass: ivcanon
small.c: In function ‘main’:
small.c:2:5: internal compiler error: tree check: expected ssa_name, have
integer_cst in number_of_iterations_cltz, at tree-ssa-loop-niter.cc:2394
2 | int main() {
  | ^~~~
0x7a8f41 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
../../gcc-trunk/gcc/tree.cc:8909
0x78196d tree_check(tree_node*, char const*, int, char const*, tree_code)
../../gcc-trunk/gcc/tree.h:3530
0x78196d number_of_iterations_cltz
../../gcc-trunk/gcc/tree-ssa-loop-niter.cc:2394
0x10838e2 number_of_iterations_exit_assumptions(loop*, edge_def*,
tree_niter_desc*, gcond**, bool, basic_block_def**)
../../gcc-trunk/gcc/tree-ssa-loop-niter.cc:3287
0x10838e2 number_of_iterations_exit(loop*, edge_def*, tree_niter_desc*, bool,
bool, basic_block_def**)
../../gcc-trunk/gcc/tree-ssa-loop-niter.cc:3274
0x1083e08 estimate_numbers_of_iterations(loop*)
../../gcc-trunk/gcc/tree-ssa-loop-niter.cc:4844
0x1086685 estimate_numbers_of_iterations(function*)
../../gcc-trunk/gcc/tree-ssa-loop-niter.cc:5072
0x105aad6 canonicalize_induction_variables()
../../gcc-trunk/gcc/tree-ssa-loop-ivcanon.cc:1293
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See  for instructions.
[573] %
[573] % cat small.c
int a, b;
int main() {
  int d = 1;
  for (; b; b++)
if (a < 1)
  while (d <= a && a <= 0UL) {
int *e = &d;
*e = 0;
  }
  return 0;
}

[Bug tree-optimization/109115] New: ICE on valid code at -O2 and -O3 on x86_64-linux-gnu: in upper_bound, at value-range.h:950

2023-03-13 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109115

Bug ID: 109115
   Summary: ICE on valid code at -O2 and -O3 on x86_64-linux-gnu:
in upper_bound, at value-range.h:950
   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: ---

It appears to be a recent regression as it does not reproduce with 12.2. 

Compiler Explorer: https://godbolt.org/z/Yjaj5qMvv

[569] % 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/13.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --disable-bootstrap
--enable-checking=yes --prefix=/local/suz-local/software/local/gcc-trunk
--enable-sanitizers --enable-languages=c,c++ --disable-werror --enable-multilib
--with-system-zlib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 13.0.1 20230313 (experimental) [master r13-6641-g23532dac3f6] (GCC)
[570] %
[570] % gcctk -Os small.c; ./a.out
[571] %
[571] % gcctk -O2 small.c
during GIMPLE pass: slp
small.c: In function ‘main’:
small.c:2:5: internal compiler error: in upper_bound, at value-range.h:950
2 | int main() {
  | ^~~~
0xc48c63 irange::upper_bound() const
../../gcc-trunk/gcc/value-range.h:950
0xc48c63 irange::upper_bound() const
../../gcc-trunk/gcc/value-range.h:947
0x1e9e7ca vect_recog_divmod_pattern
../../gcc-trunk/gcc/tree-vect-patterns.cc:3978
0x1e9808a vect_pattern_recog_1
../../gcc-trunk/gcc/tree-vect-patterns.cc:6244
0x1e9d3c1 vect_pattern_recog(vec_info*)
../../gcc-trunk/gcc/tree-vect-patterns.cc:6401
0x11a97dc vect_slp_analyze_bb_1
../../gcc-trunk/gcc/tree-vect-slp.cc:7310
0x11a97dc vect_slp_region
../../gcc-trunk/gcc/tree-vect-slp.cc:7419
0x11abac3 vect_slp_bbs
../../gcc-trunk/gcc/tree-vect-slp.cc:7610
0x11abe9c vect_slp_function(function*)
../../gcc-trunk/gcc/tree-vect-slp.cc:7698
0x11b6492 execute
../../gcc-trunk/gcc/tree-vectorizer.cc:1532
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See  for instructions.
[572] %
[572] % cat small.c
int a, b;
int main() {
  unsigned short c = a, e = -1;
  if (b) {
unsigned d = (a ^ 1U) / a & c;
int f = (~d >> ~a) / e;
if (a)
  f = a;
a = f;
  }
  return 0;
}

[Bug tree-optimization/109138] New: wrong code at -O1 and above on x86_64-linux-gnu

2023-03-14 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109138

Bug ID: 109138
   Summary: wrong code at -O1 and above 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 appears to be long latent, affecting at least 5.* and later. 

Compiler Explorer: https://godbolt.org/z/9rb354E51

[592] % 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/13.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --disable-bootstrap
--enable-checking=yes --prefix=/local/suz-local/software/local/gcc-trunk
--enable-sanitizers --enable-languages=c,c++ --disable-werror --enable-multilib
--with-system-zlib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 13.0.1 20230315 (experimental) [master r13-6679-gfd42a8fa4b7] (GCC) 
[593] % 
[593] % gcctk -O0 small.c; ./a.out
[594] % 
[594] % gcctk -O1 small.c
[595] % timeout -s 9 5 ./a.out
Killed
[596] % 
[596] % cat small.c
unsigned a = -1;
int main() {
  int b = 0;
  for (; b < 2; b++) {
  L:;
int d;
while (a <= 0)
  if (*&d)
break;
d = 1;
a++;
  }
  return 0;
}

[Bug tree-optimization/109138] [10/11/12/13 Regression] wrong code at -O1 and above on x86_64-linux-gnu

2023-03-15 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109138

--- Comment #6 from Zhendong Su  ---
Oh, good catch, Jakub! And sorry for the noise.

[Bug tree-optimization/104700] New: ICE on valid code at -O2 and -O3 with -fno-tree-ccp -fno-tree-dce -fno-tree-vrp on x86_64-linux-gnu: in find_or_generate_expression, at tree-ssa-pre.cc:2795

2022-02-26 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104700

Bug ID: 104700
   Summary: ICE on valid code at -O2 and -O3 with -fno-tree-ccp
-fno-tree-dce -fno-tree-vrp on x86_64-linux-gnu: in
find_or_generate_expression, at tree-ssa-pre.cc:2795
   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: ---

It appears to be a recent regression.

[627] % 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.1/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.1 20220226 (experimental) [master r12-7395-gafeaaf4b352] (GCC)
[628] %
[628] % gcctk -O2 -fno-tree-ccp -fno-tree-dce -fno-tree-vrp small.c
during GIMPLE pass: pre
small.c: In function ‘main’:
small.c:2:5: internal compiler error: in find_or_generate_expression, at
tree-ssa-pre.cc:2795
2 | int main() {
  | ^~~~
0x1005c10 find_or_generate_expression
../../gcc-trunk/gcc/tree-ssa-pre.cc:2795
0x1005132 create_expression_by_pieces
../../gcc-trunk/gcc/tree-ssa-pre.cc:2951
0x10095b1 insert_into_preds_of_block
../../gcc-trunk/gcc/tree-ssa-pre.cc:3159
0x100b134 do_pre_regular_insertion
../../gcc-trunk/gcc/tree-ssa-pre.cc:3416
0x100b134 insert
../../gcc-trunk/gcc/tree-ssa-pre.cc:3809
0x100b134 execute
../../gcc-trunk/gcc/tree-ssa-pre.cc:4433
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See  for instructions.
[629] %
[629] % cat small.c
int a, b;
int main() {
  int c = 2, d, e = 0;
  if (a)
e = 2;
  int f, g = -(1L | (e && f && f & e));
  if (g)
  L:
g = c;
  c = 0;
  d = e * g;
  if (d)
goto L;
  while (e) {
int i = (a && b) * i;
  }
  return 0;
}

[Bug tree-optimization/104700] ICE on valid code at -O2 and -O3 with -fno-tree-ccp -fno-tree-dce -fno-tree-vrp on x86_64-linux-gnu: in find_or_generate_expression, at tree-ssa-pre.cc:2795

2022-02-26 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104700

--- Comment #1 from Zhendong Su  ---
>From Compiler Explorer: https://godbolt.org/z/PKfrMK489

[Bug tree-optimization/104700] [12 Regression] ICE on valid code at -O2 and -O3 with -fno-tree-ccp -fno-tree-dce -fno-tree-vrp on x86_64-linux-gnu: in find_or_generate_expression, at tree-ssa-pre.cc:2

2022-02-26 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104700

--- Comment #3 from Zhendong Su  ---
Another test without using "-fno-tree-ccp -fno-tree-dce -fno-tree-vrp":

[700] % 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.1/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.1 20220226 (experimental) [master r12-7395-gafeaaf4b352] (GCC)
[701] %
[701] % gcctk -O2 small.c
during GIMPLE pass: pre
small.c: In function ‘o’:
small.c:3:6: internal compiler error: in find_or_generate_expression, at
tree-ssa-pre.cc:2795
3 | void o() {
  |  ^
0x1005c10 find_or_generate_expression
../../gcc-trunk/gcc/tree-ssa-pre.cc:2795
0x1005132 create_expression_by_pieces
../../gcc-trunk/gcc/tree-ssa-pre.cc:2951
0x10095b1 insert_into_preds_of_block
../../gcc-trunk/gcc/tree-ssa-pre.cc:3159
0x100b134 do_pre_regular_insertion
../../gcc-trunk/gcc/tree-ssa-pre.cc:3416
0x100b134 insert
../../gcc-trunk/gcc/tree-ssa-pre.cc:3809
0x100b134 execute
../../gcc-trunk/gcc/tree-ssa-pre.cc:4433
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See  for instructions.
[702] %
[702] % cat small.c
int printf(const char *, ...);
int a, b, c = 2, d, e, *f, g;
void o() {
  unsigned h = 1;
  int j = -1, k, l = 1, m = 2, i;
  while (c < 2)
;
L1:
  k = h;
  h = -1;
  if (k < 2 && !c) {
printf("%d", k);
goto L1;
  }
  if (!j)
l = printf("0");
  if (g)
k = 0;
  if (a && k)
goto L2;
  while (f) {
m = a;
d = i;
i = e;
f = &j;
  L2:
if (d == l && !m)
  l = b;
  }
  unsigned *n[1] = {&h};
}
int main() {
  o();
  return 0;
}


--


>From Compiler Explorer: https://godbolt.org/z/b9z9e71oh

[Bug ipa/104813] New: ICE on valid code at -O3 on x86_64-linux-gnu: in adjust_references_in_caller, at ipa-cp.cc:4963

2022-03-06 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104813

Bug ID: 104813
   Summary: ICE on valid code at -O3 on x86_64-linux-gnu: in
adjust_references_in_caller, at ipa-cp.cc:4963
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ipa
  Assignee: unassigned at gcc dot gnu.org
  Reporter: zhendong.su at inf dot ethz.ch
CC: marxin at gcc dot gnu.org
  Target Milestone: ---

It appears to be a recent regression.

[550] % 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.1/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.1 20220307 (experimental) [master r12-7507-gaad3d935189] (GCC) 
[551] % 
[551] % gcctk -O2 small.c; ./a.out
[552] % 
[552] % gcctk -O3 small.c
during IPA pass: cp
small.c:29:1: internal compiler error: in adjust_references_in_caller, at
ipa-cp.cc:4963
   29 | }
  | ^
0x1c6da79 adjust_references_in_caller
../../gcc-trunk/gcc/ipa-cp.cc:4963
0x1c6db04 adjust_refs_in_act_callers
../../gcc-trunk/gcc/ipa-cp.cc:4912
0x8afd26 cgraph_node::call_for_symbol_thunks_and_aliases(bool (*)(cgraph_node*,
void*), void*, bool, bool)
../../gcc-trunk/gcc/cgraph.cc:2447
0x1c6d969 adjust_references_in_caller
../../gcc-trunk/gcc/ipa-cp.cc:4994
0x1c70f63 create_specialized_node
../../gcc-trunk/gcc/ipa-cp.cc:5124
0x1c74530 decide_whether_version_node
../../gcc-trunk/gcc/ipa-cp.cc:6238
0x1c757fb ipcp_decision_stage
../../gcc-trunk/gcc/ipa-cp.cc:6354
0x1c757fb ipcp_driver
../../gcc-trunk/gcc/ipa-cp.cc:6542
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See  for instructions.
[553] % 
[553] % cat small.c
int a, b, c, d, *e;
void f(int h) {
  if (b) {
int g;
while (g++)
  d = *e;
e++;
  }
}
static void i();
static void j(int *h, int k, int *l) {
  if (c) {
int *o = h, m;
f(*l);
i(m);
j(o, 1, o);
for (;;)
  ;
  }
}
void i() {
  int *n = &a;
  while (1)
j(n, 1, n);
}
int main() {
  j(&a, 0, &a);
  return 0;
}

[Bug ipa/104813] ICE on valid code at -O3 on x86_64-linux-gnu: in adjust_references_in_caller, at ipa-cp.cc:4963

2022-03-06 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104813

--- Comment #1 from Zhendong Su  ---
Compiler Explorer: https://godbolt.org/z/6cfcq4Wed

[Bug tree-optimization/105337] New: wrong code at -Os and above on x86_64-linux-gnu

2022-04-21 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105337

Bug ID: 105337
   Summary: wrong code at -Os and above 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: ---

[586] % 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.1/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.1 20220421 (experimental) [master r12-8217-g605a80bb733] (GCC) 
[587] % 
[587] % gcctk -O1 small.c; ./a.out
[588] % 
[588] % gcctk -Os small.c
[589] % ./a.out
Aborted
[590] % 
[590] % cat small.c
int printf(const char *, ...);
int a;
int f() {
  int b, c;
  for (b = 0; b < 3; b++) {
if (!a)
  break;
c--;
printf("%d", c);
  }
  return b;
}
int main() {
  if (f())
__builtin_abort ();
  return 0;
}

[Bug tree-optimization/105337] wrong code at -Os and above on x86_64-linux-gnu

2022-04-21 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105337

--- Comment #1 from Zhendong Su  ---
Compiler Explorer: https://godbolt.org/z/1bds4P7c7

[Bug tree-optimization/106414] New: wrong code at -O1 and above on x86_64-linux-gnu

2022-07-22 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106414

Bug ID: 106414
   Summary: wrong code at -O1 and above 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: ---

It appears to be a recent regression.

[672] % 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/13.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --disable-bootstrap
--enable-checking=yes --prefix=/local/suz-local/software/local/gcc-trunk
--enable-sanitizers --enable-languages=c,c++ --disable-werror --enable-multilib
--with-system-zlib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 13.0.0 20220722 (experimental) [master r13-1799-g41da4070a2a] (GCC) 
[673] % 
[673] % gcctk -O0 small.c; ./a.out
[674] % gcctk -O1 small.c
[675] % ./a.out
Aborted
[676] % cat small.c
int printf(const char *, ...);
int a, c, e;
const int b = 1;
char d;
int main() {
  a = ~(e || 0) ^ b & ~d;
  d = ~(a | ~2);
  if (d)
__builtin_abort();
  return 0;
}

[Bug tree-optimization/106414] [13 Regression] wrong code at -O1 and above on x86_64-linux-gnu by r13-1779

2022-07-22 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106414

--- Comment #2 from Zhendong Su  ---
A couple of related tests that fail at -O0: 

[587] % gcctk -O0 small.c
[588] % ./a.out
Aborted
[589] % cat small.c
int a, b, c, d;
unsigned e;
int main() {
  c = e = -((a && 1) ^ ~(b || 0));
  if (e < -1)
d = c;
  if (!d)
__builtin_abort();
  return 0;
}

-

[598] % gcctk -O0 small.c
[599] % ./a.out
Floating point exception
[600] % cat small.c
int a = 1, b = 1, c, d;
int main() {
 L:
  c = d / (1 / a);
  if (b) {
a = ~((~(a || 0) ^ (1 && b)) % 3U);
b = 0;
goto L;
  }
  return 0;
}

[Bug tree-optimization/106521] New: ICE at -O1 with "-floop-unroll-and-jam --param unroll-jam-min-percent=0": verify_ssa failed

2022-08-03 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106521

Bug ID: 106521
   Summary: ICE at -O1 with "-floop-unroll-and-jam --param
unroll-jam-min-percent=0": verify_ssa failed
   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: ---

It appears to be a recent regression (and possibly related to PR106249).

Compiler Explorer: https://godbolt.org/z/Tanf9axav


[545] % 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/13.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --disable-bootstrap
--enable-checking=yes --prefix=/local/suz-local/software/local/gcc-trunk
--enable-sanitizers --enable-languages=c,c++ --disable-werror --enable-multilib
--with-system-zlib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 13.0.0 20220803 (experimental) [master r13-1950-g9bb19e143cf] (GCC) 
[546] % 
[546] % gcctk -O1 -floop-unroll-and-jam --param unroll-jam-min-percent=0
small.c
small.c: In function ‘main’:
small.c:4:5: error: definition in block 30 does not dominate use in block 33
4 | int main() {
  | ^~~~
for SSA_NAME: b_lsm.15_82 in statement:
b_lsm.15_23 = PHI 
PHI argument
b_lsm.15_82
for PHI node
b_lsm.15_23 = PHI 
during GIMPLE pass: unrolljam
small.c:4:5: internal compiler error: verify_ssa failed
0x11356ef verify_ssa(bool, bool)
../../gcc-trunk/gcc/tree-ssa.cc:1211
0x105fb5b rewrite_into_loop_closed_ssa_1
../../gcc-trunk/gcc/tree-ssa-loop-manip.cc:576
0x105fb5b rewrite_into_loop_closed_ssa(bitmap_head*, unsigned int)
../../gcc-trunk/gcc/tree-ssa-loop-manip.cc:626
0x1c94c2d tree_loop_unroll_and_jam
../../gcc-trunk/gcc/gimple-loop-jam.cc:612
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See  for instructions.
[547] % 
[547] % cat small.c
short a, b, e;
volatile long c;
long d;
int main() {
  for (; d; d++) {
long g = a = 1;
for (; a; a++) {
  g++;
  c;
}
g && (b = e);
  }
  return 0;
}

[Bug tree-optimization/107109] New: ICE on valid code at -O1 on x86_64-linux-gnu: in type, at value-range.h:621

2022-10-01 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107109

Bug ID: 107109
   Summary: ICE on valid code at -O1 on x86_64-linux-gnu: in type,
at value-range.h:621
   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: ---

It appears to be a recent regression. 

Compiler Explorer: https://godbolt.org/z/891T9sGeP

[505] % 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/13.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --disable-bootstrap
--enable-checking=yes --prefix=/local/suz-local/software/local/gcc-trunk
--enable-sanitizers --enable-languages=c,c++ --disable-werror --enable-multilib
--with-system-zlib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 13.0.0 20221001 (experimental) [master r13-3010-g2555071c954] (GCC) 
[506] % 
[506] % gcctk -O1 small.c
during GIMPLE pass: dom
small.c: In function ‘c’:
small.c:3:6: internal compiler error: in type, at value-range.h:621
3 | void c() {
  |  ^
0x85da64 irange::type() const
../../gcc-trunk/gcc/value-range.h:621
0x85e6e1 irange::type() const
../../gcc-trunk/gcc/tree.h:3634
0x85e6e1 adjust_op1_for_overflow
../../gcc-trunk/gcc/range-op.cc:1373
0x1de41b6 operator_plus::op1_range(irange&, tree_node*, irange const&, irange
const&, relation_kind_t) const
../../gcc-trunk/gcc/range-op.cc:1414
0x1de41b6 operator_plus::op1_range(irange&, tree_node*, irange const&, irange
const&, relation_kind_t) const
../../gcc-trunk/gcc/range-op.cc:1400
0x1ce84f5 gori_compute::compute_operand1_range(vrange&,
gimple_range_op_handler&, vrange const&, tree_node*, fur_source&,
value_relation*)
../../gcc-trunk/gcc/gimple-range-gori.cc:1086
0x1ce7b6d gori_compute::compute_operand_range(vrange&, gimple*, vrange const&,
tree_node*, fur_source&, value_relation*)
../../gcc-trunk/gcc/gimple-range-gori.cc:692
0x1ce856f gori_compute::compute_operand1_range(vrange&,
gimple_range_op_handler&, vrange const&, tree_node*, fur_source&,
value_relation*)
../../gcc-trunk/gcc/gimple-range-gori.cc:1140
0x1ce7b6d gori_compute::compute_operand_range(vrange&, gimple*, vrange const&,
tree_node*, fur_source&, value_relation*)
../../gcc-trunk/gcc/gimple-range-gori.cc:692
0x1ceaf68 gori_compute::outgoing_edge_range_p(vrange&, edge_def*, tree_node*,
range_query&)
../../gcc-trunk/gcc/gimple-range-gori.cc:1358
0x1cdb605 ranger_cache::range_from_dom(vrange&, tree_node*, basic_block_def*,
ranger_cache::rfd_mode)
../../gcc-trunk/gcc/gimple-range-cache.cc:1494
0x1cdb991 ranger_cache::range_from_dom(vrange&, tree_node*, basic_block_def*,
ranger_cache::rfd_mode)
../../gcc-trunk/gcc/gimple-range-cache.cc:1398
0x1cdb991 ranger_cache::entry_range(vrange&, tree_node*, basic_block_def*,
ranger_cache::rfd_mode)
../../gcc-trunk/gcc/gimple-range-cache.cc:928
0x1cdb991 ranger_cache::entry_range(vrange&, tree_node*, basic_block_def*,
ranger_cache::rfd_mode)
../../gcc-trunk/gcc/gimple-range-cache.cc:916
0x1cdba48 ranger_cache::edge_range(vrange&, edge_def*, tree_node*,
ranger_cache::rfd_mode)
../../gcc-trunk/gcc/gimple-range-cache.cc:959
0x1cdb005 ranger_cache::resolve_dom(vrange&, tree_node*, basic_block_def*)
../../gcc-trunk/gcc/gimple-range-cache.cc:1384
0x1cdb660 ranger_cache::range_from_dom(vrange&, tree_node*, basic_block_def*,
ranger_cache::rfd_mode)
../../gcc-trunk/gcc/gimple-range-cache.cc:1488
0x1cdd392 ranger_cache::range_from_dom(vrange&, tree_node*, basic_block_def*,
ranger_cache::rfd_mode)
../../gcc-trunk/gcc/gimple-range-cache.cc:1398
0x1cdd392 ranger_cache::fill_block_cache(tree_node*, basic_block_def*,
basic_block_def*)
../../gcc-trunk/gcc/gimple-range-cache.cc:1212
0x1cddfd4 ranger_cache::block_range(vrange&, basic_block_def*, tree_node*,
bool)
../../gcc-trunk/gcc/gimple-range-cache.cc:1039
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See  for instructions.
[507] % 
[507] % cat small.c
int printf(const char *, ...);
int a, b;
void c() {
  int d, e;
 L:
  a = (b && a) ^ 2756578370;
  d = ~a + (e ^ d) ^ 2756578370;
  if (!d)
printf("%d", a);
  d = a / e;
  goto L;
}
int main() {
  if (a)
c();
  return 0;
}

[Bug debug/107110] New: failure (length) with -fcompare-debug at -O1 and above

2022-10-01 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107110

Bug ID: 107110
   Summary: failure (length) with -fcompare-debug at -O1 and above
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: debug
  Assignee: unassigned at gcc dot gnu.org
  Reporter: zhendong.su at inf dot ethz.ch
  Target Milestone: ---

It appears to be a regression from 10.* and affect 11.* and later. 

Compiler Explorer: https://godbolt.org/z/Gvh15c5KE

[529] % 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/13.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --disable-bootstrap
--enable-checking=yes --prefix=/local/suz-local/software/local/gcc-trunk
--enable-sanitizers --enable-languages=c,c++ --disable-werror --enable-multilib
--with-system-zlib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 13.0.0 20221001 (experimental) [master r13-3010-g2555071c954] (GCC) 
[530] % 
[530] % gcctk -O1 -fcompare-debug small.c
gcctk: error: small.c: ‘-fcompare-debug’ failure (length)
[531] % 
[531] % cat small.c
int a, b;
void c() {
  int d, e = 1, f = 1, g, h = 0;
  for (; 1; h++) {
if (d)
  f = 0;
if (d)
  break;
if (g)
  goto L;
g = f;
  }
  for (; h < 1;)
  L:
for (;;) {
  int j, k = e;
  if (a) {
break;
;
  }
  e = 0;
  while (b <= k)
;
  break;
  &j;
}
}
int main() {
  if (a)
c();
  return 0;
}

[Bug tree-optimization/107109] ICE on valid code at -O1 on x86_64-linux-gnu: in type, at value-range.h:621

2022-10-02 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107109

--- Comment #1 from Zhendong Su  ---
Another test that only reproduces at -O2 and -O3.

[508] % 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/13.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --disable-bootstrap
--enable-checking=yes --prefix=/local/suz-local/software/local/gcc-trunk
--enable-sanitizers --enable-languages=c,c++ --disable-werror --enable-multilib
--with-system-zlib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 13.0.0 20221002 (experimental) [master r13-3015-g3290dcf1499] (GCC) 
[509] % 
[509] % gcctk -O1 small.c; ./a.out
[510] % 
[510] % gcctk -O2 small.c
during GIMPLE pass: dom
small.c: In function ‘main’:
small.c:2:5: internal compiler error: in type, at value-range.h:621
2 | int main() {
  | ^~~~
0x85dab4 irange::type() const
../../gcc-trunk/gcc/value-range.h:621
0x85e731 irange::type() const
../../gcc-trunk/gcc/tree.h:3634
0x85e731 adjust_op1_for_overflow
../../gcc-trunk/gcc/range-op.cc:1373
0x1de43e3 operator_plus::op1_range(irange&, tree_node*, irange const&, irange
const&, relation_kind_t) const
../../gcc-trunk/gcc/range-op.cc:1414
0x1de43e3 operator_plus::op1_range(irange&, tree_node*, irange const&, irange
const&, relation_kind_t) const
../../gcc-trunk/gcc/range-op.cc:1400
0x1de43e3 operator_plus::op2_range(irange&, tree_node*, irange const&, irange
const&, relation_kind_t) const
../../gcc-trunk/gcc/range-op.cc:1424
0x1ce8e58 gori_compute::compute_operand2_range(vrange&,
gimple_range_op_handler&, vrange const&, tree_node*, fur_source&,
value_relation*)
../../gcc-trunk/gcc/gimple-range-gori.cc:1182
0x1ce7435 gori_compute::compute_operand_range(vrange&, gimple*, vrange const&,
tree_node*, fur_source&, value_relation*)
../../gcc-trunk/gcc/gimple-range-gori.cc:694
0x1ce85df gori_compute::compute_operand1_range(vrange&,
gimple_range_op_handler&, vrange const&, tree_node*, fur_source&,
value_relation*)
../../gcc-trunk/gcc/gimple-range-gori.cc:1140
0x1ce7bdd gori_compute::compute_operand_range(vrange&, gimple*, vrange const&,
tree_node*, fur_source&, value_relation*)
../../gcc-trunk/gcc/gimple-range-gori.cc:692
0x1ce8ed0 gori_compute::compute_operand2_range(vrange&,
gimple_range_op_handler&, vrange const&, tree_node*, fur_source&,
value_relation*)
../../gcc-trunk/gcc/gimple-range-gori.cc:1228
0x1ce7435 gori_compute::compute_operand_range(vrange&, gimple*, vrange const&,
tree_node*, fur_source&, value_relation*)
../../gcc-trunk/gcc/gimple-range-gori.cc:694
0x1ce7209 gori_compute::compute_logical_operands(vrange&, vrange&,
gimple_range_op_handler&, irange const&, tree_node*, fur_source&, tree_node*,
bool)
../../gcc-trunk/gcc/gimple-range-gori.cc:913
0x1ce7aae gori_compute::compute_operand_range(vrange&, gimple*, vrange const&,
tree_node*, fur_source&, value_relation*)
../../gcc-trunk/gcc/gimple-range-gori.cc:674
0x1ce85df gori_compute::compute_operand1_range(vrange&,
gimple_range_op_handler&, vrange const&, tree_node*, fur_source&,
value_relation*)
../../gcc-trunk/gcc/gimple-range-gori.cc:1140
0x1ce7bdd gori_compute::compute_operand_range(vrange&, gimple*, vrange const&,
tree_node*, fur_source&, value_relation*)
../../gcc-trunk/gcc/gimple-range-gori.cc:692
0x1ceafd8 gori_compute::outgoing_edge_range_p(vrange&, edge_def*, tree_node*,
range_query&)
../../gcc-trunk/gcc/gimple-range-gori.cc:1358
0x10a218d path_range_query::compute_ranges_in_block(basic_block_def*)
../../gcc-trunk/gcc/gimple-range-path.cc:454
0x10a2882 path_range_query::compute_ranges(bitmap_head const*)
../../gcc-trunk/gcc/gimple-range-path.cc:622
0x112dd90 hybrid_jt_simplifier::simplify(gimple*, gimple*, basic_block_def*,
jt_state*)
../../gcc-trunk/gcc/tree-ssa-threadedge.cc:1418
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See  for instructions.
[511] % 
[511] % cat small.c
int a, b = 1, c;
int main() {
  if (b <= 0) {
if (a)
L:
  if (b && a <= 6)
b = c;
int e = ~(a + b);
if ((b <= e || a > e) && a)
  a = 0;
if (b < 0)
  goto L;
if (b >= a)
  while (1)
;
  }
  return 0;
}

  1   2   3   4   >