[Bug tree-optimization/102627] New: wrong code with "-O1"

2021-10-06 Thread suochenyao at 163 dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102627

Bug ID: 102627
   Summary: wrong code with "-O1"
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: suochenyao at 163 dot com
  Target Milestone: ---

***
OS and Platform:
CentOS Linux release 7.8.2003 (Core).0, x86_64 GNU/Linux
***
Program:
int printf(const char *, ...);
int a, f, l, m, q, c, d, g;
long b, e;
struct g {
  signed h;
  signed i;
  unsigned j;
  unsigned k;
};
unsigned n;
char o;
int *p = &m;
long(r)(s) { return s && b ?: b; }
long v() {
  l = 0 || r(n & o);
  return q;
}
void w(int, unsigned, struct g x) {
  c ?: a;
  for (; d < 2; d++)
*p = x.k;
}
struct g y() {
  struct g h = {3, 908, 1, 20};
  for (; g; g++)
;
  return h;
}
int main() {
  long t;
  struct g u = y();
  t = e << f;
  w(0, t, u);
  v(0, 4, 4, 4);
  printf("%d\n", m);
}
***
version:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/data/bin/gcc-dev/bin/gcc
COLLECT_LTO_WRAPPER=/data/bin/gcc-dev/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure --prefix=/data/bin/gcc-dev/ --disable-multilib
--enable-languages=c,c++
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20211006 (experimental) (GCC)

git ver: bb6194e0b44a8262d8de304be3bd3ee65187772a
***
Command Lines:
$ gcc -O1 -Wall -Wextra -fno-strict-aliasing -fwrapv  a.c -o a1.o
a.c: In function ‘r’:
a.c:13:6: warning: type of ‘s’ defaults to ‘int’ [-Wimplicit-int]
   13 | long(r)(s) { return s && b ?: b; }
  |  ^
a.c:13:29: warning: the omitted middle operand in ‘?:’ will always be ‘true’,
suggest explicit middle operand [-Wparentheses]
   13 | long(r)(s) { return s && b ?: b; }
  | ^
$ gcc a.c -o a0.o
a.c: In function ‘r’:
a.c:13:6: warning: type of ‘s’ defaults to ‘int’ [-Wimplicit-int]
   13 | long(r)(s) { return s && b ?: b; }
  |  ^
$ ./a1.o
0
$ ./a0.o
20

[Bug tree-optimization/102565] New: ICE: in upper_bound, at value-range.h:531 under -O2

2021-10-02 Thread suochenyao at 163 dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102565

Bug ID: 102565
   Summary: ICE: in upper_bound, at value-range.h:531 under -O2
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: suochenyao at 163 dot com
  Target Milestone: ---

***
OS and Platform:
CentOS Linux release 7.8.2003 (Core).0, x86_64 GNU/Linux
***
Program:
struct a {
  signed b;
};
char c;
short d;
int e;
long(f)() { return 0; }
void g() {
  struct a h = {1};
  short *i = &d;
  *i = 0;
  e = c << h.b;
  f(e == 1 || d) == c;
}
void main() {}
***
version:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/data/bin/gcc-dev/bin/gcc
COLLECT_LTO_WRAPPER=/data/bin/gcc-dev/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure --prefix=/data/bin/gcc-dev/ --disable-multilib
--enable-languages=c,c++
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20211002 (experimental) (GCC)

git ver: 9d116bcc5556c7df32803f7bf8e6e238ea1c13fb
***
Command Lines:
$ gcc -O2 a.c
during GIMPLE pass: evrp
a.c: In function ‘g’:
a.c:15:1: internal compiler error: in upper_bound, at value-range.h:531
   15 | void main() {}
  | ^~~~
0xbc9939 irange::upper_bound() const
../../gcc/value-range.h:531
0x1be6f03 operator_lshift::op1_range(irange&, tree_node*, irange const&, irange
const&, tree_code) const
../../gcc/range-op.cc:2131
0x1ae0b0b gori_compute::compute_operand1_range(irange&, gimple*, irange const&,
tree_node*, fur_source&)
../../gcc/gimple-range-gori.cc:1011
0x1ae0b9e gori_compute::compute_operand_range(irange&, gimple*, irange const&,
tree_node*, fur_source&)
../../gcc/gimple-range-gori.cc:689
0x1ae0b9e gori_compute::compute_operand1_range(irange&, gimple*, irange const&,
tree_node*, fur_source&)
../../gcc/gimple-range-gori.cc:1064
0x1ae1bc1 gori_compute::compute_operand_range(irange&, gimple*, irange const&,
tree_node*, fur_source&)
../../gcc/gimple-range-gori.cc:689
0x1ae1bc1 gori_compute::outgoing_edge_range_p(irange&, edge_def*, tree_node*,
range_query&)
../../gcc/gimple-range-gori.cc:1245
0x1ad5b93 ranger_cache::range_on_edge(irange&, edge_def*, tree_node*)
../../gcc/gimple-range-cache.cc:979
0x1ad62f5 ranger_cache::range_on_edge(irange&, edge_def*, tree_node*)
../../gcc/gimple-range-fold.h:97
0x1ad62f5 ranger_cache::propagate_cache(tree_node*)
../../gcc/gimple-range-cache.cc:1078
0x1ad6c6d ranger_cache::fill_block_cache(tree_node*, basic_block_def*,
basic_block_def*)
../../gcc/gimple-range-cache.cc:1290
0x1ad6dcf ranger_cache::block_range(irange&, basic_block_def*, tree_node*,
bool)
../../gcc/gimple-range-cache.cc:1022
0x1ad2b39 gimple_ranger::range_on_entry(irange&, basic_block_def*, tree_node*)
../../gcc/gimple-range.cc:131
0x1ad32a8 gimple_ranger::range_of_expr(irange&, tree_node*, gimple*)
../../gcc/gimple-range.cc:105
0x1adc712 fold_using_range::range_of_range_op(irange&, gimple*, fur_source&)
../../gcc/gimple-range-fold.cc:604
0x1addc09 fold_using_range::fold_stmt(irange&, gimple*, fur_source&,
tree_node*)
../../gcc/gimple-range-fold.cc:556
0x1ad290d gimple_ranger::fold_range_internal(irange&, gimple*, tree_node*)
../../gcc/gimple-range.cc:226
0x1ad290d gimple_ranger::range_of_stmt(irange&, gimple*, tree_node*)
../../gcc/gimple-range.cc:269
0x1ad33ff gimple_ranger::range_of_expr(irange&, tree_node*, gimple*)
../../gcc/gimple-range.cc:100
0x11abbdf range_query::value_of_expr(tree_node*, gimple*)
../../gcc/value-query.cc:87
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.

[Bug tree-optimization/102385] New: ICE: in single_pred_edge, at basic-block.h:350 under "-O2 -fno-toplevel-reorder -fno-tree-ch -fno-tree-dce -fno-tree-dominator-opts -fno-tree-dse -fno-tree-loop-ivc

2021-09-17 Thread suochenyao at 163 dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102385

Bug ID: 102385
   Summary: ICE: in single_pred_edge, at basic-block.h:350 under
