[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/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/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/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 = 
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 = 
  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 = 
for (; ab; ab++)
  ac = 0;
for (; ac; ac++)
  am;
u &
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 = 
u = aw;
t = 0;
for (; t <= 1; t++)
  *ay = an(, );
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;
  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 = 
  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;
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 = 
  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 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 = [0];
  if (c)
goto L;
  if (*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/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 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/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 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();
  if (a != )
__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() != )
__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/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 = , 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 = , 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 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 = , 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/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/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/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 = , g;
static char f;
int main() {
  int h = 0;
  for (; a < 1; a++) {
int *i[5], **j = [4], ***k[3][2] = {{}}, l = [2][1], *m = 
char *n = 
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/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/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/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();
  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/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 &
  }
}
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 = , *e = , f;
void g(int h) {}
void k(int *l) {
  int ***j;
  if (c) {
*j = 
***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 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/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/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/101335] New: wrong code at -Os and above on x86_64-linux-gnu

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

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

[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 20210705 (experimental) [master revision
59748b71805:2d42892d7cd:8e0b3827bbab6bf92d88d00909ecf8fb43365f39] (GCC) 
[637] % 
[637] % gcctk -O1 small.c; ./a.out
[638] % 
[638] % gcctk -Os small.c
[639] % ./a.out
Aborted
[640] % cat small.c
unsigned a = 0x;
int b;
int main()
{
  int c = ~a;
  unsigned d = c - 10;
  if (d > c)
c = 20;
  b = -(c | 0);
  if (b > -8)
__builtin_abort ();
  return 0;
}

[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 = 
int **c = 
static void d() {
  int g, h;
  for (f = 0; f < 1; f++) {
int *i = 
{
  int *j[3], **k = 
  for (g = 0; g < 3; g++)
for (h = 0; h < 1; h++)
  j[g] = 
  *k = j[0];
}
*c = i;
  }
}
int main() {
  d();
  *a = 0;
  if (**c)
foo();
  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/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] = {, , , , };
  while (g) {
j = [0];
b++;
  }
}
static void d(int m) {
  int **h[30] = {}, ***i[1] = {[3]};
  if (m)
foo();
  e();
}
int main() {
  d(a);
  return 0;
}

[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 = 
int *b(int *d) { return d; }
void e(int *d) { *c = b(d); }
int main() {
  int f = (e(), 0);
  if (a != )
__builtin_abort();
  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 = , c, *d = 
int main() {
  int **e = 
  if (!((unsigned)((*e = d) == 0) - (*b = 1)))
foo();
  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] = [1];
  if (!c[0])
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 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/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 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 = 

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 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 #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] = {[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-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 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/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 = 
  struct a **n[] = {};
  long **l = 0;
  int o[42];
  foo();
  int p[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
  int *d[] = {[3]};
  i = 
  long ***a[] = {};
  int b[5];
  f = [3];
  if (e)
while (1)
  h = [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();
  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 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 = 

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 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 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 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] == ( != e(h)));
}
}
void f() { d(); }

[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] = {}, **c[8];
static void d() {
  int e = 0;
  for (; e < 8; e++)
c[e] = [1];
  if (!c[0])
foo();
}
int main() {
  if (a)
d();
  return 0;
}

[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 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 = 
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 = 
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/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] = 
  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 = 
char b;
static void e() {
  if ((2 ^ b) == 0)
foo();
}
int main() {
  if (a) {
b = 0;
int *g = 
*g = 0;
f = *d;
*d = f;
e();
  }
  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 = 
  *h = 0;
  if (b) {
int *i = 
while (1) {
  *h = a(0, i != 0);
  if (*h)
return 0;
}
  }
  return 0;
}
int main() {
  int *k = 
  g();
  d = 1;
  if (*k > 100)
foo();
  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/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 = , *j = 
  *i = g;
  c =  == i;
  d = c >= (*j = b | *k) && b & (*i == 0);
  h = a ? 0 : d;
  if (h)
foo();
}
int main() {
  while (f) {
int l;
e(1, );
  }
  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/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 = , **h = 
  *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/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 = , b, *c = 
static int d(int f, int i) {
  if (f ^ i)
foo();
}
int main() {
  int **g = 
  (*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 = , e, k;
static int f(int *h, int i, int **l) {
  for (b = 0; b < 1; b++) {
int *f = 
for (; d < 1; d++)
  f = c;
if (f != )
  __builtin_abort();
if (k)
  *c = 0;
  }
  *c = 0;
  return **l;
}
int main() {
  int *j = 
  if (!f(j, e, ))
foo();
  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 = 
  {
int **h[1] = {};
f();
  }
}
int main() {
  i();
  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 = 
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] = {[4], }, n[27];
  h = n;
  if (a() & n[0])
for (; c; c--)
  ;
  int p[8];
  h = p;
  p[0] && (h = );
  e = 0;
}
static void o() {
  int *q, **r = , ***s[1];
  s[0] = 
  i();
  g();
}
int main() {
  if (b)
o();
  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] = {, }, **i[1] = {[0]};
  if (!j) {
c = 0;
foo();
  }
}
int main() {
  int k[8];
  d(b);
  if (a())
f = [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] = 
  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 tree-optimization/102087] New: ICE on valid code at -O3 on x86_64-linux-gnu: in determine_exit_conditions, at tree-ssa-loop-manip.c:1049

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

Bug ID: 102087
   Summary: ICE on valid code at -O3 on x86_64-linux-gnu: in
determine_exit_conditions, at
tree-ssa-loop-manip.c:1049
   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: ---

[540] % 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 20210826 (experimental) [master revision
352d5e85a70:96f76144c4d:5a6c626710ad2ac4baa2dba02fac0750177e3305] (GCC)
[541] %
[541] % gcctk -O2 small.c
[542] %
[542] % gcctk -O3 small.c
during GIMPLE pass: unrolljam
small.c: In function ‘main’:
small.c:4:5: internal compiler error: in determine_exit_conditions, at
tree-ssa-loop-manip.c:1049
4 | int main() {
  | ^~~~
0xfe4bea determine_exit_conditions
../../gcc-trunk/gcc/tree-ssa-loop-manip.c:1049
0xfe4bea tree_transform_and_unroll_loop(loop*, unsigned int, edge_def*,
tree_niter_desc*, void (*)(loop*, void*), void*)
../../gcc-trunk/gcc/tree-ssa-loop-manip.c:1253
0x19ed2eb tree_loop_unroll_and_jam
../../gcc-trunk/gcc/gimple-loop-jam.c:590
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.
[543] %
[543] % cat small.c
volatile int a[1];
unsigned b;
int c;
int main() {
  int d;
  for (; b > 1; b++)
for (c = 0; c < 2; c++)
  for (d = 0; d < 2; d++)
a[0];
  return 0;
}

[Bug middle-end/102403] [12 Regression] ICE in in init_from_control_deps, at gimple-predicate-analysis.cc:2364

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

Zhendong Su  changed:

   What|Removed |Added

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

--- Comment #2 from Zhendong Su  ---
Another repro:

[603] % 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 20210919 (experimental) [master r12-3660-ge9e46864cd0] (GCC)
[604] %
[604] % gcctk -O2 small.c
[605] %
[605] % gcctk -O2 -Wall -Wextra small.c
during GIMPLE pass: uninit
small.c: In function ‘main’:
small.c:6:5: internal compiler error: in init_from_control_deps, at
gimple-predicate-analysis.cc:2364
6 | int main() {
  | ^~~~
0x1a93e03 predicate::init_from_control_deps(vec
const*, unsigned int)
../../gcc-trunk/gcc/gimple-predicate-analysis.cc:2364
0x1a954ff predicate::init_from_phi_def(gphi*)
../../gcc-trunk/gcc/gimple-predicate-analysis.cc:1829
0x1a989b4 predicate::is_use_guarded(gimple*, basic_block_def*, gphi*, unsigned
int, hash_set >*)
../../gcc-trunk/gcc/gimple-predicate-analysis.cc:1874
0x1a99064 predicate::is_use_guarded(gimple*, basic_block_def*, gphi*, unsigned
int)
../../gcc-trunk/gcc/gimple-predicate-analysis.cc:1933
0x103df8f find_uninit_use
../../gcc-trunk/gcc/tree-ssa-uninit.c:1092
0x103df8f warn_uninitialized_phi
../../gcc-trunk/gcc/tree-ssa-uninit.c:1150
0x103df8f execute_late_warn_uninitialized
../../gcc-trunk/gcc/tree-ssa-uninit.c:1275
0x103df8f execute
../../gcc-trunk/gcc/tree-ssa-uninit.c:1288
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.
[606] %
[606] % cat small.c
int printf(const char *, ...);
int a[1], b, c, d, e, h;
static int f;
long g;
void i() { b = 1 ^ a[b ^ (c & 1)]; }
int main() {
  int j;
  if (!f && ~h) {
if (g)
  goto L2;
  } else {
int m = 0;
  L1:
e = m;
  L2:
m ^= 1;
if (d)
  printf("0");
for (j = 0; j < 10; j++)
  i();
goto L1;
  }
  return 0;
}

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

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

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

[581] % 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 20210916 (experimental) [master r12-3577-g275a076f762] (GCC) 
[582] % 
[582] % gcctk -O0 small.c; a.out
[583] % 
[583] % gcctk -O1 small.c
[584] % ./a.out
Aborted
[585] % 
[585] % cat small.c
int a, b, *c = 
short d;
int main() {
  unsigned e = 1;
  for (d = 9; d > 8; d += 2) {
int *f = , **g = 
if (d > ++e)
  *g = c;
if (f != )
  __builtin_abort ();
  }
  return 0;
}

[Bug rtl-optimization/101797] New: ICE on valid code at -O2 and -O3: in extract_constrain_insn, at recog.c:2670

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

Bug ID: 101797
   Summary: ICE on valid code at -O2 and -O3: in
extract_constrain_insn, at recog.c:2670
   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: ---

[566] % 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 20210806 (experimental) [master revision
9124bbe1857:9d62796a203:fd351c76c23187fdc74d9af6874a54e2e84c4d25] (GCC)
[567] %
[567] % gcctk -Os small.c
[568] %
[568] % gcctk -O2 small.c
small.c: In function ‘main’:
small.c:11:1: error: insn does not satisfy its constraints:
   11 | }
  | ^
(insn 56 55 57 3 (set (reg/v:SI 0 ax [orig:85 c ] [85])
(not:SI (reg:SI 1 dx [89]))) "small.c":6:7 650 {*one_cmplsi2_1}
 (expr_list:REG_DEAD (reg:SI 1 dx [89])
(nil)))
during RTL pass: cprop_hardreg
small.c:11:1: internal compiler error: in extract_constrain_insn, at
recog.c:2670
0x615f0a _fatal_insn(char const*, rtx_def const*, char const*, int, char
const*)
../../gcc-trunk/gcc/rtl-error.c:108
0x615f33 _fatal_insn_not_found(rtx_def const*, char const*, int, char const*)
../../gcc-trunk/gcc/rtl-error.c:118
0xd2e2cd extract_constrain_insn(rtx_insn*)
../../gcc-trunk/gcc/recog.c:2670
0xd3a4fa copyprop_hardreg_forward_1
../../gcc-trunk/gcc/regcprop.c:825
0xd3b521 execute
../../gcc-trunk/gcc/regcprop.c:1390
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.
[569] %
[569] % cat small.c
int a;
int main() {
  int b, c, d, e = 0;
  if (a) {
c += a;
e = ~(a % c);
e || c || (b & d);
  }
  a = e;
  return 0;
}

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

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

Bug ID: 102645
   Summary: ICE on valid code 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: ---

[618] % 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 20211007 (experimental) [master r12-4238-gfba228e259d] (GCC) 
[619] % 
[619] % gcctk -O2 small.c; ./a.out
[620] % 
[620] % gcctk -O3 small.c
during GIMPLE pass: unrolljam
small.c: In function ‘main’:
small.c:3:5: internal compiler error: Segmentation fault
3 | int main() {
  | ^~~~
0xe78d7f crash_signal
../../gcc-trunk/gcc/toplev.c:326
0x1027191 tree_transform_and_unroll_loop(loop*, unsigned int, edge_def*,
tree_niter_desc*, void (*)(loop*, void*), void*)
../../gcc-trunk/gcc/tree-ssa-loop-manip.c:1424
0x1a97e6b tree_loop_unroll_and_jam
../../gcc-trunk/gcc/gimple-loop-jam.c:590
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.
[621] % 
[621] % cat small.c
volatile int a[1], d;
int b, c;
int main() {
  if (b && c) {
for (c = 0; c < 3; c++) {
  for (int e = 0; e < 6; e++)
for (int f = 0; f < 12; f++)
  d && a[0];
  continue;
}
  }
  return 0;
}

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

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

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

This appears to be a recent regression.

[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 20211013 (experimental) [master r12-4363-g52055987fba] (GCC) 
[593] % 
[593] % gcctk -Os small.c; ./a.out
[594] % 
[594] % gcctk -O2 small.c
[595] % ./a.out
Aborted
[596] % 
[596] % cat small.c
int a, b = -1, c;
int d = 1;
char e(char f, int g) { return g ? f : 0; }
char h(char f) { return f < a ? f : f < a; }
unsigned char i(unsigned char f, int g) { return g ? f : f > g; }
void j() {
L:
  c = e(1, i(h(b), d));
  if (b)
return;
  goto L;
}
int main() {
  j();
  if (c != 1)
__builtin_abort ();
  return 0;
}

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

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

Bug ID: 102830
   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 regression from GCC 8.* and affect GCC 9.* and later.
At -O3, the generated code segfaults, while at -Os and -O2, it hangs.


[655] % 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 20211019 (experimental) [master r12-4491-gf45610a4523] (GCC) 
[656] % 
[656] % gcctk -O0 small.c; ./a.out
[657] % 
[657] % gcctk -O3 small.c
[658] % ./a.out
Segmentation fault
[659] % 
[659] % cat small.c
int main() {
  unsigned a = 0, b;
  for (; a < 2; a++) {
b = ~(~a - 1 - a);
if (a > b)
  break;
  }
  return 0;
}

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

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

--- Comment #9 from Zhendong Su  ---
> Don't apologize, you have created very many wrong-code issues.
> We appreciate the effort of your team.

Thanks, Martin :)

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

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

--- Comment #2 from Zhendong Su  ---
Interesting --- it was missed by clang-10 sanitizers and the CompCert
interpreter (a pretty rare occurrence): 

[565] % ccomp -interp -fall small.c
small.c:13: warning: implicit declaration of function '__builtin_abort' is
invalid in C99 [-Wimplicit-function-declaration]
small.c:13: warning: '__builtin_abort' is declared without a function prototype
Time 114: program terminated (exit code = 0)
[566] % clang-10 -Xclang -disable-llvm-optzns -w -m64 -O0 -fwrapv -ftrapv
-fsanitize=undefined,address small.c; ./a.out
[567] % clang-10 -pie -fPIE -pie -Xclang -disable-llvm-optzns -w -O0 -m64
-fsanitize=memory small.c; ./a.out
[568] %

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

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

--- Comment #7 from Zhendong Su  ---
(In reply to Martin Liška from comment #6)
> (In reply to Zhendong Su from comment #5)
> > Yes, it's clear that the code is invalid. I should update my reduction
> > script to use more recent clang and gcc for ruling out UBs.
> 
> Yes, please include also ASAN and UBSAN checks made by the GCC compiler.

Yes, will also do; sorry for the invalid report and noise.

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

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

Bug ID: 102769
   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 seems to be very long-latent regression (since at least as early as GCC
4.7.* according to Compiler Explorer).

[581] % 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 20211015 (experimental) [master r12-4426-gf7571527a44] (GCC) 
[582] % 
[582] % gcctk -O0 small.c; ./a.out
[583] % 
[583] % gcctk -O1 small.c
[584] % ./a.out
Aborted
[585] % 
[585] % cat small.c
int a, *b, **c = , *d, e, f = 1;
int main() {
  int g[20];
  for (; e < 2; e++) {
if (a == f && *b)
  break;
int h;
f = h = 0;
*c = 
  }
  d = [4];
  if (e != 2)
__builtin_abort();
  return 0;
}

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

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

--- Comment #5 from Zhendong Su  ---
Yes, it's clear that the code is invalid. I should update my reduction script
to use more recent clang and gcc for ruling out UBs.

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

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

--- Comment #11 from Zhendong Su  ---
> s/created/reported/
> We as GCC developers have created them.

Thanks for this clarification, Jakob :)

> Anyway, thanks for all the bug reports.

Sure thing. Thanks to all you folks for the great work in maintaining and
improving GCC!

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

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

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

[591] % 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 20211007 (experimental) [master r12-4219-g6496ae5c965] (GCC) 
[592] % 
[592] % gcctk -O0 small.c; ./a.out
[593] % gcctk -Os small.c; ./a.out
[594] % gcctk -O2 small.c; ./a.out
[595] % gcctk -O3 small.c; ./a.out
[596] % 
[596] % gcctk -O1 small.c; ./a.out
Aborted
[597] % 
[597] % cat small.c
unsigned a;
int main() {
  unsigned b = 1;
  for (; b < 4; b++) {
a = (a ^ 20) * -b;
if (b > a) {
  __builtin_abort ();
}
a = 30;
  }
  return 0;
}

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

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

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

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

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

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

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

Bug ID: 102131
   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 a recent regression.

[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/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 20210830 (experimental) [master revision
02dbf5d1273:023508d4548:d73c44800b53c7e130da29e4eff1960b8311ffcd] (GCC) 
[595] % 
[595] % gcctk -O0 small.c; ./a.out
[596] % 
[596] % gcctk -O1 small.c
[597] % ./a.out
Aborted
[598] % 
[598] % cat small.c
int a;
int main() {
  unsigned b = 0;
  int c = 1;
  for (; b < 3; b++) {
while (c < b)
  __builtin_abort ();
for (a = 0; a < 3; a++)
  c++;
  }
  return 0;
}

[Bug tree-optimization/102546] [12 Regregression] Missed Dead Code Elimination regression (trunk vs 11.2.0) at -O3

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

--- Comment #7 from Zhendong Su  ---
(In reply to Aldy Hernandez from comment #6)
> (In reply to Richard Biener from comment #4)
> > I think it's similar to in the other PR, with old EVRP when visiting BB 8
> 
> BTW, which is this other PR, so I may see if my work for this PR fixes that
> one?

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

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

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

Bug ID: 103873
   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 appears to be a recent regression.

[568] % 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 --disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20211231 (experimental) (GCC) 
[569] % 
[569] % gcctk -O2 small.c; ./a.out
[570] % 
[570] % gcctk -O3 small.c
[571] % ./a.out
Aborted
[572] % 
[572] % cat small.c
int a, b, c, d[3], e, f;
int main() {
  if (b)
goto L;
  for (; f < 1; f++)
for (; a < 1; a++) {
  for (c = 0; c < 3; c++)
for (e = 0; e < 3; e++)
  d[e] |= c;
  for (; b; b++)
  L:;
}
  if (d[1] != 3)
__builtin_abort();
  return 0;
}

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

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

Bug ID: 103860
   Summary: wrong code at -O3 with -fPIC 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 regression from GCC 5.4, and impact GCC 6.1 and later. 

[591] % 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 --disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20211228 (experimental) (GCC) 
[592] % 
[592] % gcctk -O3 small.c; ./a.out
[593] % gcctk -O2 -fPIC small.c; ./a.out
[594] % 
[594] % gcctk -O3 -fPIC small.c
[595] % ./a.out
Segmentation fault
[596] % 
[596] % cat small.c
char a(char b, char c) { return b + c; }
static int d, *e;
int f;
int main() {
  char l = -1;
  for (; l; l = a(l, 1)) {
while (d < 0)
  ;
if (d > 0) {
  f = 0;
  *e = 0;
}
  }
  d = 0;
  return 0;
}

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

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

Bug ID: 103376
   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.

[603] % 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 20211123 (experimental) [master r12-5461-gcab8f69857d] (GCC) 
[604] % 
[604] % gcctk -O1 small.c; ./a.out
[605] % 
[605] % gcctk -Os small.c
[606] % ./a.out
Aborted
[607] % 
[607] % cat small.c
int printf(const char *, ...);
long long a = 7108473123;
int b, c, *d;
int main() {
  long long e, f;
  e = a;
  if (b) {
printf("%d", c);
d = 0;
while (*d)
  ;
  }
  f = 0x88582324C7C1E17B;
  a = ~-(e ^ f ^ ~a) ^ ~18013;
  if (a > -8622102845723662559LL)
__builtin_abort();
}

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

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

Bug ID: 103300
   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 appears to be a recent regression.

[596] % 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 2027 (experimental) [master r12-5333-g1a15a91a001] (GCC) 
[597] % 
[597] % gcctk -O2 small.c; ./a.out
[598] % 
[598] % gcc110 -O3 small.c; ./a.out
[599] % 
[599] % gcctk -O3 small.c
[600] % ./a.out
Aborted
[601] % 
[601] % cat small.c
int a, b[2], c, d, e, f;
int g(int h, int i) { return !i || h && i == 1 ? 0 : h % i; }
void j() {
  while (1)
while (1) {
  if (d)
  L:
if (f)
  break;
  if (e)
goto L;
  return;
}
}
int main() {
  j();
  for (c = 0; c < 3; c++)
for (a = 0; a < 2; a++)
  if (g(0, b[a]++))
while (1)
  ;
  if (b[1] != 3)
__builtin_abort();
  return 0;
}

[Bug tree-optimization/103231] New: ICE (nondeterministic) on valid code at -O1 on x86_64-linux-gnu: Segmentation fault

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

Bug ID: 103231
   Summary: ICE (nondeterministic) on valid code at -O1 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: ---

Created attachment 51788
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51788=edit
reproducer

This one is flaky and very difficult to reduce (likely due to memory errors).
The reproducer is still quite large and hairy.

[658] % 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 2024 (experimental) [master r12-5239-ga8029add306] (GCC) 
[659] % 
[659] % gcctk -O0 -w small.c
[660] % 
[660] % gcctk -O1 -w small.c
[661] % gcctk -O1 -w small.c
[662] % gcctk -O1 -w small.c
gcctk: internal compiler error: Segmentation fault signal terminated program
cc1
Please submit a full bug report,
with preprocessed source if appropriate.
See  for instructions.
[663] %

  1   2   3   4   >