"-O2 -fno-toplevel-reorder -fno-tree-ch -fno-tree-dce
-fno-tree-dominator-opts -fno-tree-dse
-fno-tree-loop-ivcanon -fpredictive-commoning"
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: suochenyao at 163 dot com
  Target Milestone: ---

***
OS and Platform:
CentOS Linux release 7.8.2003 (Core), x86_64 GNU/Linux
***
Program:
short a, b;
int c[9];
void(d)() {}
void e() {
  a = 0;
  for (; a <= 4; a++) {
short *f = &b;
c[a] || (*f = 0);
d(c[a + 2]);
  }
}
int main() {return 0;}
***
gcc version:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/data/bin/gcc-dev/bin/gcc
COLLECT_LTO_WRAPPER=/data/bin/gcc-dev/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure --prefix=/data/bin/gcc-dev --disable-multilib
--enable-languages=c,c++
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210916 (experimental) (GCC)

git version: 745781d24cd7562202687cfbe05597ee673d4537
***
Command Lines:
$ gcc -Wall -Wextra -O2 -fno-toplevel-reorder -fno-tree-ch -fno-tree-dce
-fno-tree-dominator-opts -fno-tree-dse -fno-tree-loop-ivcanon
-fpredictive-commoning a.c
during GIMPLE pass: pcom
a.c: In function ‘e’:
a.c:4:6: internal compiler error: in single_pred_edge, at basic-block.h:350
4 | void e() {
  |  ^
0x773ee4 single_pred_edge
../../gcc/basic-block.h:350
0x77461d single_pred_edge
../../gcc/sbitmap.h:105
0x77461d tree_transform_and_unroll_loop(loop*, unsigned int, edge_def*,
tree_niter_desc*, void (*)(loop*, void*), void*)
../../gcc/tree-ssa-loop-manip.c:1295
0xf525c8 pcom_worker::tree_predictive_commoning_loop(bool)
../../gcc/tree-predcom.c:3401
0xf52aa4 tree_predictive_commoning(bool)
../../gcc/tree-predcom.c:3428
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.

[Bug tree-optimization/101594] New: ICE: Segmentation fault with "-O2 -fno-if-conversion -fno-ssa-phiopt -fno-tree-ch -fno-tree-dominator-opts -fno-tree-pre -fno-tree-reassoc -fselective-scheduling -f

2021-07-22 Thread suochenyao at 163 dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101594

Bug ID: 101594
   Summary: ICE: Segmentation fault with "-O2 -fno-if-conversion
-fno-ssa-phiopt -fno-tree-ch -fno-tree-dominator-opts
-fno-tree-pre -fno-tree-reassoc -fselective-scheduling
-fschedule-insns -fvar-tracking-assignments"
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: suochenyao at 163 dot com
  Target Milestone: ---

***
OS and Platform:
CentOS Linux release 7.8.2003 (Core), x86_64 GNU/Linux
***
Program:
long a;
int b, c;
char *d;
char(e)(f) { return f; }
void g() {
  char h;
  for (; a;) {
h = e(c || b);
*d = h;
  }
}
int main() {}
***
gcc version:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/data/bin/gcc-dev/bin/gcc
COLLECT_LTO_WRAPPER=/data/bin/gcc-dev/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure --prefix=/data/bin/gcc-dev --disable-multilib
--enable-languages=c,c++
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210722 (experimental) (GCC)

git version 4048d8a08621820dd6cc6035e13de3c3c82af4a5
***
$ gcc -O2 -fno-if-conversion -fno-ssa-phiopt -fno-tree-ch
-fno-tree-dominator-opts -fno-tree-pre -fno-tree-reassoc -fselective-scheduling
-fschedule-insns -fvar-tracking-assignments a.c
cc1: warning: var-tracking-assignments changes selective scheduling
a.c: In function ‘e’:
a.c:4:6: warning: type of ‘f’ defaults to ‘int’ [-Wimplicit-int]
4 | char(e)(f) { return f; }
  |  ^
during RTL pass: sched1
a.c: In function ‘g’:
a.c:11:1: internal compiler error: Segmentation fault
   11 | }
  | ^
0xe4483f crash_signal
../../gcc/toplev.c:328
0xe0369a moving_insn_creates_bookkeeping_block_p
../../gcc/sel-sched.c:2031
0xe0369a moveup_expr
../../gcc/sel-sched.c:2199
0xe0369a moveup_expr_cached
../../gcc/sel-sched.c:2544
0xe0649e move_op_ascend
../../gcc/sel-sched.c:6149
0xe0865f code_motion_path_driver
../../gcc/sel-sched.c:6648
0xe08cf3 code_motion_process_successors
../../gcc/sel-sched.c:6342
0xe08cf3 code_motion_path_driver
../../gcc/sel-sched.c:6608
0xe08cf3 code_motion_process_successors
../../gcc/sel-sched.c:6342
0xe08cf3 code_motion_path_driver
../../gcc/sel-sched.c:6608
0xe09219 move_op
../../gcc/sel-sched.c:6702
0xe09219 move_exprs_to_boundary
../../gcc/sel-sched.c:5223
0xe09219 schedule_expr_on_boundary
../../gcc/sel-sched.c:5436
0xe0c756 fill_insns
../../gcc/sel-sched.c:5578
0xe0c756 schedule_on_fences
../../gcc/sel-sched.c:7353
0xe0c756 sel_sched_region_2
../../gcc/sel-sched.c:7491
0xe0e248 sel_sched_region_1
../../gcc/sel-sched.c:7533
0xe0f85b sel_sched_region(int)
../../gcc/sel-sched.c:7634
0xe0f85b sel_sched_region(int)
../../gcc/sel-sched.c:7619
0xe0fa09 run_selective_scheduling()
../../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.

[Bug tree-optimization/101578] New: wrong code with "-O3 -fpack-struct"

2021-07-22 Thread suochenyao at 163 dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101578

Bug ID: 101578
   Summary: wrong code with "-O3 -fpack-struct"
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: suochenyao at 163 dot com
  Target Milestone: ---

***
OS and Platform:
CentOS Linux release 7.8.2003 (Core), x86_64 GNU/Linux
***
Program:
int printf(const char *, ...);
struct a {
  short b;
  long c;
};
union {
  int d;
  struct a c;
} e = {0505355};
int main() {
  e.c.c = 0;
  printf("%d\n", e.d);
}
***
gcc version:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/data/bin/gcc-dev/bin/gcc
COLLECT_LTO_WRAPPER=/data/bin/gcc-dev/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure --prefix=/data/bin/gcc-dev --disable-multilib
--enable-languages=c,c++
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210721 (experimental) (GCC)

git version: e4d306cf706eef83f99d510c308eda1539d05875
***
Command Lines:
$ gcc -O0 a.c -o a.out0
$ gcc -O3 -fpack-struct -Wall -Wextra -fno-strict-aliasing -fwrapv a.c -o
a.outf
$ ./a.out0
166637
$ ./a.outf
35565

[Bug tree-optimization/101249] New: ICE: Segmentation fault with "-O3 -fno-tree-ch -fno-tree-dce -fno-tree-dominator-opts -fno-tree-dse -fno-strict-aliasing -fwrapv"

2021-06-29 Thread suochenyao at 163 dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101249

Bug ID: 101249
   Summary: ICE: Segmentation fault with "-O3 -fno-tree-ch
-fno-tree-dce -fno-tree-dominator-opts -fno-tree-dse
-fno-strict-aliasing -fwrapv"
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: suochenyao at 163 dot com
  Target Milestone: ---

***
OS and Platform:
CentOS Linux release 7.8.2003 (Core), x86_64 GNU/Linux
***
Program:
unsigned a[];
char b=0, c=0;
int d=0;
void e() {
  int f, g;
  for (; b; b++) {
c = 0;
for (; c <= 8; c++) {
  int *h = &f;
  *h |= a[c];
  g = *h = a[c];
}
d = g;
  }
}
int main() {}
***
gcc version:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/data/bin/gcc-dev/bin/gcc
COLLECT_LTO_WRAPPER=/data/bin/gcc-dev/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure --prefix=/data/bin/gcc-dev --disable-multilib
--enable-languages=c,c++
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210628 (experimental) (GCC)

git version: 7c6b354b92b38f31cd2399fbdbc9d6f837881480
***
Command Lines:
$ gcc -O3 -fno-tree-ch -fno-tree-dce -fno-tree-dominator-opts -fno-tree-dse
-fno-strict-aliasing -fwrapv a.c
a.c:1:10: warning: array ‘a’ assumed to have one element
1 | unsigned a[];
  |  ^
a.c: In function ‘e’:
a.c:10:14: warning: iteration 1 invokes undefined behavior
[-Waggressive-loop-optimizations]
   10 |   *h |= a[c];
  | ~^~~
a.c:8:14: note: within this loop
8 | for (; c <= 8; c++) {
  |~~^~~~
during GIMPLE pass: slp
a.c:4:6: internal compiler error: Segmentation fault
4 | void e() {
  |  ^
0xe3a99f crash_signal
../../gcc/toplev.c:328
0x10e1b47 vec<_stmt_vec_info*, va_heap, vl_ptr>::iterate(unsigned int,
_stmt_vec_info**) const
../../gcc/vec.h:1697
0x10e1b47 vect_optimize_slp(vec_info*)
../../gcc/tree-vect-slp.c:3992
0x10e9c5c vect_optimize_slp(vec_info*)
../../gcc/vec.h:1448
0x10e9c5c vect_slp_analyze_bb_1
../../gcc/tree-vect-slp.c:5621
0x10e9c5c vect_slp_region
../../gcc/tree-vect-slp.c:5708
0x10eb2c8 vect_slp_bbs
../../gcc/tree-vect-slp.c:5858
0x10eb6c4 vect_slp_function(function*)
../../gcc/tree-vect-slp.c:5944
0x10f1712 execute
../../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.

[Bug tree-optimization/101080] New: wrong code with "-O3"

2021-06-15 Thread suochenyao at 163 dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101080

Bug ID: 101080
   Summary: wrong code with "-O3"
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: suochenyao at 163 dot com
  Target Milestone: ---

***
OS and Platform:
CentOS Linux release 7.8.2003 (Core), x86_64 GNU/Linux
***
Program:
struct a {
  unsigned b : 3;
} const c;
char d;
int e;
long f;
void g(const struct a h) {
  for (; d != 20; d = d + 4) {
int i = h.b;
e = h.b;
f = h.b || 0;
  }
}
int main() { g(c); }
***
gcc version:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/data/bin/gcc-dev/bin/gcc
COLLECT_LTO_WRAPPER=/data/bin/gcc-dev/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure --prefix=/data/bin/gcc-dev --disable-multilib
--enable-languages=c,c++
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210614 (experimental) (GCC)


git version: f9598d89a9f5a327ecdfa6f6978a0cfbe4447111
***
Command Lines:
$ gcc a.c -o a1.out
$ gcc -O3 -Wall -Wextra -fno-strict-aliasing -fwrapv  a.c -o a2.out
a.c: In function ‘g’:
a.c:9:9: warning: unused variable ‘i’ [-Wunused-variable]
9 | int i = h.b;
  | ^
$ ./a1.out
$ ./a2.out
Segmentation fault (core dumped)

[Bug tree-optimization/101062] New: wrong code with "-O2 -fno-toplevel-reorder -frename-registers"

2021-06-14 Thread suochenyao at 163 dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101062

Bug ID: 101062
   Summary: wrong code with "-O2 -fno-toplevel-reorder
-frename-registers"
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: suochenyao at 163 dot com
  Target Milestone: ---

***
OS and Platform:
CentOS Linux release 7.8.2003 (Core), x86_64 GNU/Linux
***
Program:
int printf(const char *, ...);
union a {
  signed b : 5;
};
int c;
volatile union a d[7] = {{8}};
short e = 1;
void f() {
  c = 5;
  for (; c; c--) {
short *g = &e;
*g = d[6].b = 0;
  }
}
int main() {
  f();
  printf("%d\n", e);
}
***
gcc version:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/data/bin/gcc-dev/bin/gcc
COLLECT_LTO_WRAPPER=/data/bin/gcc-dev/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure --prefix=/data/bin/gcc-dev --disable-multilib
--enable-languages=c,c++
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210613 (experimental) (GCC)

git version: 681143b9b94d7f1c88a7c34e2250865c31191959
***
Command Lines:
$ gcc a.c -o a1.out
$ gcc -O2 -fno-toplevel-reorder -frename-registers -Wall -Wextra
-fno-strict-aliasing -fwrapv a.c -o a2.out
$ ./a1.out
0
$ ./a2.out
1

[Bug tree-optimization/101009] New: wrong code with "-O3 -fno-tree-sra"

2021-06-10 Thread suochenyao at 163 dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101009

Bug ID: 101009
   Summary: wrong code with "-O3 -fno-tree-sra"
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: suochenyao at 163 dot com
  Target Milestone: ---

***
OS and Platform:
CentOS Linux release 7.8.2003 (Core), x86_64 GNU/Linux
***
Program:
int printf(const char *, ...);
struct a {
  unsigned b;
  unsigned c;
} e, *f = &e;
int d = 1;
int main() {
  for (; d; d--) {
struct a g[] = {{2, 1}, {2, 1}};
*f = g[1];
  }
  printf("%d\n", e.c);
}
***
gcc version:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/data/bin/gcc-dev/bin/gcc
COLLECT_LTO_WRAPPER=/data/bin/gcc-dev/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure --prefix=/data/bin/gcc-dev --disable-multilib
--enable-languages=c,c++
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210609 (experimental) (GCC)

git version: 53cb324cb4f9475d4eabcd9f5a858c5edaacc0cf
***
Command Lines:
$ gcc -O3 -fno-tree-sra -Wall -Wextra -fno-strict-aliasing -fwrapv a.c -o
a1.out
$ gcc a.c -o a2.out
$ ./a1.out
0
$ ./a2.out
1

[Bug ipa/100994] New: wrong code with "-O1 -finline-small-functions -fipa-cp"

2021-06-09 Thread suochenyao at 163 dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100994

Bug ID: 100994
   Summary: wrong code with "-O1 -finline-small-functions
-fipa-cp"
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ipa
  Assignee: unassigned at gcc dot gnu.org
  Reporter: suochenyao at 163 dot com
CC: marxin at gcc dot gnu.org
  Target Milestone: ---

***
OS and Platform:
CentOS Linux release 7.8.2003 (Core), x86_64 GNU/Linux
***
Program:
struct a {
  unsigned b : 4;
  unsigned c : 9;
} const d;
int e, f, g;
char h;
short i;
static int(j)() { return 0; }
static int k(const struct a l) {
  for (; g; j() & l.c)
;
  e = 1;
  i = e + 6;
  for (; e != 7; e = i)
h = f || l.b;
  int m = l.c;
  return 0;
}
void main() { k(d); }
***
gcc version:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/data/bin/gcc-dev/bin/gcc
COLLECT_LTO_WRAPPER=/data/bin/gcc-dev/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure --prefix=/data/bin/gcc-dev --disable-multilib
--enable-languages=c,c++
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210608 (experimental) (GCC)

git version: 1afa4facb9348cac0349ff9c30066aa25a3608f7
***
Command Lines:
$ gcc -O1 -finline-small-functions -fipa-cp -Wall -Wextra -fno-strict-aliasing
-fwrapv a.c -o a1.out
a.c: In function ‘k’:
a.c:10:17: warning: value computed is not used [-Wunused-value]
   10 |   for (; g; j() & l.c)
  | ^
a.c:16:7: warning: unused variable ‘m’ [-Wunused-variable]
   16 |   int m = l.c;
  |   ^
a.c: At top level:
a.c:19:6: warning: return type of ‘main’ is not ‘int’ [-Wmain]
   19 | void main() { k(d); }
  |  ^~~~
$ /data/bin/gcc-dev/bin/gcc a.c -o a2.out
$ ./a1.out
Segmentation fault (core dumped)
$ ./a2.out
$

[Bug tree-optimization/99296] New: ICE:in irange_set_anti_range, at value-range.cc:205 with "-Os -fno-toplevel-reorder -fno-tree-bit-ccp"

2021-02-26 Thread suochenyao at 163 dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99296

Bug ID: 99296
   Summary: ICE:in irange_set_anti_range, at value-range.cc:205
with "-Os -fno-toplevel-reorder -fno-tree-bit-ccp"
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: suochenyao at 163 dot com
  Target Milestone: ---

***
OS and Platform:
CentOS Linux release 7.8.2003 (Core), x86_64 GNU/Linux
***
Program:
struct {
  signed a : 1;
} b, c;
void d() { b.a |= c.a |= 0 != 2; }
int main() {}
***
gcc version:
$ gcc --version
gcc (GCC) 11.0.1 20210226 (experimental)
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
***
Command Lines:
$ gcc -Wall -Wextra -fno-strict-aliasing -fwrapv -Os -fno-toplevel-reorder
-fno-tree-bit-ccp a.c
during GIMPLE pass: evrp
a.c: In function ‘d’:
a.c:5:1: internal compiler error: in irange_set_anti_range, at
value-range.cc:205
5 | int main() {}
  | ^~~
0x7714e6 irange::irange_set_anti_range(tree_node*, tree_node*)
../../gcc/value-range.cc:205
0x18ff2ea irange::set_nonzero(tree_node*)
../../gcc/value-range.h:557
0x18ff2ea wi_optimize_and_or
../../gcc/range-op.cc:2204
0x1900620 operator_bitwise_or::wi_fold(irange&, tree_node*,
generic_wide_int const&, generic_wide_int
const&, generic_wide_int const&,
generic_wide_int const&) const
../../gcc/range-op.cc:2510
0x18f6897 range_operator::fold_range(irange&, tree_node*, irange const&, irange
const&) const
../../gcc/range-op.cc:153
0x17ff999 gimple_range_fold(irange&, gimple const*, irange const&, irange
const&)
../../gcc/gimple-range.cc:220
0x1803501 gimple_ranger::range_of_range_op(irange&, gimple*)
../../gcc/gimple-range.cc:444
0x18035c8 gimple_ranger::calc_stmt(irange&, gimple*, tree_node*)
../../gcc/gimple-range.cc:374
0x180398a gimple_ranger::range_of_stmt(irange&, gimple*, tree_node*)
../../gcc/gimple-range.cc:1068
0x17ff828 gimple_ranger::range_of_expr(irange&, tree_node*, gimple*)
../../gcc/gimple-range.cc:960
0x10fae61 range_query::value_of_expr(tree_node*, gimple*)
../../gcc/value-query.cc:86
0x180de81 hybrid_folder::value_of_expr(tree_node*, gimple*)
../../gcc/gimple-ssa-evrp.c:235
0xfa9966 substitute_and_fold_dom_walker::before_dom_children(basic_block_def*)
../../gcc/tree-ssa-propagate.c:1112
0x17d6197 dom_walker::walk(basic_block_def*)
../../gcc/domwalk.c:309
0xfa8b95 substitute_and_fold_engine::substitute_and_fold(basic_block_def*)
../../gcc/tree-ssa-propagate.c:1283
0x180daf6 execute_early_vrp
../../gcc/gimple-ssa-evrp.c:349
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.

[Bug tree-optimization/98117] New: wrong code with "-O3 -fno-tree-scev-cprop"

2020-12-03 Thread suochenyao at 163 dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98117

Bug ID: 98117
   Summary: wrong code with "-O3 -fno-tree-scev-cprop"
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: suochenyao at 163 dot com
  Target Milestone: ---

***
OS and Platform:
CentOS Linux release 7.8.2003 (Core), x86_64 GNU/Linux
***
Program:
$ cat a.c
int printf(const char *, ...);
int a=0;
char b=0, c=0;
short d=0;
void e() {
  for (; b; b++)
d = a + 8;
  for (; d;)
;
f:
  c++;
  if (c)
goto f;
}
int main() {
  e();
  printf("%d\n", c);
}
***
gcc version:
$ gcc --version
gcc (GCC) 11.0.0 20201203 (experimental)
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
***
Command Lines:
$ gcc a.c -o a1.o
$ gcc -Wall -Wextra -fno-strict-aliasing -fwrapv -O3 -fno-tree-scev-cprop  a.c
-o a2.o
$ ./a1.o
0
$ ./a2.o
-32

[Bug c/97980] New: wrong code with "-O3 -fno-dce -fno-inline-functions-called-once -fno-inline-small-functions -fno-tree-ccp -fno-tree-dce -fno-tree-vrp"

2020-11-24 Thread suochenyao at 163 dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97980

Bug ID: 97980
   Summary: wrong code with "-O3 -fno-dce
-fno-inline-functions-called-once
-fno-inline-small-functions -fno-tree-ccp
-fno-tree-dce -fno-tree-vrp"
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: suochenyao at 163 dot com
  Target Milestone: ---

***
OS and Platform:
CentOS Linux release 7.8.2003 (Core), x86_64 GNU/Linux
***
Program:
int a=2;
static int b(int *c) { (0 >= *c) & (a--); return 0; }
int main() {
  int d=0;
  b(&d);
}
***
gcc version:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/home/suocy/bin/gcc-dev/bin/gcc
COLLECT_LTO_WRAPPER=/home/suocy/bin/gcc-dev/libexec/gcc/x86_64-pc-linux-gnu/11.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure --prefix=/home/suocy/bin/gcc-dev/
--disable-multilib --enable-languages=c,c++
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.0.0 20201124 (experimental) (GCC)
***
Command Lines:
$ gcc -Wall -Wextra -fno-strict-aliasing -fwrapv -O3 -fno-dce
-fno-inline-functions-called-once -fno-inline-small-functions -fno-tree-ccp
-fno-tree-dce -fno-tree-vrp a.c
a.c: In function ‘b’:
a.c:2:34: warning: value computed is not used [-Wunused-value]
2 | static int b(int *c) { (0 >= *c) & (a--); return 0; }
  |~~^~~
a.c: In function ‘b.constprop.isra’:
a.c:2:30: warning: ‘c’ is used uninitialized [-Wuninitialized]
2 | static int b(int *c) { (0 >= *c) & (a--); return 0; }
  |  ^~
$ ./a.out
Segmentation fault

[Bug c/97979] New: internal compiler error: Segmentation fault with "-O3 -fno-toplevel-reorder -fno-tree-ccp"

2020-11-24 Thread suochenyao at 163 dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97979

Bug ID: 97979
   Summary: internal compiler error: Segmentation fault with "-O3
-fno-toplevel-reorder -fno-tree-ccp"
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: suochenyao at 163 dot com
  Target Milestone: ---

***
OS and Platform:
CentOS Linux release 7.8.2003 (Core), x86_64 GNU/Linux
***
Program:
short a=0;
int b=0;
void c() {
  unsigned short d = b;
  a = d >> 18446744073709551614;
}
int main() {}
***
gcc version:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/home/suocy/bin/gcc-dev/bin/gcc
COLLECT_LTO_WRAPPER=/home/suocy/bin/gcc-dev/libexec/gcc/x86_64-pc-linux-gnu/11.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure --prefix=/home/suocy/bin/gcc-dev/
--disable-multilib --enable-languages=c,c++
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.0.0 20201124 (experimental) (GCC)
***
Command Lines:
$ gcc -Wall -Wextra -fno-strict-aliasing -fwrapv -O3 -fno-toplevel-reorder
-fno-tree-ccp a.c
a.c: In function ‘c’:
a.c:5:12: warning: integer constant is so large that it is unsigned
5 |   a = d >> 18446744073709551614;
  |^~~~
a.c:5:9: warning: right shift count >= width of type [-Wshift-count-overflow]
5 |   a = d >> 18446744073709551614;
  | ^~
during GIMPLE pass: forwprop
a.c:3:6: internal compiler error: Segmentation fault
3 | void c() {
  |  ^
0xdeaf5f crash_signal
../../gcc/toplev.c:330
0xab3770 tree_swap_operands_p(tree_node const*, tree_node const*)
../../gcc/fold-const.c:7398
0x1224d14 gimple_resimplify2
../../gcc/gimple-match-head.c:298
0x128c1ea gimple_simplify_100
/home/suocy/src/gcc-dev/gcc/build/gcc/gimple-match.c:6581
0x128cedf gimple_simplify_RSHIFT_EXPR
/home/suocy/src/gcc-dev/gcc/build/gcc/gimple-match.c:107758
0x1224dac gimple_resimplify2
../../gcc/gimple-match-head.c:318
0x126535a gimple_simplify(gimple*, gimple_match_op*, gimple**, tree_node*
(*)(tree_node*), tree_node* (*)(tree_node*))
../../gcc/gimple-match-head.c:957
0xb20aee fold_stmt_1
../../gcc/gimple-fold.c:5930
0xf13111 execute
../../gcc/tree-ssa-forwprop.c:3103
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.

[Bug tree-optimization/97741] New: ICE: verify_gimple failed with "-Os -fno-toplevel-reorder -fno-tree-ccp -fno-tree-fre"

2020-11-06 Thread suochenyao at 163 dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97741

Bug ID: 97741
   Summary: ICE: verify_gimple failed with "-Os
-fno-toplevel-reorder -fno-tree-ccp -fno-tree-fre"
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: suochenyao at 163 dot com
  Target Milestone: ---

***
OS and Platform:
CentOS Linux release 7.8.2003 (Core), x86_64 GNU/Linux
***
Program:
short a = 0;
long b = 0;
char c = 0;
void d() {
  int e = 0;
f:
  for (a = 6; a;)
c = e;
  e = 0;
  for (; e == 20; ++e)
for (; b;)
  goto f;
}
int main() { return 0; }
***
gcc version:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/home/suocy/bin/gcc-dev/bin/gcc
COLLECT_LTO_WRAPPER=/home/suocy/bin/gcc-dev/libexec/gcc/x86_64-pc-linux-gnu/11.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure --prefix=/home/suocy/bin/gcc-dev
--disable-multilib --enable-languages=c,c++
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.0.0 20201106 (experimental) (GCC)
***
Command Lines:
$ gcc -Wall -Wextra -fno-strict-aliasing -fwrapv -Os -fno-toplevel-reorder
-fno-tree-ccp -fno-tree-fre a.c
a.c: In function ‘d’:
a.c:14:1: error: invalid types in nop conversion
   14 | int main() { return 0; }
  | ^~~
char
<<< error >>>
_1 = (char) _4;
during GIMPLE pass: evrp
a.c:14:1: internal compiler error: verify_gimple failed
0xe1a2ba verify_gimple_in_cfg(function*, bool)
../../gcc/tree-cfg.c:5461
0xcf7e17 execute_function_todo
../../gcc/passes.c:2039
0xcf887e execute_todo
../../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.

[Bug tree-optimization/97733] New: internal compiler error: in operator[], at vec.h:880 with "-O1 -fno-toplevel-reorder -fno-tree-bit-ccp -fno-tree-dce -fno-tree-dominator-opts -fno-tree-scev-cprop -f

2020-11-05 Thread suochenyao at 163 dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97733

Bug ID: 97733
   Summary: internal compiler error: in operator[], at vec.h:880
with "-O1 -fno-toplevel-reorder -fno-tree-bit-ccp
-fno-tree-dce -fno-tree-dominator-opts
-fno-tree-scev-cprop -ftree-loop-vectorize -ftree-pre"
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: suochenyao at 163 dot com
  Target Milestone: ---

***
OS and Platform:
CentOS Linux release 7.8.2003 (Core), x86_64 GNU/Linux
***
Program:
char a=0;
int b=0;
void c() {
  int d = 1;
  short e = 10;
  for (; b; b--) {
e &= a;
d &= 10;
  }
}
int main() { return 0; }
***
gcc version:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/home/suocy/bin/gcc-dev/bin/gcc
COLLECT_LTO_WRAPPER=/home/suocy/bin/gcc-dev/libexec/gcc/x86_64-pc-linux-gnu/11.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure --prefix=/home/suocy/bin/gcc-dev/
--disable-multilib --enable-languages=c,c++
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.0.0 20201105 (experimental) (GCC)
***
Command Lines:
$ gcc -Wall -Wextra -fno-strict-aliasing -fwrapv -O1 -fno-toplevel-reorder
-fno-tree-bit-ccp -fno-tree-dce -fno-tree-dominator-opts -fno-tree-scev-cprop
-ftree-loop-vectorize -ftree-pre a.c
during GIMPLE pass: vect
a.c: In function ‘c’:
a.c:3:6: internal compiler error: in operator[], at vec.h:880
3 | void c() {
  |  ^
0x74940e vec::operator[](unsigned int)
../../gcc/vec.h:880
0x74a335 vec<_stmt_vec_info*, va_heap, vl_embed>::operator[](unsigned int)
../../gcc/tree.h:3834
0x74a335 vec<_stmt_vec_info*, va_heap, vl_ptr>::operator[](unsigned int)
../../gcc/vec.h:1451
0x74a335 vect_build_slp_tree_2
../../gcc/tree-vect-slp.c:1415
0x105ea49 vect_build_slp_tree
../../gcc/tree-vect-slp.c:1372
0x1061671 vect_build_slp_instance
../../gcc/tree-vect-slp.c:2208
0x1062cc8 vect_analyze_slp_instance
../../gcc/tree-vect-slp.c:2545
0x1063281 vect_analyze_slp(vec_info*, unsigned int)
../../gcc/tree-vect-slp.c:2603
0x10488c8 vect_analyze_loop_2
../../gcc/tree-vect-loop.c:2285
0x10488c8 vect_analyze_loop(loop*, vec_info_shared*)
../../gcc/tree-vect-loop.c:2895
0x106f423 try_vectorize_loop_1
../../gcc/tree-vectorizer.c:995
0x106fee1 vectorize_loops()
../../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.

[Bug c/97650] New: ICE: tree check: expected ssa_name, have addr_expr in vect_get_and_check_slp_defs, at tree-vect-slp.c:533 with "-Os -ftree-slp-vectorize -fallow-store-data-races"

2020-10-30 Thread suochenyao at 163 dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97650

Bug ID: 97650
   Summary: ICE: tree check: expected ssa_name, have addr_expr in
vect_get_and_check_slp_defs, at tree-vect-slp.c:533
with "-Os -ftree-slp-vectorize
-fallow-store-data-races"
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: suochenyao at 163 dot com
  Target Milestone: ---

***
OS and Platform:
CentOS Linux release 7.8.2003 (Core), x86_64 GNU/Linux
***
Program:
short a=0;
unsigned long *volatile *volatile *volatile *b;
unsigned long *volatile *volatile *volatile **c[7];
void d() {
  short e=0;
  for (; a;) {
e = 0;
for (; e < 7; e++)
  c[e] = &b;
  }
}
int main() { return 0; }
***
gcc version:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/home/suocy/bin/gcc-dev/bin/gcc
COLLECT_LTO_WRAPPER=/home/suocy/bin/gcc-dev/libexec/gcc/x86_64-pc-linux-gnu/11.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure --prefix=/home/suocy/bin/gcc-dev/
--disable-multilib --enable-languages=c,c++
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.0.0 20201030 (experimental) (GCC)
***
Command Lines:
$ gcc -Wall -Wextra -fno-strict-aliasing -fwrapv -Os -ftree-slp-vectorize
-fallow-store-data-races a.c
during GIMPLE pass: slp
a.c: In function ‘d’:
a.c:4:6: internal compiler error: tree check: expected ssa_name, have addr_expr
in vect_get_and_check_slp_defs, at tree-vect-slp.c:533
4 | void d() {
  |  ^
0x74bc24 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
../../gcc/tree.c:9731
0x747607 tree_check(tree_node*, char const*, int, char const*, tree_code)
../../gcc/tree.h:3313
0x747607 vect_get_and_check_slp_defs
../../gcc/tree-vect-slp.c:533
0x1056988 vect_build_slp_tree_2
../../gcc/tree-vect-slp.c:1576
0x10565b9 vect_build_slp_tree
../../gcc/tree-vect-slp.c:1371
0x1056b9e vect_build_slp_tree_2
../../gcc/tree-vect-slp.c:1652
0x10565b9 vect_build_slp_tree
../../gcc/tree-vect-slp.c:1371
0x1056b9e vect_build_slp_tree_2
../../gcc/tree-vect-slp.c:1652
0x10565b9 vect_build_slp_tree
../../gcc/tree-vect-slp.c:1371
0x105933d vect_build_slp_instance
../../gcc/tree-vect-slp.c:2216
0x105ab8c vect_analyze_slp_instance
../../gcc/tree-vect-slp.c:2598
0x105b1b4 vect_analyze_slp(vec_info*, unsigned int)
../../gcc/tree-vect-slp.c:2626
0x106182f vect_slp_analyze_bb_1
../../gcc/tree-vect-slp.c:4139
0x106182f vect_slp_region
../../gcc/tree-vect-slp.c:4234
0x106182f vect_slp_bbs
../../gcc/tree-vect-slp.c:4382
0x1063364 vect_slp_function(function*)
../../gcc/tree-vect-slp.c:4468
0x1064e36 execute
../../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.

[Bug c/97493] generate wrong code with "-Os -fno-toplevel-reorder -frename-registers"

2020-10-30 Thread suochenyao at 163 dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97493

--- Comment #5 from suochenyao at 163 dot com  ---
***
I think this can be reproduced with "-fno-strict-aliasing"...
I am not sure whether it can be helpful...
***
OS and Platform:
CentOS Linux release 7.8.2003 (Core), x86_64 GNU/Linux
***
Program:
int printf(const char *, ...);
union {
  long a;
  int b;
} c;
int d=0;
long e=0;
long *f = &c.a;
short g=0;
int *h = &c.b;
short i(int j) {
  g = *h;
  *f = 3;
  for (;; e--) {
if (*h)
  return d;
*h = j;
  }
  return 0;
}
int main() {
  i(1);
  printf("%d\n", (int)e);
  return 0;
}
***
gcc version:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/home/suocy/bin/gcc-dev/bin/gcc
COLLECT_LTO_WRAPPER=/home/suocy/bin/gcc-dev/libexec/gcc/x86_64-pc-linux-gnu/11.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure --prefix=/home/suocy/bin/gcc-dev/
--disable-multilib --enable-languages=c,c++
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.0.0 20201029 (experimental) (GCC)
***
Command Lines:
$ gcc a.c -o a.o1
$ gcc -Wall -Wextra -fno-strict-aliasing -fwrapv -Og -fgcse -fstrict-aliasing
a.c -o a.o2
$ gcc -Og -fgcse -fstrict-aliasing a.c -o a.o3
$ ./a.o1
0
$ ./a.o2
-1
$ ./a.o3
-1

[Bug tree-optimization/97520] ICE in calc_stmt, at gimple-range.cc:399 with "-O1 -fno-tree-fre -ftree-vrp"

2020-10-30 Thread suochenyao at 163 dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97520

--- Comment #6 from suochenyao at 163 dot com  ---
(In reply to suochen...@163.com from comment #5)
> *
> **
> I think this can be reproduced with "-fno-strict-aliasing"...
> I am not sure whether it can be helpful...
> *
> **
> OS and Platform:
> CentOS Linux release 7.8.2003 (Core), x86_64 GNU/Linux
> *
> **
> Program:
> int printf(const char *, ...);
> union {
>   long a;
>   int b;
> } c;
> int d=0;
> long e=0;
> long *f = &c.a;
> short g=0;
> int *h = &c.b;
> short i(int j) {
>   g = *h;
>   *f = 3;
>   for (;; e--) {
> if (*h)
>   return d;
> *h = j;
>   }
>   return 0;
> }
> int main() {
>   i(1);
>   printf("%d\n", (int)e);
>   return 0;
> }
> *
> **
> gcc version:
> $ gcc -v
> Using built-in specs.
> COLLECT_GCC=/home/suocy/bin/gcc-dev/bin/gcc
> COLLECT_LTO_WRAPPER=/home/suocy/bin/gcc-dev/libexec/gcc/x86_64-pc-linux-gnu/
> 11.0.0/lto-wrapper
> Target: x86_64-pc-linux-gnu
> Configured with: ../configure --prefix=/home/suocy/bin/gcc-dev/
> --disable-multilib --enable-languages=c,c++
> Thread model: posix
> Supported LTO compression algorithms: zlib
> gcc version 11.0.0 20201029 (experimental) (GCC)
> *
> **
> Command Lines:
> $ gcc a.c -o a.o1
> $ gcc -Wall -Wextra -fno-strict-aliasing -fwrapv -Og -fgcse
> -fstrict-aliasing a.c -o a.o2
> $ gcc -Og -fgcse -fstrict-aliasing a.c -o a.o3
> $ ./a.o1
> 0
> $ ./a.o2
> -1
> $ ./a.o3
> -1

Sorry, comment to the wrong place...

[Bug tree-optimization/97520] ICE in calc_stmt, at gimple-range.cc:399 with "-O1 -fno-tree-fre -ftree-vrp"

2020-10-30 Thread suochenyao at 163 dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97520

--- Comment #5 from suochenyao at 163 dot com  ---
***
I think this can be reproduced with "-fno-strict-aliasing"...
I am not sure whether it can be helpful...
***
OS and Platform:
CentOS Linux release 7.8.2003 (Core), x86_64 GNU/Linux
***
Program:
int printf(const char *, ...);
union {
  long a;
  int b;
} c;
int d=0;
long e=0;
long *f = &c.a;
short g=0;
int *h = &c.b;
short i(int j) {
  g = *h;
  *f = 3;
  for (;; e--) {
if (*h)
  return d;
*h = j;
  }
  return 0;
}
int main() {
  i(1);
  printf("%d\n", (int)e);
  return 0;
}
***
gcc version:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/home/suocy/bin/gcc-dev/bin/gcc
COLLECT_LTO_WRAPPER=/home/suocy/bin/gcc-dev/libexec/gcc/x86_64-pc-linux-gnu/11.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure --prefix=/home/suocy/bin/gcc-dev/
--disable-multilib --enable-languages=c,c++
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.0.0 20201029 (experimental) (GCC)
***
Command Lines:
$ gcc a.c -o a.o1
$ gcc -Wall -Wextra -fno-strict-aliasing -fwrapv -Og -fgcse -fstrict-aliasing
a.c -o a.o2
$ gcc -Og -fgcse -fstrict-aliasing a.c -o a.o3
$ ./a.o1
0
$ ./a.o2
-1
$ ./a.o3
-1

[Bug c/97551] New: ICE: verify_cgraph_node failed with "-O2 -fno-toplevel-reorder -fno-tree-dce -fno-tree-forwprop -fno-tree-fre -fipa-cp-clone"

2020-10-23 Thread suochenyao at 163 dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97551

Bug ID: 97551
   Summary: ICE: verify_cgraph_node failed with "-O2
-fno-toplevel-reorder -fno-tree-dce -fno-tree-forwprop
-fno-tree-fre -fipa-cp-clone"
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: suochenyao at 163 dot com
  Target Milestone: ---

***
OS and Platform:
CentOS Linux release 7.8.2003 (Core), x86_64 GNU/Linux
***
Program:
int a=0, b=0;
char c=0;
long d=0;
long (e)(int f, int g) { return f && g || g > 0 && f || f <= 0 && g && f && g <
0 ?  : g; }
void h(int f) {
  for (; c;) {
e(7, d);
for (; a;)
  b = !f;
  }
}
void i() { h(0); }
int main() { return 0; }
***
gcc version:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/home/suocy/bin/gcc-dev/bin/gcc
COLLECT_LTO_WRAPPER=/home/suocy/bin/gcc-dev/libexec/gcc/x86_64-pc-linux-gnu/11.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure --prefix=/home/suocy/bin/gcc-dev/
--disable-multilib --enable-languages=c,c++
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.0.0 20201023 (experimental) (GCC)

git version: 43868df37b0e1fa19c32175b41dd7dc1e7c515fd
***
Command Lines:
$ gcc -Wall -Wextra -fno-strict-aliasing -fwrapv -O2 -fno-toplevel-reorder
-fno-tree-dce -fno-tree-forwprop -fno-tree-fre -fipa-cp-clone a.c
a.c: In function ‘e’:
a.c:4:35: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
4 | long (e)(int f, int g) { return f && g || g > 0 && f || f <= 0 && g &&
f && g < 0 ?  : g; }
  | ~~^~~~
a.c:4:74: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
4 | long (e)(int f, int g) { return f && g || g > 0 && f || f <= 0 && g &&
f && g < 0 ?  : g; }
  |
~^~~~
a.c:4:86: warning: the omitted middle operand in ‘?:’ will always be ‘true’,
suggest explicit middle operand [-Wparentheses]
4 | long (e)(int f, int g) { return f && g || g > 0 && f || f <= 0 && g &&
f && g < 0 ?  : g; }
  |
 ^
a.c: In function ‘i’:
a.c:12:12: error: edge points to wrong declaration:
   12 | void i() { h(0); }
  |^~~~
 >
QI
size 
unit-size 
align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7f04246400a8
arg-types 
chain >>
pointer_to_this >
readonly addressable used nothrow static decl_5 QI a.c:4:7 align:8
warn_if_not_align:0 context >
 Instead of: 
unit-size 
align:64 warn_if_not_align:0 symtab:0 alias-set 2 canonical-type
0x7f04244ed738 precision:64 min  max 
pointer_to_this >
QI
size 
unit-size 
align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7f042460d2a0
arg-types 
chain 
chain >>>
pointer_to_this >
readonly addressable asm_written used nothrow public static decl_5 QI
a.c:4:7 align:8 warn_if_not_align:0 context  initial 
result 
ignored regdecl DI a.c:4:7 size 
unit-size 
align:64 warn_if_not_align:0 context 
(reg:DI 0 ax [orig:89  ] [89])>
(mem:QI (symbol_ref:DI ("e") [flags 0x3] )
[0  S1 A8]) chain >
h.constprop.0/8 (h.constprop) @0x7f042462c540
  Type: function definition analyzed
  Visibility: no_reorder artificial
  References: d/3 (read) b/1 (write) a/0 (read) c/2 (read)
  Referring:
  Function h.constprop/8 is inline copy in i/6
  Availability: local
  Function flags: count:1073741824 (estimated locally) body local nonfreeing_fn
  Called by: i/6 (inlined) (1073741824 (estimated locally),1.00 per call)
  Calls: e.constprop.0.isra.0/10 (8687547438 (estimated locally),8.09 per call)
during IPA pass: inline
a.c:12:12: internal compiler error: verify_cgraph_node failed
0x9939e0 cgraph_node::verify_node()
../../gcc/cgraph.c:3800
0x9869d4 symtab_node::verify()
../../gcc/symtab.c:1318
0xe490cb expand_call_inline
../../gcc/tree-inline.c:4833
0xe4b9f9 gimple_expand_calls_inline
../../gcc/tree-inline.c:5266
0xe4b9f9 optimize_inline_calls(tree_node*)
../../gcc/tree-inline.c:5439
0xbb1a1b inline_transform(cgraph_node*)
../../gcc/ipa-inline-transform.c:749
0xceaf45 execute_one_ipa_transform_pass
../../gcc/passes.c:2240
0xceaf45 execute_all_ipa_transforms(bool)
../../gcc/passes.c:2

[Bug c/97520] New: ICE in calc_stmt, at gimple-range.cc:399 with "-O1 -fno-tree-fre -ftree-vrp"

2020-10-21 Thread suochenyao at 163 dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97520

Bug ID: 97520
   Summary: ICE in calc_stmt, at gimple-range.cc:399 with "-O1
-fno-tree-fre -ftree-vrp"
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: suochenyao at 163 dot com
  Target Milestone: ---

***
OS and Platform:
CentOS Linux release 7.8.2003 (Core), x86_64 GNU/Linux
***
Program:
char a;
void b() {
  char *c[5];
  char *d = &a;
  &d;
  *(c[4] = d);
}
int main() { return 0; }
***
gcc version:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/home/suocy/bin/gcc-dev/bin/gcc
COLLECT_LTO_WRAPPER=/home/suocy/bin/gcc-dev/libexec/gcc/x86_64-pc-linux-gnu/11.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure --prefix=/home/suocy/bin/gcc-dev
--disable-multilib --enable-languages=c,c++
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.0.0 20201020 (experimental) (GCC)
***
Command Lines:
$ gcc -Wall -Wextra -fno-strict-aliasing -fwrapv -O1 -fno-tree-fre -ftree-vrp
a.c
a.c: In function ‘b’:
a.c:5:3: warning: statement with no effect [-Wunused-value]
5 |   &d;
  |   ^~
a.c:6:3: warning: value computed is not used [-Wunused-value]
6 |   *(c[4] = d);
  |   ^~~
during GIMPLE pass: evrp
a.c:8:1: internal compiler error: in calc_stmt, at gimple-range.cc:399
8 | int main() { return 0; }
  | ^~~
0x7f6095 gimple_ranger::calc_stmt(irange&, gimple*, tree_node*)
../../gcc/gimple-range.cc:399
0x188dc5f gimple_ranger::range_of_stmt(irange&, gimple*, tree_node*)
../../gcc/gimple-range.cc:992
0x188a498 gimple_ranger::range_of_expr(irange&, tree_node*, gimple*)
../../gcc/gimple-range.cc:883
0x10a236d range_query::value_of_expr(tree_node*, gimple*)
../../gcc/value-query.cc:85
0x172bc71 hybrid_folder::value_of_expr(tree_node*, gimple*)
../../gcc/gimple-ssa-evrp.c:235
0xf5c73e substitute_and_fold_dom_walker::before_dom_children(basic_block_def*)
../../gcc/tree-ssa-propagate.c:1112
0x1703777 dom_walker::walk(basic_block_def*)
../../gcc/domwalk.c:309
0xf5b955 substitute_and_fold_engine::substitute_and_fold(basic_block_def*)
../../gcc/tree-ssa-propagate.c:1283
0x172b8e6 execute_early_vrp
../../gcc/gimple-ssa-evrp.c:349
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.

[Bug c/97493] generate wrong code with "-Os -fno-toplevel-reorder -frename-registers"

2020-10-20 Thread suochenyao at 163 dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97493

suochenyao at 163 dot com  changed:

   What|Removed |Added

 Status|WAITING |RESOLVED
 Resolution|--- |INVALID

[Bug c/97493] generate wrong code with "-Os -fno-toplevel-reorder -frename-registers"

2020-10-20 Thread suochenyao at 163 dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97493

--- Comment #4 from suochenyao at 163 dot com  ---
I made mistake, Jelinek is right.
This testcase is invalid and I can not reproduce it as well.
Sorry for wasting your time, my fault.
I apologize for wasting you time.

[Bug c/97493] New: generate wrong code with "-Os -fno-toplevel-reorder -frename-registers"

2020-10-19 Thread suochenyao at 163 dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97493

Bug ID: 97493
   Summary: generate wrong code with "-Os -fno-toplevel-reorder
-frename-registers"
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: suochenyao at 163 dot com
  Target Milestone: ---

Description:
I think gcc generates wrong code with -Os -fno-toplevel-reorder
-frename-registers.
But no difference is found with optimization levels.
No message and difference occurs with "gcc -Wall -Wextra" and
"-fno-strict-aliasing -fwrapv"
***
OS and Platform:
CentOS Linux release 7.8.2003 (Core), x86_64 GNU/Linux
***
Program:
int printf(const char *, ...);
union uuu{
  short a;
  long b;
} c={0};
long *d = &c.b;
short *e = &c.a;
short f=0;
int main() {
  *d = 3;
  f = ++*e;
  printf("%d\n", c.a);
}
***
Gcc Version:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/home/suocy/bin/gcc-dev/bin/gcc
COLLECT_LTO_WRAPPER=/home/suocy/bin/gcc-dev/libexec/gcc/x86_64-pc-linux-gnu/11.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure --prefix=/home/suocy/bin/gcc-dev
--disable-multilib --enable-languages=c,c++
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.0.0 20201018 (experimental) (GCC)
***
Command Line:
$ gcc -Wall -Wextra -fno-strict-aliasing -fwrapv -O0 a.c -o a.out0
$ gcc -Wall -Wextra -fno-strict-aliasing -fwrapv -O1 a.c -o a.out1
$ gcc -Wall -Wextra -fno-strict-aliasing -fwrapv -O2 a.c -o a.out2
$ gcc -Wall -Wextra -fno-strict-aliasing -fwrapv -O3 a.c -o a.out3
$ gcc -Wall -Wextra -fno-strict-aliasing -fwrapv -Os a.c -o a.outs
$ gcc -Wall -Wextra -fno-strict-aliasing -fwrapv -Os -fno-toplevel-reorder
-frename-registers a.c -o a.outf
$ ./a.out0 > out0
$ ./a.out1 > out1
$ ./a.out2 > out2
$ ./a.out3 > out3
$ ./a.outs > outs
$ ./a.outf > outf
$ diff out0 out1
$ diff out0 out2
$ diff out0 out3
$ diff out0 outs
$ diff out0 outf
1c1
< 4
---
> 1