[Bug c/82078] New: wrong code at -O3 in both 32-bit and 64-bit modes on x86_64-linux-gnu

2017-09-01 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82078

Bug ID: 82078
   Summary: wrong code at -O3 in both 32-bit and 64-bit modes on
x86_64-linux-gnu
   Product: gcc
   Version: 8.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/8.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 8.0.0 20170901 (experimental) [trunk revision 251580] (GCC)
$ gcc-trunk -O3 small.c ; ./a.out
2
$ gcc-trunk -O0 small.c ; ./a.out
0
$ cat small.c
int printf(const char *, ...);
struct S0 {
  signed f4;
  signed f9 : 5;
} a[6][5], b = {2}

;
int c, d;
int fn1() {
  struct S0 e[5][5];
  struct S0 f;
  b = f = e[2][5] = a[5][0];
  if (d)
;
  else
return f.f9;
  e[c][45] = a[4][4];
}

int main() {
  fn1();
  printf("%d\n", b.f4);
  return 0;
}
$

[Bug c/82052] New: ICE with "-O3 -m32" on x86_64-linux-gnu (internal compiler error: in pop_to_marker, at tree-ssa-scopedtables.c:71)

2017-08-31 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82052

Bug ID: 82052
   Summary: ICE with "-O3 -m32" on x86_64-linux-gnu (internal
compiler error: in pop_to_marker, at
tree-ssa-scopedtables.c:71)
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

Sorry about the large test program. I have tried everything and the attached is
the minimum I can get, though still large. 


$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/8.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 8.0.0 20170830 (experimental) [trunk revision 251549] (GCC) 
$ gcc-trunk -w -O3 -m32 small.c
during GIMPLE pass: dom
small.c: In function ‘main’:
small.c:336:5: internal compiler error: in pop_to_marker, at
tree-ssa-scopedtables.c:71
 int main() {
 ^~~~
0xe48b30 avail_exprs_stack::pop_to_marker()
../../gcc-source-trunk/gcc/tree-ssa-scopedtables.c:71
0xd98903 dom_opt_dom_walker::after_dom_children(basic_block_def*)
../../gcc-source-trunk/gcc/tree-ssa-dom.c:1379
0x1378697 dom_walker::walk(basic_block_def*)
../../gcc-source-trunk/gcc/domwalk.c:325
0xd9ca8b execute
../../gcc-source-trunk/gcc/tree-ssa-dom.c:691
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
$ cat small.c
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned uint32_t;
char a, t9, t22;
uint32_t c[56];
uint32_t d, t, t1, t5, t13, t19, t31, t36, t40;
struct {
  unsigned f0 : 1;
  unsigned f7 : 4;
} l, t3;
uint16_t g, t17, t29 = 65531, t42 = 1;
short m, t6, t11, t12, t20, t27 = 1, t34 = 7, t38, t43, s;
uint8_t p, u, t2, t4, t14, t24, t33, t44 = 50, t90;
int f, h = 5, n, o = 40211, q, v = 2, w, t7, t8, t10, t15, t16, t18, t21, t25,
   t26, t28, t30 = 3743393910, t32, t37 = 105423096, t39, t46, t47, t48,
   t49, t88, t89, x, y;
char r;
char t23;
uint16_t t35[][7][2];
static uint8_t t41;
char z[][8][3];
char fn1(char p1, int p2) { return p1 < 0 ?: p1 >> p2; }
short fn2() {}
void fn3(uint8_t p1) { d = d >> 8 ^ c[(d ^ p1) & 5]; }
void fn4(uint32_t p1, int p2) {
  int e;
  uint8_t b = e;
  d = 8 ^ c[(d ^ b) & 5];
  fn3(e >> 8);
  fn3(e >> 6);
  fn3(e >> 24);
  if (p2)
printf(0);
}
int fn5(p1) {
  if (t37)
for (; t28;)
  ;
}
uint16_t fn6(char p1, int p2) {
  int k;
  for (; t32; t32++)
for (; t32 < 8; t32++)
  fn4(t23, k);
}
uint8_t fn7(p1) { return 1; }
uint32_t fn8(uint8_t p1, uint32_t p2) {
  t22 = t44 | 1;
  t34--;
  l.f7 = p2;
  fn4(t18, t88);
  fn4(t17, t88);
  fn4(t3.f0, t88);
  fn4(t16, t88);
  fn4(t15, t88);
  fn4(t14, t88);
  fn4(t13, t88);
  fn4(t12, t88);
  fn4(t11, t88);
  fn4(t3.f7, t88);
  fn4(h, t39);
  fn4(t10, t88);
  fn4(t9, t88);
  fn4(t8, t88);
  fn4(t7, t88);
  fn4(t6, t88);
  fn4(t5, t88);
  return t32;
}
uint32_t fn9(p1) {
  h = 5;
  int t45;
  for (; o; o = 0)
if (n)
  break;
  f = 0;
  for (; f < 10; f++) {
t45 = 0;
for (; t45 < 3; t45++)
  fn4(z[f][t32][t45], f);
  }
  return t4;
}
short fn10(char p1, uint16_t p2, char p3, char p5) {
  int i, k, t91;
  z[t24][h][t89] = i = 0;
  for (; i < 6; i++)
fn4(t38, 1);
  if (p3 <= p1 != t90)
fn4(t41, 3);
  else {
t91 = 0;
for (; t91 < 3; t91++) {
  fn4(z[t32][i][t91], t37);
  if (t37) {
fn4(z[t39][t39][k], f);
if (f)
  printf("", t39);
printf("", t32);
  }
}
  }
  for (; p; p++) {
if (x)
  break;
if (t37)
  break;
  }
  for (; t24; t24++)
t29++;
  w = t29 = p5;
}
static int fn11() {
  char t50, t52;
  short t51, t56 = 49061, t65;
  uint32_t t53 = 3, t55 = 4272075807, t64;
  int t54 = 14,
  t57 = ~(t55 | t30 & t | ~(~t37 | (v | t43 / t53) | g >> (t56 & f))),
  t58 = ~(t57 ^ t53 | (t55 >> f & t37) / ~v & ~(t56 / ~g));
  uint16_t t59 = ~(t57 / (g | t | ~(t58 & t43) & t30 / (t55 / ~(v ^ t37;
LABEL_XgXgd:
  if (!(t56 < t58)) {
t57 = t30;
t58 = t59 = g;
t30 = ~(t58 & ~v & t & t56 | t53);
f = ~t57 | ~t & ~(t30 ^ f) / ~(t37 ^ ~t55 & (t43 | t59 | v)) ^ g;
if (t37) {
  printf("", (long long)t30, (long long)f);
  g = ~(~(~g | ~v << ~t37) << ~f << t43 | t53 / (t30 | t55));
  f = ~(~t59 ^ ~(~(t56 & t37) ^ t) >> t43 | ~t30 / t53 >> t57);
}
  }
  int t60 = ~((

[Bug c/81740] New: wrong code at -O3 in both 32-bit and 64-bit modes on x86_64-linux-gnu

2017-08-06 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81740

Bug ID: 81740
   Summary: wrong code at -O3 in both 32-bit and 64-bit modes on
x86_64-linux-gnu
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$ gcc-trunk -v 
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/8.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 8.0.0 20170806 (experimental) [trunk revision 250895] (GCC) 
$ 
$ gcc-trunk -O3 small.c ; ./a.out > O3.txt
$ gcc-trunk -O0 small.c ; ./a.out > O0.txt
$ diff O3.txt O0.txt 
37c37
< 0
---
> 4
$ cat small.c
extern int printf(const char *, ...);
int a[8][10];
short b;
int c, i, d;
int main() {
  a[2][5] = b = 4;
  for (; b; b--) {
c = 0;
for (; c <= 6; c++)
  a[c + 1][b + 2] = a[c][b + 1];
  }
  for (; i < 8; i++) {
d = 0;
for (; d < 10; d++)
  printf("%d\n", a[i][d]);
  }
  return 0;
}
$

[Bug c/81620] New: ICE on valid code at -O3 in both 32-bit and 64-bit modes on x86_64-linux-gnu (small.c:3:5: internal compiler error: in is_inv_store_elimination_chain, at tree-predcom.c:1651)

2017-07-30 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81620

Bug ID: 81620
   Summary: ICE on valid code at -O3 in both 32-bit and 64-bit
modes on x86_64-linux-gnu (small.c:3:5: internal
compiler error: in is_inv_store_elimination_chain, at
tree-predcom.c:1651)
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/8.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 8.0.0 20170730 (experimental) [trunk revision 250721] (GCC) 
$ gcc-trunk -O3 small.c
during GIMPLE pass: pcom
small.c: In function ‘main’:
small.c:3:5: internal compiler error: in is_inv_store_elimination_chain, at
tree-predcom.c:1651
 int main() {
 ^~~~
0xd25e10 is_inv_store_elimination_chain
../../gcc-source-trunk/gcc/tree-predcom.c:1651
0xd25e10 prepare_initializers_chain_store_elim
../../gcc-source-trunk/gcc/tree-predcom.c:2786
0xd25e10 prepare_initializers_chain
../../gcc-source-trunk/gcc/tree-predcom.c:2846
0xd25e10 prepare_initializers
../../gcc-source-trunk/gcc/tree-predcom.c:2901
0xd25e10 tree_predictive_commoning_loop
../../gcc-source-trunk/gcc/tree-predcom.c:3092
0xd25e10 tree_predictive_commoning()
../../gcc-source-trunk/gcc/tree-predcom.c:3170
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
$ cat small.c
int a[7];
char b;
int main() {
  b = 4;
  for (; b; b--) {
a[b] = b;
a[b + 2] = 1;
  }
  return 0;
}
$

[Bug c/81571] New: ICE at -O3 on x86_64-linux-gnu in both 32-bit and 64-bit modes (internal compiler error: in as_a, at is-a.h:192)

2017-07-26 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81571

Bug ID: 81571
   Summary: ICE at -O3 on x86_64-linux-gnu in both 32-bit and
64-bit modes (internal compiler error: in as_a, at
is-a.h:192)
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/8.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 8.0.0 20170726 (experimental) [trunk revision 250555] (GCC) 
$ gcc-trunk -O3 small.c
small.c: In function ‘fn1’:
small.c:2:7: warning: type of ‘p1’ defaults to ‘int’ [-Wimplicit-int]
 short fn1(p1) { return p1; }
   ^~~
during GIMPLE pass: vect
small.c: In function ‘main’:
small.c:6:5: internal compiler error: in as_a, at is-a.h:192
 int main() {
 ^~~~
0x5c7e8b as_a
../../gcc-source-trunk/gcc/is-a.h:192
0x5c7e96 as_a
../../gcc-source-trunk/gcc/is-a.h:192
0x5c7e96 gimple_phi_arg
../../gcc-source-trunk/gcc/gimple.h:4362
0x5c7e96 gimple_phi_arg_def
../../gcc-source-trunk/gcc/gimple.h:4406
0x5ca73e get_initial_defs_for_reduction
../../gcc-source-trunk/gcc/tree-vect-loop.c:4254
0x5cabc4 vect_create_epilog_for_reduction
../../gcc-source-trunk/gcc/tree-vect-loop.c:4476
0xecf1c0 vectorizable_reduction(gimple*, gimple_stmt_iterator*, gimple**,
_slp_tree*, _slp_instance*)
../../gcc-source-trunk/gcc/tree-vect-loop.c:6526
0xec072c vect_transform_stmt(gimple*, gimple_stmt_iterator*, bool*, _slp_tree*,
_slp_instance*)
../../gcc-source-trunk/gcc/tree-vect-stmts.c:8719
0xee2922 vect_schedule_slp_instance
../../gcc-source-trunk/gcc/tree-vect-slp.c:3724
0xee3233 vect_schedule_slp(vec_info*)
../../gcc-source-trunk/gcc/tree-vect-slp.c:3796
0xec87bb vect_transform_loop(_loop_vec_info*)
../../gcc-source-trunk/gcc/tree-vect-loop.c:7614
0xeeada3 vectorize_loops()
../../gcc-source-trunk/gcc/tree-vectorizer.c:745
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
$ cat small.c
int a, b, c, d;
short fn1(p1) { return p1; }

int fn2(int p1) {}

int main() {
  for (; c; c++)
a |= fn1(1, a) | fn2(b |= d);
  return 0;
}
$

[Bug c/80898] New: wrong code at -O2 and -O3 in both 32-bit and 64-bit modes on x86_64-linux-gnu

2017-05-27 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80898

Bug ID: 80898
   Summary: wrong code at -O2 and -O3 in both 32-bit and 64-bit
modes on x86_64-linux-gnu
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/8.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 8.0.0 20170527 (experimental) [trunk revision 248540] (GCC) 
$ 
$ gcc-trunk -m32 -O3 small.c ; ./a.out
0
$ gcc-trunk -m32 -Os small.c ; ./a.out
3
$ cat small.c
int printf(const char *, ...);
struct S0 {
  int f0 : 24;
  int f1;
  int f74;
} a, *c = &a;
struct S0 fn1() {
  struct S0 b = {4, 3};
  return b;
}

int main() {
  *c = fn1();
  printf("%d\n", a.f1);
  return 0;
}
$

--- Comment #1 from Chengnian Sun  ---
*** Bug 80900 has been marked as a duplicate of this bug. ***

[Bug c/80900] New: wrong code at -O2 and -O3 in both 32-bit and 64-bit modes on x86_64-linux-gnu

2017-05-27 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80900

Bug ID: 80900
   Summary: wrong code at -O2 and -O3 in both 32-bit and 64-bit
modes on x86_64-linux-gnu
   Product: gcc
   Version: unknown
Status: RESOLVED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
CC: chengniansun at gmail dot com
  Target Milestone: ---
Status: RESOLVED
CC: chengniansun at gmail dot com
Resolution: DUPLICATE

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/8.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 8.0.0 20170527 (experimental) [trunk revision 248540] (GCC) 
$ 
$ gcc-trunk -m32 -O3 small.c ; ./a.out
0
$ gcc-trunk -m32 -Os small.c ; ./a.out
3
$ cat small.c
int printf(const char *, ...);
struct S0 {
  int f0 : 24;
  int f1;
  int f74;
} a, *c = &a;
struct S0 fn1() {
  struct S0 b = {4, 3};
  return b;
}

int main() {
  *c = fn1();
  printf("%d\n", a.f1);
  return 0;
}
$

--- Comment #1 from Chengnian Sun  ---
Reported twice due to gateway timeout.

*** This bug has been marked as a duplicate of bug 80898 ***

[Bug c/80764] New: ICE at -O3 in both 32-bit and 64-bit modes on x86_64-linux-gnu (internal compiler error: in verify_loop_structure, at cfgloop.c:1644)

2017-05-15 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80764

Bug ID: 80764
   Summary: ICE at -O3 in both 32-bit and 64-bit modes on
x86_64-linux-gnu (internal compiler error: in
verify_loop_structure, at cfgloop.c:1644)
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/8.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 8.0.0 20170515 (experimental) [trunk revision 248042] (GCC) 
$ gcc-trunk -O3 small.c
small.c: In function ‘fn1.part.0’:
small.c:12:1: error: size of loop 9 should be 6, not 7
 }
 ^
small.c:12:1: error: loop 10’s latch does not have an edge to its header
small.c:12:1: internal compiler error: in verify_loop_structure, at
cfgloop.c:1644
0x7ba18a verify_loop_structure()
../../gcc-source-trunk/gcc/cfgloop.c:1644
0xb2ae3a execute_function_todo
../../gcc-source-trunk/gcc/passes.c:1984
0xb2b855 execute_todo
../../gcc-source-trunk/gcc/passes.c:2022
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
$ cat small.c
int b, d, f, h;
char e;
int fn1();
int main() { return fn1(); }
int fn1(int p1) {
  for (; d;)
for (; e < 3;) {
  for (; h;)
b = fn1(0);
  return f;
}
}
$

[Bug c/80622] New: wrong code at -O1 and above in both 32-bit and 64-bit modes on x86_64-linux-gnu

2017-05-03 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80622

Bug ID: 80622
   Summary: wrong code at -O1 and above in both 32-bit and 64-bit
modes on x86_64-linux-gnu
   Product: gcc
   Version: 7.0.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/8.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 8.0.0 20170503 (experimental) [trunk revision 247550] (GCC) 
$ gcc-trunk small.c -O3 ; ./a.out
0
$ gcc-trunk small.c -O3 -m32 ; ./a.out
0
$ gcc-trunk small.c -O1 -m32 ; ./a.out
0
$ gcc-trunk small.c -O0 -m32 ; ./a.out
4
$ 
$ cat small.c
int printf(const char *, ...);
struct S2 {
  int f2;
  char f4;
  int f5;
  char f6;
} a;
int main() {
  struct S2 b[][1] = {3, 0, 3, 4, 3, 0, 3, 4, 3, 0, 3, 4, 3, 0, 3, 4, 3,
  0, 3, 4, 3, 0, 3, 4, 3, 0, 3, 4, 3, 0, 3, 4, 3, 0,
  3, 4, 3, 4, 7, 7, 3, 5, 0, 3, 4, 7, 7, 3, 5, 0, 3,
  4, 3, 4, 7, 7, 3, 5, 0, 3, 4, 7, 7, 3, 5, 0, 3, 4};
  a = b[4][0];
  b[4][0].f4 &printf("%d\n", a.f6);
  return 0;
}
$
$ gcc-5.4 small.c -O3 -m32 ; ./a.out
4
$

[Bug bootstrap/80565] New: ICE at -O2 and -O3 in 32-bit mode (not 64-bit) on x86_64-linux-gnu (in edge_badness, at ipa-inline.c:1028)

2017-04-29 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80565

Bug ID: 80565
   Summary: ICE at -O2 and -O3 in 32-bit mode (not 64-bit) on
x86_64-linux-gnu (in edge_badness, at
ipa-inline.c:1028)
   Product: gcc
   Version: 8.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: bootstrap
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/8.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 8.0.0 20170429 (experimental) [trunk revision 247405] (GCC) 
$ gcc-trunk -m32 -O2 small.c
small.c: In function ‘fn2’:
small.c:4:14: warning: type of ‘p1’ defaults to ‘int’ [-Wimplicit-int]
 static short fn2(p1) {
  ^~~
small.c: At top level:
small.c:39:1: internal compiler error: in edge_badness, at ipa-inline.c:1028
 }
 ^
0x139f133 edge_badness
../../gcc-source-trunk/gcc/ipa-inline.c:1028
0x13a037b update_edge_key
../../gcc-source-trunk/gcc/ipa-inline.c:1224
0x13a08da update_caller_keys
../../gcc-source-trunk/gcc/ipa-inline.c:1351
0x13a269f inline_small_functions
../../gcc-source-trunk/gcc/ipa-inline.c:2045
0x13a269f ipa_inline
../../gcc-source-trunk/gcc/ipa-inline.c:2438
0x13a269f execute
../../gcc-source-trunk/gcc/ipa-inline.c:2849
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
$ cat small.c
int a, b, c, e, h, j;
char d;
short f, g;
static short fn2(p1) {
  for (;;)
for (; g; g++)
  if (p1)
break;
}

static short fn3();
static char fn4(char p1) {
  int i;
  for (; d;)
f = 8;
  for (; f; f = 0)
for (; i; i++) {
  j = 0;
  for (; j; j++)
;
}
}

static short fn1(short p1) { fn2(b || fn3()); }

short fn3() {
  if (c) {
fn4(e);
h = 0;
for (;; h++)
  ;
  }
}

int main() {
  for (; a;)
fn1(c);
  return 0;
}

[Bug c/80549] New: wrong code at -O2 and -O3 in both 32-bit and 64-bit modes on x86_64-linux-gnu (executable does not terminate)

2017-04-27 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80549

Bug ID: 80549
   Summary: wrong code at -O2 and -O3 in both 32-bit and 64-bit
modes on x86_64-linux-gnu (executable does not
terminate)
   Product: gcc
   Version: 7.0.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/8.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 8.0.0 20170424 (experimental) [trunk revision 247088] (GCC) 
$ gcc-trunk -O2 small.c ; timeout -s 9 10 ./a.out
Killed
$ cat small.c
char a, b;
int c;
short d;
void fn1(int p1) {
  short e = 4;
  int f;
  d = 0;
  for (; d <= 0; d++)
e = 0;
  if (e)
goto L1;
L2:
  if (p1) {
a = 9;
for (; a; ++a) {
  f = 5;
  for (; f != 32; ++f)
c = 8;
L1:
  if (b)
goto L2;
}
  }
}

int main() {
  fn1(1);
  return 0;
}
$ 
$

[Bug c/79740] New: ICE on -Os and above in both 32-bit and 64-bit modes on x86_64-linux-gnu (internal compiler error: in VN_INFO_GET, at tree-ssa-sccvn.c:407 })

2017-02-27 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79740

Bug ID: 79740
   Summary: ICE on -Os and above in both 32-bit and 64-bit modes
on x86_64-linux-gnu (internal compiler error: in
VN_INFO_GET, at tree-ssa-sccvn.c:407  })
   Product: gcc
   Version: 7.0.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.1 20170227 (experimental) [trunk revision 245760] (GCC) 
$ 
$ gcc-trunk -O3 small.c
small.c: In function ‘main’:
small.c:15:1: internal compiler error: in VN_INFO_GET, at tree-ssa-sccvn.c:407
 }
 ^
0xddcc76 VN_INFO_GET(tree_node*)
../../gcc-source-trunk/gcc/tree-ssa-sccvn.c:406
0xdb52c8 eliminate_insert
../../gcc-source-trunk/gcc/tree-ssa-pre.c:4133
0xdb52c8 eliminate_dom_walker::before_dom_children(basic_block_def*)
../../gcc-source-trunk/gcc/tree-ssa-pre.c:4267
0x1307ca7 dom_walker::walk(basic_block_def*)
../../gcc-source-trunk/gcc/domwalk.c:265
0xdb5b0f eliminate
../../gcc-source-trunk/gcc/tree-ssa-pre.c:4728
0xdb5e6d execute
../../gcc-source-trunk/gcc/tree-ssa-pre.c:5162
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
$ 
$ cat small.c
int a;
short b;
short fn1(unsigned short p1) { return p1 << a; }

int main() {
  short c;
  int d = 4;
  for (; b;) {
c = d + 1;
fn1(c);
d = 0;
  }
  d++;
  return 0;
}
$

[Bug c++/78765] New: ICE on invalid C++ code on x86_64-linux-gnu (internal compiler error: in cp_build_addr_expr_1, at cp/typeck.c:5708)

2016-12-10 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78765

Bug ID: 78765
   Summary: ICE on invalid C++ code on x86_64-linux-gnu (internal
compiler error: in cp_build_addr_expr_1, at
cp/typeck.c:5708)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20161210 (experimental) [trunk revision 243516] (GCC) 
$ 
$ gcc-trunk small.C
small.C:6:42: error: ‘v’ was not declared in this scope
   static constexpr ValueType doubleval = v;
  ^
small.C: In function ‘int main()’:
small.C:9:52: internal compiler error: in cp_build_addr_expr_1, at
cp/typeck.c:5708
 int main() { ValueTypeInfo }
^
0x7eb7d5 cp_build_addr_expr_1
../../gcc-source-trunk/gcc/cp/typeck.c:5708
0x683162 add_function_candidate
../../gcc-source-trunk/gcc/cp/call.c:2158
0x6848c7 add_candidates
../../gcc-source-trunk/gcc/cp/call.c:5491
0x67f9e4 build_user_type_conversion_1
../../gcc-source-trunk/gcc/cp/call.c:3842
0x680a8a implicit_conversion
../../gcc-source-trunk/gcc/cp/call.c:1898
0x6890dd build_integral_nontype_arg_conv(tree_node*, tree_node*, int)
../../gcc-source-trunk/gcc/cp/call.c:4025
0x70afa5 convert_nontype_argument
../../gcc-source-trunk/gcc/cp/pt.c:6434
0x711eed convert_template_argument
../../gcc-source-trunk/gcc/cp/pt.c:7363
0x71fa63 coerce_template_parms
../../gcc-source-trunk/gcc/cp/pt.c:7823
0x72199a lookup_template_class_1
../../gcc-source-trunk/gcc/cp/pt.c:8396
0x72199a lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
../../gcc-source-trunk/gcc/cp/pt.c:8738
0x836bed finish_template_type(tree_node*, tree_node*, int)
../../gcc-source-trunk/gcc/cp/semantics.c:3146
0x7bea14 cp_parser_template_id
../../gcc-source-trunk/gcc/cp/parser.c:15464
0x7becba cp_parser_class_name
../../gcc-source-trunk/gcc/cp/parser.c:21879
0x7af07d cp_parser_qualifying_entity
../../gcc-source-trunk/gcc/cp/parser.c:6293
0x7af07d cp_parser_nested_name_specifier_opt
../../gcc-source-trunk/gcc/cp/parser.c:5977
0x7acd20 cp_parser_simple_type_specifier
../../gcc-source-trunk/gcc/cp/parser.c:16793
0x7aa261 cp_parser_type_specifier
../../gcc-source-trunk/gcc/cp/parser.c:16464
0x7bf3d3 cp_parser_decl_specifier_seq
../../gcc-source-trunk/gcc/cp/parser.c:13303
0x7c9770 cp_parser_simple_declaration
../../gcc-source-trunk/gcc/cp/parser.c:12646
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$ 
$ cat small.C
class ValueType {
  operator int();
  int m_ID;
};
class ValueTypeEnum {
  static constexpr ValueType doubleval = v;
};
template  class ValueTypeInfo;
int main() { ValueTypeInfo }
$

[Bug c++/78649] New: ICE on invalid C++ code on x86_64-linux-gnu (internal compiler error: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in build_value_init_noctor, at cp/init.c:3

2016-12-02 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78649

Bug ID: 78649
   Summary: ICE on invalid C++ code on x86_64-linux-gnu (internal
compiler error: tree check: expected class ‘type’,
have ‘exceptional’ (error_mark) in
build_value_init_noctor, at cp/init.c:380)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20161202 (experimental) [trunk revision 243153] (GCC) 
$ 
$ gcc-trunk small.C
small.C: In instantiation of ‘void test() [with T = void; Args = {}]’:
small.C:4:24:   required from here
small.C:2:51: error: variable or field ‘t’ declared void
 template  void test() { T t(create...); }
   ^
small.C:2:51: internal compiler error: tree check: expected class ‘type’, have
‘exceptional’ (error_mark) in build_value_init_noctor, at cp/init.c:380
0x10a1c87 tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
../../gcc-source-trunk/gcc/tree.c:9865
0x80db2b tree_class_check
../../gcc-source-trunk/gcc/tree.h:3169
0x80db2b build_value_init_noctor(tree_node*, int)
../../gcc-source-trunk/gcc/cp/init.c:380
0x80dbbd build_value_init(tree_node*, int)
../../gcc-source-trunk/gcc/cp/init.c:369
0x5e31a2 tsubst_init
../../gcc-source-trunk/gcc/cp/pt.c:14095
0x6fb2aa tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc-source-trunk/gcc/cp/pt.c:15500
0x6f79f3 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc-source-trunk/gcc/cp/pt.c:15618
0x6f50ce instantiate_decl(tree_node*, int, bool)
../../gcc-source-trunk/gcc/cp/pt.c:22536
0x7373f2 instantiate_pending_templates(int)
../../gcc-source-trunk/gcc/cp/pt.c:22655
0x77e8b1 c_parse_final_cleanups()
../../gcc-source-trunk/gcc/cp/decl2.c:4512
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$ 
$ cat small.C
template  void create();
template  void test() { T t(create...); }

int main() { test; }
$

[Bug c++/78648] New: ICE on invalid C++ code on x86_64-linux-gnu (Segmentation fault, contains_struct_check)

2016-12-02 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78648

Bug ID: 78648
   Summary: ICE on invalid C++ code on x86_64-linux-gnu
(Segmentation fault, contains_struct_check)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20161202 (experimental) [trunk revision 243153] (GCC) 
$ 
$ gcc-trunk small.C
small.C: In function ‘void bar()’:
small.C:4:14: error: invalid use of cv-qualified type ‘const void’ in parameter
declaration
   e([](const void) {});
  ^~~~
small.C: In instantiation of ‘void e(F) [with F = bar() [with int  =
1]::]’:
small.C:1:28: internal compiler error: Segmentation fault
 template  void e(F) {}
^
0xdf7cff crash_signal
../../gcc-source-trunk/gcc/toplev.c:333
0x8787d3 contains_struct_check
../../gcc-source-trunk/gcc/tree.h:3159
0x8787d3 write_closure_type_name
../../gcc-source-trunk/gcc/cp/mangle.c:1641
0x8787d3 write_unqualified_name
../../gcc-source-trunk/gcc/cp/mangle.c:1385
0x87e667 write_name
../../gcc-source-trunk/gcc/cp/mangle.c:939
0x87e528 write_local_name
../../gcc-source-trunk/gcc/cp/mangle.c:2027
0x87e528 write_name
../../gcc-source-trunk/gcc/cp/mangle.c:966
0x87f091 write_class_enum_type
../../gcc-source-trunk/gcc/cp/mangle.c:2769
0x87f091 write_type
../../gcc-source-trunk/gcc/cp/mangle.c:2187
0x87e0fc write_template_args
../../gcc-source-trunk/gcc/cp/mangle.c:2798
0x87e433 write_name
../../gcc-source-trunk/gcc/cp/mangle.c:935
0x883658 write_encoding
../../gcc-source-trunk/gcc/cp/mangle.c:823
0x88568c mangle_decl_string
../../gcc-source-trunk/gcc/cp/mangle.c:3743
0x8857d8 get_mangled_id
../../gcc-source-trunk/gcc/cp/mangle.c:3765
0x885a80 mangle_decl(tree_node*)
../../gcc-source-trunk/gcc/cp/mangle.c:3835
0x10a2490 decl_assembler_name(tree_node*)
../../gcc-source-trunk/gcc/tree.c:671
0x9f1231 symtab_node::get_comdat_group_id()
../../gcc-source-trunk/gcc/cgraph.h:210
0x9f1231 analyze_functions
../../gcc-source-trunk/gcc/cgraphunit.c:1037
0x9f29f8 symbol_table::finalize_compilation_unit()
../../gcc-source-trunk/gcc/cgraphunit.c:2562
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$ 
$ cat small.C
template  void e(F) {}

template  void bar() {
  e([](const void) {});
}

void baz() { bar<1>; }
$

[Bug c++/78647] New: ICE on invalid C++ code on x86_64-linux-gnu (internal compiler error: tree check: expected tree_list, have error_mark in get_attribute_name, at attribs.c:664)

2016-12-02 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78647

Bug ID: 78647
   Summary: ICE on invalid C++ code on x86_64-linux-gnu (internal
compiler error: tree check: expected tree_list, have
error_mark in get_attribute_name, at attribs.c:664)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20161202 (experimental) [trunk revision 243153] (GCC) 
$ 
$ gcc-trunk small.C
small.C: In function ‘void f()’:
small.C:3:35: error: expected primary-expression before ‘)’ token
 void f() { alignas(do_not_remove(A)); }
   ^
small.C:3:37: internal compiler error: tree check: expected tree_list, have
error_mark in get_attribute_name, at attribs.c:664
 void f() { alignas(do_not_remove(A)); }
 ^
0x10a150c tree_check_failed(tree_node const*, char const*, int, char const*,
...)
../../gcc-source-trunk/gcc/tree.c:9814
0x8e5445 tree_check
../../gcc-source-trunk/gcc/tree.h:3302
0x8e5445 get_attribute_name(tree_node const*)
../../gcc-source-trunk/gcc/attribs.c:664
0x10a3645 private_lookup_attribute(char const*, unsigned long, tree_node*)
../../gcc-source-trunk/gcc/tree.c:6100
0x914ab3 lookup_attribute
../../gcc-source-trunk/gcc/tree.h:4163
0x914ab3 attribute_fallthrough_p(tree_node*)
../../gcc-source-trunk/gcc/c-family/c-common.c:5561
0x7ca009 cp_parser_statement
../../gcc-source-trunk/gcc/cp/parser.c:10696
0x7cb22c cp_parser_statement_seq_opt
../../gcc-source-trunk/gcc/cp/parser.c:11019
0x7cb31f cp_parser_compound_statement
../../gcc-source-trunk/gcc/cp/parser.c:10973
0x7c5e1f cp_parser_function_body
../../gcc-source-trunk/gcc/cp/parser.c:21357
0x7c5e1f cp_parser_ctor_initializer_opt_and_function_body
../../gcc-source-trunk/gcc/cp/parser.c:21393
0x7c6701 cp_parser_function_definition_after_declarator
../../gcc-source-trunk/gcc/cp/parser.c:26151
0x7c7939 cp_parser_function_definition_from_specifiers_and_declarator
../../gcc-source-trunk/gcc/cp/parser.c:26063
0x7c7939 cp_parser_init_declarator
../../gcc-source-trunk/gcc/cp/parser.c:19109
0x7c7db9 cp_parser_simple_declaration
../../gcc-source-trunk/gcc/cp/parser.c:12764
0x7c8a21 cp_parser_block_declaration
../../gcc-source-trunk/gcc/cp/parser.c:12591
0x7cf850 cp_parser_declaration
../../gcc-source-trunk/gcc/cp/parser.c:12488
0x7cfc54 cp_parser_declaration_seq_opt
../../gcc-source-trunk/gcc/cp/parser.c:12364
0x7cff98 cp_parser_translation_unit
../../gcc-source-trunk/gcc/cp/parser.c:4368
0x7cff98 c_parse_file()
../../gcc-source-trunk/gcc/cp/parser.c:38262
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$ 
$ cat small.C
struct A;
void do_not_remove();
void f() { alignas(do_not_remove(A)); }
$

[Bug c++/78645] New: ICE on invalid C++ code on x86_64-linux-gnu (Segmentation fault, cxx_eval_call_expression)

2016-12-02 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78645

Bug ID: 78645
   Summary: ICE on invalid C++ code on x86_64-linux-gnu
(Segmentation fault, cxx_eval_call_expression)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20161202 (experimental) [trunk revision 243153] (GCC) 
$ 
$ gcc-trunk small.C
small.C:4:29: error: invalid conversion from ‘bool (*)(int, Function) {aka bool
(*)(int, bool (*)(int))}’ to ‘Function {aka bool (*)(int)}’ [-fpermissive]
 static_assert(check(2, check));
 ^
small.C:2:16: note:   initializing argument 2 of ‘constexpr bool check(int,
Function)’
 constexpr bool check(int x, Function p) { p(x); }
^
small.C:4:20:   in constexpr expansion of ‘check(2, ((Function)check))’
small.C:2:44:   in constexpr expansion of ‘p(x)’
small.C:4:31: internal compiler error: Segmentation fault
 static_assert(check(2, check));
   ^
0xdf7cff crash_signal
../../gcc-source-trunk/gcc/toplev.c:333
0x8d83eb hash_table, tree_node*>
>::hash_entry, xcallocator>::remove_elt_with_hash(tree_node* const&, unsigned
int)
../../gcc-source-trunk/gcc/hash-table.h:920
0x8cacf9 hash_map, tree_node*>
>::remove(tree_node* const&)
../../gcc-source-trunk/gcc/hash-map.h:174
0x8cacf9 cxx_eval_call_expression
../../gcc-source-trunk/gcc/cp/constexpr.c:1655
0x8cc073 cxx_eval_constant_expression
../../gcc-source-trunk/gcc/cp/constexpr.c:3847
0x8cbf4c cxx_eval_constant_expression
../../gcc-source-trunk/gcc/cp/constexpr.c:4218
0x8cc0b6 cxx_eval_constant_expression
../../gcc-source-trunk/gcc/cp/constexpr.c:3966
0x8cc0b6 cxx_eval_constant_expression
../../gcc-source-trunk/gcc/cp/constexpr.c:3966
0x8caba6 cxx_eval_call_expression
../../gcc-source-trunk/gcc/cp/constexpr.c:1619
0x8cc073 cxx_eval_constant_expression
../../gcc-source-trunk/gcc/cp/constexpr.c:3847
0x8d3469 cxx_eval_outermost_constant_expr
../../gcc-source-trunk/gcc/cp/constexpr.c:4481
0x8d6968 maybe_constant_value_1
../../gcc-source-trunk/gcc/cp/constexpr.c:4685
0x8d6968 maybe_constant_value(tree_node*, tree_node*)
../../gcc-source-trunk/gcc/cp/constexpr.c:4709
0x83b925 finish_static_assert(tree_node*, tree_node*, unsigned int, bool)
../../gcc-source-trunk/gcc/cp/semantics.c:8774
0x7b58a0 cp_parser_static_assert
../../gcc-source-trunk/gcc/cp/parser.c:13597
0x7c8dc9 cp_parser_block_declaration
../../gcc-source-trunk/gcc/cp/parser.c:12587
0x7cf850 cp_parser_declaration
../../gcc-source-trunk/gcc/cp/parser.c:12488
0x7cfc54 cp_parser_declaration_seq_opt
../../gcc-source-trunk/gcc/cp/parser.c:12364
0x7cff98 cp_parser_translation_unit
../../gcc-source-trunk/gcc/cp/parser.c:4368
0x7cff98 c_parse_file()
../../gcc-source-trunk/gcc/cp/parser.c:38262
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$ 
$ cat small.C
typedef bool (*Function)(int);
constexpr bool check(int x, Function p) { p(x); }

static_assert(check(2, check));
$

[Bug c++/78637] New: ICE on invalid C++ code on x86_64-linux-gnu (internal compiler error: in pop_namespace, at cp/name-lookup.c:3826)

2016-12-01 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78637

Bug ID: 78637
   Summary: ICE on invalid C++ code on x86_64-linux-gnu (internal
compiler error: in pop_namespace, at
cp/name-lookup.c:3826)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20161201 (experimental) [trunk revision 243118] (GCC)
$
$ gcc-trunk small.C
small.C:4:14: error: ‘namespace X::Y { }’ redeclared as different kind of
symbol
 namespace X::Y z;
  ^
small.C:2:7: note: previous declaration ‘class X::Y’
 class Y;
   ^
small.C:4:16: error: expected ‘{’ before ‘z’
 namespace X::Y z;
^
small.C:4:16: error: ‘z’ does not name a type
small.C:4:17: internal compiler error: in pop_namespace, at
cp/name-lookup.c:3826
 namespace X::Y z;
 ^
0x890072 pop_namespace()
../../gcc-source-trunk/gcc/cp/name-lookup.c:3826
0x7d11bf cp_parser_namespace_definition
../../gcc-source-trunk/gcc/cp/parser.c:18226
0x7d07db cp_parser_declaration
../../gcc-source-trunk/gcc/cp/parser.c:12472
0x7d0ab4 cp_parser_declaration_seq_opt
../../gcc-source-trunk/gcc/cp/parser.c:12364
0x7d0df8 cp_parser_translation_unit
../../gcc-source-trunk/gcc/cp/parser.c:4368
0x7d0df8 c_parse_file()
../../gcc-source-trunk/gcc/cp/parser.c:38262
0x935c32 c_common_parse_file()
../../gcc-source-trunk/gcc/c-family/c-opts.c:1098
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$
$ cat small.C
namespace X {
class Y;
}
namespace X::Y z;
$

[Bug c/78583] New: ICE on valid C code at -O3 on x86_64-linux-gnu (internal compiler error: in simplify_truncation)

2016-11-29 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78583

Bug ID: 78583
   Summary: ICE on valid C code at -O3 on x86_64-linux-gnu
(internal compiler error: in simplify_truncation)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20161129 (experimental) [trunk revision 242953] (GCC) 
$ 
$ 
$ gcc-trunk -O3 small.c
small.c: In function ‘main’:
small.c:10:1: internal compiler error: in simplify_truncation, at
simplify-rtx.c:640
 }
 ^
0xbc17bc simplify_truncation
../../gcc-source-trunk/gcc/simplify-rtx.c:640
0xbc069e simplify_unary_operation_1
../../gcc-source-trunk/gcc/simplify-rtx.c:1193
0xbc069e simplify_unary_operation(rtx_code, machine_mode, rtx_def*,
machine_mode)
../../gcc-source-trunk/gcc/simplify-rtx.c:877
0xbc1070 simplify_gen_unary(rtx_code, machine_mode, rtx_def*, machine_mode)
../../gcc-source-trunk/gcc/simplify-rtx.c:384
0xbc12a5 simplify_truncation
../../gcc-source-trunk/gcc/simplify-rtx.c:773
0xbc21e8 simplify_gen_subreg(machine_mode, rtx_def*, machine_mode, unsigned
int)
../../gcc-source-trunk/gcc/simplify-rtx.c:6259
0x12a4f2e gen_lowpart_for_combine
../../gcc-source-trunk/gcc/combine.c:11465
0x12a65d3 get_last_value
../../gcc-source-trunk/gcc/combine.c:13373
0x12a6671 if_then_else_cond
../../gcc-source-trunk/gcc/combine.c:9165
0x12a6749 if_then_else_cond
../../gcc-source-trunk/gcc/combine.c:9035
0x12a6732 if_then_else_cond
../../gcc-source-trunk/gcc/combine.c:9034
0x12b3d0d combine_simplify_rtx
../../gcc-source-trunk/gcc/combine.c:5604
0x12b6572 subst
../../gcc-source-trunk/gcc/combine.c:5487
0x12b6228 subst
../../gcc-source-trunk/gcc/combine.c:5432
0x12b604a subst
../../gcc-source-trunk/gcc/combine.c:5355
0x12b784a try_combine
../../gcc-source-trunk/gcc/combine.c:3272
0x12bd181 combine_instructions
../../gcc-source-trunk/gcc/combine.c:1265
0x12bd181 rest_of_handle_combine
../../gcc-source-trunk/gcc/combine.c:14581
0x12bd181 execute
../../gcc-source-trunk/gcc/combine.c:14626
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$ 
$ cat small.c
int a[1];
int b;
unsigned short c;
void fn1(int p1) { b = a[a[a[a[a[a[a[a[b ^ p1; }

int main() {
  long d = c;
  fn1(d & d >> 8 & 5);
  return 0;
}
$

[Bug c/78574] New: ice on valid C code at -O2 and -O3 in both 32- and 64-bit modes on x86_64-linux-gnu (internal compiler error: Segmentation fault (program cc1))

2016-11-28 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78574

Bug ID: 78574
   Summary: ice on valid C code at -O2 and -O3 in both 32- and
64-bit modes on x86_64-linux-gnu (internal compiler
error: Segmentation fault (program cc1))
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20161128 (experimental) [trunk revision 242906] (GCC) 
$ 
$ gcc-trunk -O3 small.c
gcc-trunk: internal compiler error: Segmentation fault (program cc1)
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
$ 
$ cat small.c
int a, d, f, g;
int b[1];
short h;
int main() {
  long j;
  int k, i;
  for (; j; j++) {
i = 0;
for (; i < 6; i++) {
  int l = a, m = d || g;
L:
  l ^ m | a;
}
b[j + 1] = 2;
++k;
for (; g; g++) {
  d ^= h;
  if (f)
for (;;)
  ;
}
  }
  if (k)
goto L;
}
$

[Bug c/78548] New: ice on valid C code on x86_64-linux-gnu at -O2 and -O3 in 64-bit mode with -Wall (*** Error in `/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/cc1': double free or corru

2016-11-27 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78548

Bug ID: 78548
   Summary: ice on valid C code on x86_64-linux-gnu at -O2 and -O3
in 64-bit mode with -Wall (*** Error in
`/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/
7.0.0/cc1': double free or corruption (fasttop):
0x03c15810 ***)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

The following program crashes gcc in the 64-bit mode, but causes gcc to hang in
the 32-bit mode. 

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20161127 (experimental) [trunk revision 242892] (GCC) 
$ 
$ gcc-trunk -Wall -w -O3 -m64 small.c
*** Error in `/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/cc1':
double free or corruption (fasttop): 0x03c15810 ***
small.c: In function ‘main’:
small.c:6:5: internal compiler error: Aborted
 int main (  ) {
 ^~~~
0xbe8aff crash_signal
../../gcc-source-trunk/gcc/toplev.c:333
0xe0ba36 xcallocator::data_free(gimple**)
../../gcc-source-trunk/gcc/hash-table.h:273
0xe0ba36 ~hash_table
../../gcc-source-trunk/gcc/hash-table.h:627
0xe0ba36 ~hash_set
../../gcc-source-trunk/gcc/hash-set.h:25
0xe0ba36 find_def_preds
../../gcc-source-trunk/gcc/tree-ssa-uninit.c:775
0xe0ba36 is_use_properly_guarded
../../gcc-source-trunk/gcc/tree-ssa-uninit.c:2375
0xe0c17e find_uninit_use
../../gcc-source-trunk/gcc/tree-ssa-uninit.c:2434
0xe0c17e warn_uninitialized_phi
../../gcc-source-trunk/gcc/tree-ssa-uninit.c:2504
0xe0c17e execute
../../gcc-source-trunk/gcc/tree-ssa-uninit.c:2612
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$ 
$ cat small.c
char a;
int b;
unsigned c, d;
short e;
int main_f;
int main (  ) {
L0:
if ( e ) goto L1;
b = c & d || a;
if ( !c ) printf ( "", ( long long ) main_f );
if ( d || !c ) {
printf ( "%llu\n", ( long long ) main );
goto L2;
}
unsigned g = b;
L1:
b = g;
L2:
if ( b ) goto L0;
  return 0;
}

[Bug c/78527] New: ice on valid C code at -O3 in both 32-bit and 64-bit modes on x86_64-linux-gnu (internal compiler error: in smallest_mode_for_size, at stor-layout.c:364)

2016-11-25 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78527

Bug ID: 78527
   Summary: ice on valid C code at -O3 in both 32-bit and 64-bit
modes on x86_64-linux-gnu (internal compiler error: in
smallest_mode_for_size, at stor-layout.c:364)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20161125 (experimental) [trunk revision 242857] (GCC) 
$ 
$ gcc-trunk -O3 small.c
small.c: In function ‘main’:
small.c:16:1: internal compiler error: in smallest_mode_for_size, at
stor-layout.c:364
 }
 ^
0xbd6ff0 smallest_mode_for_size(unsigned int, mode_class)
../../gcc-source-trunk/gcc/stor-layout.c:364
0x12ad7b6 make_extraction
../../gcc-source-trunk/gcc/combine.c:7557
0x12b1998 make_compound_operation_int
../../gcc-source-trunk/gcc/combine.c:8102
0x12b1998 make_compound_operation(rtx_def*, rtx_code)
../../gcc-source-trunk/gcc/combine.c:8210
0x12b134a make_compound_operation(rtx_def*, rtx_code)
../../gcc-source-trunk/gcc/combine.c:8234
0x12b4139 simplify_set
../../gcc-source-trunk/gcc/combine.c:6730
0x12b57e7 combine_simplify_rtx
../../gcc-source-trunk/gcc/combine.c:6167
0x12b7a52 subst
../../gcc-source-trunk/gcc/combine.c:5467
0x12b752a subst
../../gcc-source-trunk/gcc/combine.c:5335
0x12b8e07 try_combine
../../gcc-source-trunk/gcc/combine.c:3313
0x12be812 combine_instructions
../../gcc-source-trunk/gcc/combine.c:1285
0x12be812 rest_of_handle_combine
../../gcc-source-trunk/gcc/combine.c:14549
0x12be812 execute
../../gcc-source-trunk/gcc/combine.c:14594
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$ 
$ cat small.c
unsigned a;
short b, e;
int *c;
char d;
int main() {
  int f = 80;
  for (;;) {
if (f > 432)
  *c = a;
while (b)
  if (d)
e = -(a >> f);
c = &f;
b = e;
  }
}
$

[Bug c/78510] New: ice on invalid C code at -O2 and above in both 32-bit and 64-bit modes on x86_64-linux-gnu (internal compiler error: verify_gimple failed)

2016-11-24 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78510

Bug ID: 78510
   Summary: ice on invalid C code at -O2 and above in both 32-bit
and 64-bit modes on x86_64-linux-gnu (internal
compiler error: verify_gimple failed)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20161124 (experimental) [trunk revision 242818] (GCC)
$
$ gcc-trunk -O3 small.c
small.c: In function ‘main’:
small.c:17:5: error: type mismatch in conditional expression
 int main() { fn2(); return 0; }
 ^~~~
short int
int
short int
iftmp.1_11 = _6 == 4 ? 4 : 0;
small.c:17:5: internal compiler error: verify_gimple failed
0xc317f6 verify_gimple_in_cfg(function*, bool)
../../gcc-source-trunk/gcc/tree-cfg.c:5258
0xb0f84a execute_function_todo
../../gcc-source-trunk/gcc/passes.c:1965
0xb10285 execute_todo
../../gcc-source-trunk/gcc/passes.c:2015
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$
$ cat small.c
int a, b, c, e, f;
char d;
short g, h;
char fn1(int p1) {
  for (;;) {
h = p1 << 2;
int i = h;
g = i > 32767 >> 13 ? i : i << 3;
f = a ?: c;
if (e)
  return d;
  }
}

static int fn2() { fn1(0 || b); }

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

[Bug c/78482] New: wrong code at -O3 in both 32-bit and 64-bit modes on x86_64-linux-gnu

2016-11-22 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78482

Bug ID: 78482
   Summary: wrong code at -O3 in both 32-bit and 64-bit modes on
x86_64-linux-gnu
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20161122 (experimental) [trunk revision 242702] (GCC)
$ gcc-trunk -O3 small.c ; ./a.out
2
$ gcc-trunk -O2 small.c ; ./a.out
$ cat small.c
int printf(const char*, ...);
short a = 65531;
int b = 3, f;
char c, d;
void fn1(int p1) {
  short e;
  b = f;
  if (f > p1 && p1)
  L:
  for (e = 0; 0;)
;
  else if (d) b = 0 >= b;
  for (; e <= 3; e++) {
if (b)
  continue;
b = 3;
goto L;
  }
}

int main() {
  for (; c >= 0; c--) {
if (!b) {
  printf("%d\n", 2);
  continue;
}
fn1(a);
  }
  return 0;
}
$
$

[Bug c/78429] New: ice on valid C code on x86_64-linux-gnu at -O3 in both 32-bit and 64-bit modes (internal compiler error: in set_value_range, at tree-vrp.c:361)

2016-11-20 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78429

Bug ID: 78429
   Summary: ice on valid C code on x86_64-linux-gnu at -O3 in both
32-bit and 64-bit modes (internal compiler error: in
set_value_range, at tree-vrp.c:361)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20161119 (experimental) [trunk revision 242629] (GCC)
$
$ gcc-trunk small.c -O3
small.c: In function ‘main’:
small.c:6:5: internal compiler error: in set_value_range, at tree-vrp.c:361
 int main() {
 ^~~~
0xe7fe08 set_value_range
../../gcc-source-trunk/gcc/tree-vrp.c:360
0xe85ce7 set_and_canonicalize_value_range
../../gcc-source-trunk/gcc/tree-vrp.c:1527
0xe85ce7 extract_range_for_var_from_comparison_expr
../../gcc-source-trunk/gcc/tree-vrp.c:1579
0xe96cbd extract_range_from_assert
../../gcc-source-trunk/gcc/tree-vrp.c:1777
0xe96cbd extract_range_from_assignment
../../gcc-source-trunk/gcc/tree-vrp.c:4144
0xe978d0 vrp_visit_assignment_or_call
../../gcc-source-trunk/gcc/tree-vrp.c:7115
0xe978d0 extract_range_from_stmt
../../gcc-source-trunk/gcc/tree-vrp.c:7903
0xe98e94 vrp_visit_stmt
../../gcc-source-trunk/gcc/tree-vrp.c:7924
0xd9b73e simulate_stmt
../../gcc-source-trunk/gcc/tree-ssa-propagate.c:241
0xd9d1f7 simulate_block
../../gcc-source-trunk/gcc/tree-ssa-propagate.c:375
0xd9d1f7 ssa_propagate(ssa_prop_result (*)(gimple*, edge_def**, tree_node**),
ssa_prop_result (*)(gphi*))
../../gcc-source-trunk/gcc/tree-ssa-propagate.c:808
0xe8e881 execute_vrp
../../gcc-source-trunk/gcc/tree-vrp.c:11204
0xe8e881 execute
../../gcc-source-trunk/gcc/tree-vrp.c:11291
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$
$ cat small.c
int a[6];
char b;
unsigned c;
short d;
volatile int e;
int main() {
  int f;
  for (; c <= 2; c++) {
d = 3;
for (; d >= 0; d--) {
  int g = b;
  f = a[d] || b;
}
f || e;
  }
  return 0;
}

[Bug c++/78345] New: ice on invalid c++ code on x86_64-linux-gnu (internal compiler error: in cxx_eval_outermost_constant_expr, at cp/constexpr.c:4464)

2016-11-14 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78345

Bug ID: 78345
   Summary: ice on invalid c++ code on x86_64-linux-gnu (internal
compiler error: in cxx_eval_outermost_constant_expr,
at cp/constexpr.c:4464)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20161110 (experimental) [trunk revision 242039] (GCC) 
$ 
$ gcc-trunk small.C
small.C: In lambda function:
small.C:3:11: error: expected ‘{’ before ‘;’ token
 } a[] =[] ;
   ^
small.C: At global scope:
small.C:3:3: error: initializer fails to determine size of ‘a’
 } a[] =[] ;
   ^
small.C:3:11: internal compiler error: in cxx_eval_outermost_constant_expr, at
cp/constexpr.c:4464
 } a[] =[] ;
   ^
0x8cc511 cxx_eval_outermost_constant_expr
../../gcc-source-trunk/gcc/cp/constexpr.c:4463
0x8cf751 maybe_constant_init(tree_node*, tree_node*)
../../gcc-source-trunk/gcc/cp/constexpr.c:4803
0x73d02a store_init_value(tree_node*, tree_node*, vec**, int)
../../gcc-source-trunk/gcc/cp/typeck2.c:819
0x69397c check_initializer
../../gcc-source-trunk/gcc/cp/decl.c:6307
0x6bfbe9 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
../../gcc-source-trunk/gcc/cp/decl.c:6969
0x7c0a45 cp_parser_init_declarator
../../gcc-source-trunk/gcc/cp/parser.c:19070
0x7c12d9 cp_parser_simple_declaration
../../gcc-source-trunk/gcc/cp/parser.c:12656
0x7c1611 cp_parser_block_declaration
../../gcc-source-trunk/gcc/cp/parser.c:12524
0x7c86d0 cp_parser_declaration
../../gcc-source-trunk/gcc/cp/parser.c:12421
0x7c8ad4 cp_parser_declaration_seq_opt
../../gcc-source-trunk/gcc/cp/parser.c:12297
0x7c8e18 cp_parser_translation_unit
../../gcc-source-trunk/gcc/cp/parser.c:4360
0x7c8e18 c_parse_file()
../../gcc-source-trunk/gcc/cp/parser.c:37988
0x92e852 c_common_parse_file()
../../gcc-source-trunk/gcc/c-family/c-opts.c:1086
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$ 
$ cat small.C
struct {
  const int i;
} a[] =[] ;
$

[Bug c++/78344] New: ice on invalid c++ code on x86_64-linux-gnu (internal compiler error: tree check: expected tree_list, have error_mark in cp_check_const_attributes, at cp/decl2.c:1347)

2016-11-13 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78344

Bug ID: 78344
   Summary: ice on invalid c++ code on x86_64-linux-gnu (internal
compiler error: tree check: expected tree_list, have
error_mark in cp_check_const_attributes, at
cp/decl2.c:1347)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20161110 (experimental) [trunk revision 242039] (GCC) 
$ 
$ gcc-trunk small.C
small.C:1:30: error: expected ‘(’ before ‘;’ token
 alignas(double) int f alignas;
  ^
small.C:1:30: error: expected ‘(’ before ‘;’ token
small.C:1:30: internal compiler error: tree check: expected tree_list, have
error_mark in cp_check_const_attributes, at cp/decl2.c:1347
0x1090dcc tree_check_failed(tree_node const*, char const*, int, char const*,
...)
../../gcc-source-trunk/gcc/tree.c:9763
0x76fe2e tree_check
../../gcc-source-trunk/gcc/tree.h:3045
0x76fe2e cp_check_const_attributes
../../gcc-source-trunk/gcc/cp/decl2.c:1347
0x76fe2e cplus_decl_attributes(tree_node**, tree_node*, int)
../../gcc-source-trunk/gcc/cp/decl2.c:1421
0x6b9d7d start_decl(cp_declarator const*, cp_decl_specifier_seq*, int,
tree_node*, tree_node*, tree_node**)
../../gcc-source-trunk/gcc/cp/decl.c:4961
0x7c0728 cp_parser_init_declarator
../../gcc-source-trunk/gcc/cp/parser.c:18939
0x7c12d9 cp_parser_simple_declaration
../../gcc-source-trunk/gcc/cp/parser.c:12656
0x7c1611 cp_parser_block_declaration
../../gcc-source-trunk/gcc/cp/parser.c:12524
0x7c86d0 cp_parser_declaration
../../gcc-source-trunk/gcc/cp/parser.c:12421
0x7c8ad4 cp_parser_declaration_seq_opt
../../gcc-source-trunk/gcc/cp/parser.c:12297
0x7c8e18 cp_parser_translation_unit
../../gcc-source-trunk/gcc/cp/parser.c:4360
0x7c8e18 c_parse_file()
../../gcc-source-trunk/gcc/cp/parser.c:37988
0x92e852 c_common_parse_file()
../../gcc-source-trunk/gcc/c-family/c-opts.c:1086
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$ 
$ cat small.C
alignas(double) int f alignas;
$ 
$

[Bug c++/78341] New: crash on invalid C++ code on x86_64-linux-gnu (internal compiler error: in cp_parser_std_attribute_spec, at cp/parser.c:24597)

2016-11-13 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78341

Bug ID: 78341
   Summary: crash on invalid C++ code on x86_64-linux-gnu
(internal compiler error: in
cp_parser_std_attribute_spec, at cp/parser.c:24597)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20161110 (experimental) [trunk revision 242039] (GCC) 
$ 
$ gcc-trunk small.C
small.C:1:18: internal compiler error: in cp_parser_std_attribute_spec, at
cp/parser.c:24597
 alignas (alignas double
  ^~
0x7b35cb cp_parser_std_attribute_spec
../../gcc-source-trunk/gcc/cp/parser.c:24596
0x7b35cb cp_parser_std_attribute_spec_seq
../../gcc-source-trunk/gcc/cp/parser.c:24648
0x7b674f cp_parser_decl_specifier_seq
../../gcc-source-trunk/gcc/cp/parser.c:12855
0x7c1191 cp_parser_simple_declaration
../../gcc-source-trunk/gcc/cp/parser.c:12577
0x7c1611 cp_parser_block_declaration
../../gcc-source-trunk/gcc/cp/parser.c:12524
0x7c86d0 cp_parser_declaration
../../gcc-source-trunk/gcc/cp/parser.c:12421
0x7c8ad4 cp_parser_declaration_seq_opt
../../gcc-source-trunk/gcc/cp/parser.c:12297
0x7c8e18 cp_parser_translation_unit
../../gcc-source-trunk/gcc/cp/parser.c:4360
0x7c8e18 c_parse_file()
../../gcc-source-trunk/gcc/cp/parser.c:37988
0x92e852 c_common_parse_file()
../../gcc-source-trunk/gcc/c-family/c-opts.c:1086
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$ 
$ cat small.C
alignas (alignas double
$

[Bug c++/77906] ICE at -Os and above in both 32-bit and 64-bit modes on x86_64-linux-gnu (internal compiler error: in ipa_comdats, at ipa-comdats.c:352)

2016-10-08 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77906

Chengnian Sun  changed:

   What|Removed |Added

 CC||chengniansun at gmail dot com

--- Comment #2 from Chengnian Sun  ---
Sorry for the duplicate. I got a gateway error during the submission, thus
resubmitting the bug. But it turned out that both reports went through.

[Bug c++/77906] New: ICE at -Os and above in both 32-bit and 64-bit modes on x86_64-linux-gnu (internal compiler error: in ipa_comdats, at ipa-comdats.c:352)

2016-10-08 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77906

Bug ID: 77906
   Summary: ICE at -Os and above in both 32-bit and 64-bit modes
on x86_64-linux-gnu (internal compiler error: in
ipa_comdats, at ipa-comdats.c:352)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20161008 (experimental) [trunk revision 240893] (GCC) 
$ 
$ gcc-trunk -c -O2 small.C
small.C:17:19: internal compiler error: in ipa_comdats, at ipa-comdats.c:352
 C::C(int) : A(1) {}
   ^
0x15145eb ipa_comdats
../../gcc-source-trunk/gcc/ipa-comdats.c:352
0x15145eb execute
../../gcc-source-trunk/gcc/ipa-comdats.c:412
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$ 
$ cat small.C
struct A {
  A(int);
};
struct B : A {
  B();
} A;
struct C : virtual A {
  C(int);
};
A::A(int p1) {
  if (p1)
A(0);
}

B::B() : A(1) {}

C::C(int) : A(1) {}
$

[Bug c++/77905] New: ICE at -Os and above in both 32-bit and 64-bit modes on x86_64-linux-gnu (internal compiler error: in ipa_comdats, at ipa-comdats.c:352)

2016-10-08 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77905

Bug ID: 77905
   Summary: ICE at -Os and above in both 32-bit and 64-bit modes
on x86_64-linux-gnu (internal compiler error: in
ipa_comdats, at ipa-comdats.c:352)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20161008 (experimental) [trunk revision 240893] (GCC) 
$ 
$ gcc-trunk -c -O2 small.C
small.C:17:19: internal compiler error: in ipa_comdats, at ipa-comdats.c:352
 C::C(int) : A(1) {}
   ^
0x15145eb ipa_comdats
../../gcc-source-trunk/gcc/ipa-comdats.c:352
0x15145eb execute
../../gcc-source-trunk/gcc/ipa-comdats.c:412
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$ 
$ cat small.C
struct A {
  A(int);
};
struct B : A {
  B();
} A;
struct C : virtual A {
  C(int);
};
A::A(int p1) {
  if (p1)
A(0);
}

B::B() : A(1) {}

C::C(int) : A(1) {}
$

[Bug tree-optimization/77778] New: ICE at -Os and above on x86_64-linux-gnu in both 32-bit and 64-bit modes (Segmentation fault, visit_reference_op_store, extract_and_process_scc_for_name)

2016-09-28 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=8

Bug ID: 8
   Summary: ICE at -Os and above on x86_64-linux-gnu in both
32-bit and 64-bit modes (Segmentation fault,
visit_reference_op_store,
extract_and_process_scc_for_name)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160928 (experimental) [trunk revision 240565] (GCC) 
$ 
$ gcc-trunk -O3 small.c 
small.c: In function ‘main’:
small.c:5:5: warning: assignment discards ‘const’ qualifier from pointer target
type [-Wdiscarded-qualifiers]
   c = &a;
 ^
small.c:4:5: internal compiler error: Segmentation fault
 int main() {
 ^~~~
0xbd143f crash_signal
../../gcc-source-trunk/gcc/toplev.c:337
0xda517d visit_reference_op_store
../../gcc-source-trunk/gcc/tree-ssa-sccvn.c:3613
0xda517d visit_use
../../gcc-source-trunk/gcc/tree-ssa-sccvn.c:3858
0xda675c process_scc
../../gcc-source-trunk/gcc/tree-ssa-sccvn.c:4111
0xda675c extract_and_process_scc_for_name
../../gcc-source-trunk/gcc/tree-ssa-sccvn.c:4198
0xda675c DFS
../../gcc-source-trunk/gcc/tree-ssa-sccvn.c:4250
0xda6e55 sccvn_dom_walker::before_dom_children(basic_block_def*)
../../gcc-source-trunk/gcc/tree-ssa-sccvn.c:4716
0x128aed7 dom_walker::walk(basic_block_def*)
../../gcc-source-trunk/gcc/domwalk.c:265
0xda8532 run_scc_vn(vn_lookup_kind)
../../gcc-source-trunk/gcc/tree-ssa-sccvn.c:4827
0xd7d345 execute
../../gcc-source-trunk/gcc/tree-ssa-pre.c:5021
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$ 
$ cat small.c
static const int a;
int b;
int *c, *d;
int main() {
  c = &a;
  c == d ?: __builtin_abort(); 
  for (; b; b++ >= (*d = a))
;
  return 0;
}

$

[Bug c/77766] New: wrong code at -O2 and -O3 in 64-bit mode on x86_64-linux-gnu (executable hangs)

2016-09-27 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77766

Bug ID: 77766
   Summary: wrong code at -O2 and -O3 in 64-bit mode on
x86_64-linux-gnu (executable hangs)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160927 (experimental) [trunk revision 240545] (GCC) 
$ 
$ gcc-trunk -O2 small.c 
$ timeout -s 9 10 ./a.out 
Killed
$ gcc-trunk -Os small.c 
$ ./a.out 
$ 
$ cat small.c
char a;
short b, d = 5, h;
char c[1];
int e, f = 4, g, j;
int main() {
  int i;
  for (; f; f = a) {
g = 0;
for (; g <= 32; ++g) {
  i = 0;
  for (; i < 3; i++)
while (1 > d)
  if (c[b])
break;
L:
  if (j)
break;
}
  }
  e = 0;
  for (; e; e = 0) {
d++;
for (; h;)
  goto L;
  }
  return 0;
}
$

[Bug c++/77752] New: ICE on C++ code on x86_64-linux-gnu (internal compiler error: Segmentation fault, build_list_conv, implicit_conversion)

2016-09-27 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77752

Bug ID: 77752
   Summary: ICE on C++ code on x86_64-linux-gnu (internal compiler
error: Segmentation fault, build_list_conv,
implicit_conversion)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160926 (experimental) [trunk revision 240511] (GCC) 
$ 
$ gcc-trunk small.C
small.C: In function ‘void f(std::initializer_list)’:
small.C:4:30: error: ‘l’ has incomplete type
 void f(std::initializer_list l) { f({2}); }
  ^
small.C:2:7: note: forward declaration of ‘class std::initializer_list’
 class initializer_list;
   ^~~~
small.C:4:40: internal compiler error: Segmentation fault
 void f(std::initializer_list l) { f({2}); }
^
0xdcb7df crash_signal
../../gcc-source-trunk/gcc/toplev.c:337
0x650c8d tree_check
../../gcc-source-trunk/gcc/tree.h:3030
0x650c8d build_list_conv
../../gcc-source-trunk/gcc/cp/call.c:788
0x650c8d implicit_conversion
../../gcc-source-trunk/gcc/cp/call.c:1816
0x65c7e8 add_function_candidate
../../gcc-source-trunk/gcc/cp/call.c:2142
0x64ee06 add_candidates
../../gcc-source-trunk/gcc/cp/call.c:5410
0x6628cc perform_overload_resolution
../../gcc-source-trunk/gcc/cp/call.c:4067
0x662abe build_new_function_call(tree_node*, vec**, bool, int)
../../gcc-source-trunk/gcc/cp/call.c:4144
0x806718 finish_call_expr(tree_node*, vec**, bool,
bool, int)
../../gcc-source-trunk/gcc/cp/semantics.c:2440
0x77edcb cp_parser_postfix_expression
../../gcc-source-trunk/gcc/cp/parser.c:6937
0x787b82 cp_parser_unary_expression
../../gcc-source-trunk/gcc/cp/parser.c:8019
0x7886a7 cp_parser_cast_expression
../../gcc-source-trunk/gcc/cp/parser.c:8696
0x788c73 cp_parser_binary_expression
../../gcc-source-trunk/gcc/cp/parser.c:8798
0x789563 cp_parser_assignment_expression
../../gcc-source-trunk/gcc/cp/parser.c:9086
0x78c069 cp_parser_expression
../../gcc-source-trunk/gcc/cp/parser.c:9253
0x78c7f8 cp_parser_expression_statement
../../gcc-source-trunk/gcc/cp/parser.c:10771
0x77a87a cp_parser_statement
../../gcc-source-trunk/gcc/cp/parser.c:10587
0x77b7d5 cp_parser_statement_seq_opt
../../gcc-source-trunk/gcc/cp/parser.c:10913
0x77b8af cp_parser_compound_statement
../../gcc-source-trunk/gcc/cp/parser.c:10867
0x799753 cp_parser_function_body
../../gcc-source-trunk/gcc/cp/parser.c:20887
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$ 
$ cat small.C
namespace std {
class initializer_list;
}
void f(std::initializer_list l) { f({2}); }

[Bug tree-optimization/77677] New: ICE at -O1 and above in both 32-bit and 64-bit modes on x86_64-linux-gnu (internal compiler error: in set_value_range, at tree-vrp.c:361)

2016-09-21 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77677

Bug ID: 77677
   Summary: ICE at -O1 and above in both 32-bit and 64-bit modes
on x86_64-linux-gnu (internal compiler error: in
set_value_range, at tree-vrp.c:361)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

If I add "int" in front of "p1", then the crash disappears.

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160921 (experimental) [trunk revision 240316] (GCC)
$
$ gcc-trunk -O3 small.c
small.c: In function ‘fn1’:
small.c:2:5: warning: type of ‘p1’ defaults to ‘int’ [-Wimplicit-int]
 int fn1(p1) { return p1 == 0 || a % p1; }
 ^~~
small.c: At top level:
small.c:7:1: internal compiler error: in set_value_range, at tree-vrp.c:361
 }
 ^
0xe61ec8 set_value_range
../../gcc-source-trunk/gcc/tree-vrp.c:360
0xe6542e vrp_meet_1
../../gcc-source-trunk/gcc/tree-vrp.c:8639
0xe6542e vrp_meet(value_range*, value_range const*)
../../gcc-source-trunk/gcc/tree-vrp.c:8716
0x12e9ef5 ipcp_vr_lattice::meet_with_1(value_range const*)
../../gcc-source-trunk/gcc/ipa-cp.c:987
0x12f038c ipcp_vr_lattice::meet_with(value_range const*)
../../gcc-source-trunk/gcc/ipa-cp.c:969
0x12f038c propagate_vr_accross_jump_function
../../gcc-source-trunk/gcc/ipa-cp.c:2077
0x12f038c propagate_constants_accross_call
../../gcc-source-trunk/gcc/ipa-cp.c:2435
0x12f2918 propagate_constants_topo
../../gcc-source-trunk/gcc/ipa-cp.c:3329
0x12f2918 ipcp_propagate_stage
../../gcc-source-trunk/gcc/ipa-cp.c:3439
0x12f4b63 ipcp_driver
../../gcc-source-trunk/gcc/ipa-cp.c:5246
0x12f4b63 execute
../../gcc-source-trunk/gcc/ipa-cp.c:5342
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$
$ cat small.c
int a, b;
int fn1(p1) { return p1 == 0 || a % p1; }

int main() {
  b = fn1(2592930443);
  return 0;
}
$

[Bug c++/77655] New: ICE on invalid c++ code on x86_64-linux-gnu (internal compiler error: Segmentation fault (program cc1plus))

2016-09-19 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77655

Bug ID: 77655
   Summary: ICE on invalid c++ code on x86_64-linux-gnu (internal
compiler error: Segmentation fault (program cc1plus))
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160919 (experimental) [trunk revision 240232] (GCC) 
$ 
$ gcc-trunk small.C
small.C: In instantiation of ‘decltype (g(0, (g)(h::a)...))
h(A&& ...) [with A = {}; decltype (g(0, (g)(h::a)...)) = void;
decltype (a) = ]’:
small.C:8:5:   required from here
small.C:4:4: error: no matching function for call to ‘h(h(A&& ...) [with A =
{}; decltype (g(0, (g)(h::a)...)) = void; decltype (a) =
]::)’
   h([] {});
   ~^~~
small.C:3:6: note: candidate: template decltype (g(0,
(g)(h::a)...)) h(A&& ...)
 auto h(A &&... a) -> decltype(g(0, g(a)...)) {
  ^
small.C:3:6: note:   template argument deduction/substitution failed:
gcc-trunk: internal compiler error: Segmentation fault (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
$ 
$ cat small.C
template  void g(F);
template 
auto h(A &&... a) -> decltype(g(0, g(a)...)) {
  h([] {});
}

int main() { 
  h(); 
  return 0; 
}
$

[Bug c++/77639] New: ICE on x86_64-linux-gnu (internal compiler error: tree check: accessed elt 1 of tree_vec with 0 elts in unify, at cp/pt.c:19674)

2016-09-18 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77639

Bug ID: 77639
   Summary: ICE on x86_64-linux-gnu (internal compiler error: tree
check: accessed elt 1 of tree_vec with 0 elts in
unify, at cp/pt.c:19674)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$ g++-trunk -v
Using built-in specs.
COLLECT_GCC=g++-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160918 (experimental) [trunk revision 240220] (GCC)
$
$ g++-trunk small.C
small.C:2:35: error: an explicit specialization must be preceded by ‘template
<>’
 template  {};
   ^~~~
   template <>
small.C:2:42: error: enclosing class templates are not explicitly specialized
 template  {};
  ^
small.C:2:56: error: types may not be defined in parameter types
 template  {};
^
small.C:2:56: error: definition of ‘struct B’ inside template
parameter list
small.C:2:57: error: two or more data types in declaration of ‘parameter’
 template  {};
 ^
small.C:2:58: error: expected ‘>’ before ‘;’ token
 template  {};
  ^
small.C:2:58: error: expected unqualified-id before ‘;’ token
small.C:3:20: internal compiler error: tree check: accessed elt 1 of tree_vec
with 0 elts in unify, at cp/pt.c:19674
 B i;
^
0x107f2b5 tree_vec_elt_check_failed(int, int, char const*, int, char const*)
../../gcc-source-trunk/gcc/tree.c:9939
0x6f2572 tree_vec_elt_check
../../gcc-source-trunk/gcc/tree.h:3247
0x6f2572 unify
../../gcc-source-trunk/gcc/cp/pt.c:19674
0x6f1915 unify
../../gcc-source-trunk/gcc/cp/pt.c:20081
0x6f4156 get_partial_spec_bindings
../../gcc-source-trunk/gcc/cp/pt.c:20851
0x6eb961 most_specialized_partial_spec
../../gcc-source-trunk/gcc/cp/pt.c:21107
0x707005 instantiate_class_template_1
../../gcc-source-trunk/gcc/cp/pt.c:9848
0x707005 instantiate_class_template(tree_node*)
../../gcc-source-trunk/gcc/cp/pt.c:10416
0x7adbcb complete_type(tree_node*)
../../gcc-source-trunk/gcc/cp/typeck.c:133
0x66b315 start_decl_1(tree_node*, bool)
../../gcc-source-trunk/gcc/cp/decl.c:5168
0x6944bf start_decl(cp_declarator const*, cp_decl_specifier_seq*, int,
tree_node*, tree_node*, tree_node**)
../../gcc-source-trunk/gcc/cp/decl.c:5131
0x79a089 cp_parser_init_declarator
../../gcc-source-trunk/gcc/cp/parser.c:18701
0x79aae7 cp_parser_simple_declaration
../../gcc-source-trunk/gcc/cp/parser.c:12495
0x79ae66 cp_parser_block_declaration
../../gcc-source-trunk/gcc/cp/parser.c:12363
0x7a3d14 cp_parser_declaration
../../gcc-source-trunk/gcc/cp/parser.c:12260
0x7a28af cp_parser_declaration_seq_opt
../../gcc-source-trunk/gcc/cp/parser.c:12139
0x7a2bf8 cp_parser_translation_unit
../../gcc-source-trunk/gcc/cp/parser.c:4356
0x7a2bf8 c_parse_file()
../../gcc-source-trunk/gcc/cp/parser.c:37714
0x917b92 c_common_parse_file()
../../gcc-source-trunk/gcc/c-family/c-opts.c:1073
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$
$ cat small.C
template  struct B {};
template  {};
B i;
$

[Bug c++/77638] New: ICE on x86_64-linux-gnu (internal compiler error: tree check: expected tree that contains ‘decl common’ structure, have ‘error_mark’ in cp_parser_template_declaration_after_parame

2016-09-18 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77638

Bug ID: 77638
   Summary: ICE on x86_64-linux-gnu (internal compiler error: tree
check: expected tree that contains ‘decl common’
structure, have ‘error_mark’ in
cp_parser_template_declaration_after_parameters, at
cp/parser.c:25722)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$ g++-trunk -v
Using built-in specs.
COLLECT_GCC=g++-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160918 (experimental) [trunk revision 240220] (GCC)
$
$ g++-trunk small.C
small.C:2:11: error: ‘CharT’ has not been declared
 template 
   ^
small.C:2:18: error: ‘CharT’ has not been declared
 template 
  ^
small.C:3:30: error: ‘String’ has not been declared
 typename enable_if::type operator"" _script();
  ^~
small.C:3:47: error: template argument 1 is invalid
 typename enable_if::type operator"" _script();
   ^
small.C:3:75: internal compiler error: tree check: expected tree that contains
‘decl common’ structure, have ‘error_mark’ in
cp_parser_template_declaration_after_parameters, at cp/parser.c:25722
 typename enable_if::type operator"" _script();
   ^
0x10790d4 tree_contains_struct_check_failed(tree_node const*,
tree_node_structure_enum, char const*, int, char const*)
../../gcc-source-trunk/gcc/tree.c:9914
0x79c2a8 contains_struct_check
../../gcc-source-trunk/gcc/tree.h:3140
0x79c2a8 cp_parser_template_declaration_after_parameters
../../gcc-source-trunk/gcc/cp/parser.c:25722
0x79c7a1 cp_parser_explicit_template_declaration
../../gcc-source-trunk/gcc/cp/parser.c:25902
0x79c7a1 cp_parser_template_declaration_after_export
../../gcc-source-trunk/gcc/cp/parser.c:25920
0x7a3e59 cp_parser_declaration
../../gcc-source-trunk/gcc/cp/parser.c:12209
0x7a28af cp_parser_declaration_seq_opt
../../gcc-source-trunk/gcc/cp/parser.c:12139
0x7a2bf8 cp_parser_translation_unit
../../gcc-source-trunk/gcc/cp/parser.c:4356
0x7a2bf8 c_parse_file()
../../gcc-source-trunk/gcc/cp/parser.c:37714
0x917b92 c_common_parse_file()
../../gcc-source-trunk/gcc/c-family/c-opts.c:1073
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$
$ cat small.C
template  struct enable_if;
template 
typename enable_if::type operator"" _script();

[Bug c++/77637] New: ICE on x86_64-linux-gnu (Segmentation fault, tree_check, cp_parser_std_attribute_list...)

2016-09-18 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77637

Bug ID: 77637
   Summary: ICE on x86_64-linux-gnu (Segmentation fault,
tree_check, cp_parser_std_attribute_list...)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$ g++-trunk -v
Using built-in specs.
COLLECT_GCC=g++-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160918 (experimental) [trunk revision 240220] (GCC)
$
$ g++-trunk small.C
small.C:1:6: internal compiler error: Segmentation fault
 int[[...]] a;
  ^~~
0xdc7baf crash_signal
../../gcc-source-trunk/gcc/toplev.c:336
0x78a1cb tree_check
../../gcc-source-trunk/gcc/tree.h:3025
0x78a1cb cp_parser_std_attribute_list
../../gcc-source-trunk/gcc/cp/parser.c:24223
0x78a1cb cp_parser_std_attribute_spec
../../gcc-source-trunk/gcc/cp/parser.c:24289
0x78a1cb cp_parser_std_attribute_spec_seq
../../gcc-source-trunk/gcc/cp/parser.c:24377
0x78d94f cp_parser_decl_specifier_seq
../../gcc-source-trunk/gcc/cp/parser.c:12694
0x79a9c1 cp_parser_simple_declaration
../../gcc-source-trunk/gcc/cp/parser.c:12416
0x79ae66 cp_parser_block_declaration
../../gcc-source-trunk/gcc/cp/parser.c:12363
0x7a3d14 cp_parser_declaration
../../gcc-source-trunk/gcc/cp/parser.c:12260
0x7a28af cp_parser_declaration_seq_opt
../../gcc-source-trunk/gcc/cp/parser.c:12139
0x7a2bf8 cp_parser_translation_unit
../../gcc-source-trunk/gcc/cp/parser.c:4356
0x7a2bf8 c_parse_file()
../../gcc-source-trunk/gcc/cp/parser.c:37714
0x917b92 c_common_parse_file()
../../gcc-source-trunk/gcc/c-family/c-opts.c:1073
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$
$ cat small.C
int[[...]] a;
$

[Bug c++/77626] New: ICE with -Wall on x86_64-linux-gnu (internal compiler error: Segmentation fault, byte_from_pos, cxx_fold_indirect_ref)

2016-09-17 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77626

Bug ID: 77626
   Summary: ICE with -Wall on x86_64-linux-gnu (internal compiler
error: Segmentation fault, byte_from_pos,
cxx_fold_indirect_ref)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$ g++-trunk -v
Using built-in specs.
COLLECT_GCC=g++-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160916 (experimental) [trunk revision 240207] (GCC) 
$ 
$ g++-trunk -Wall small.C 
small.C:2:18: error: field ‘aligned’ has incomplete type ‘struct2’
   struct struct2 aligned;
  ^~~
small.C:2:10: note: forward declaration of ‘struct struct2’
   struct struct2 aligned;
  ^~~
small.C: In function ‘void fn1(int)’:
small.C:6:15: internal compiler error: Segmentation fault
   fn1((int &)a);
   ^
0xdc7baf crash_signal
../../gcc-source-trunk/gcc/toplev.c:336
0xdb6a3c byte_from_pos(tree_node*, tree_node*)
../../gcc-source-trunk/gcc/stor-layout.c:862
0x895eac cxx_fold_indirect_ref
../../gcc-source-trunk/gcc/cp/constexpr.c:2897
0x89e8f0 cxx_eval_indirect_ref
../../gcc-source-trunk/gcc/cp/constexpr.c:3029
0x89e8f0 cxx_eval_constant_expression
../../gcc-source-trunk/gcc/cp/constexpr.c:3903
0x8a46df cxx_eval_outermost_constant_expr
../../gcc-source-trunk/gcc/cp/constexpr.c:4382
0x8a79cc maybe_constant_value_1
../../gcc-source-trunk/gcc/cp/constexpr.c:4576
0x8a79cc maybe_constant_value(tree_node*, tree_node*)
../../gcc-source-trunk/gcc/cp/constexpr.c:4600
0x65704a build_over_call
../../gcc-source-trunk/gcc/cp/call.c:7766
0x662c4f build_new_function_call(tree_node*, vec**, bool, int)
../../gcc-source-trunk/gcc/cp/call.c:4190
0x8062d8 finish_call_expr(tree_node*, vec**, bool,
bool, int)
../../gcc-source-trunk/gcc/cp/semantics.c:2440
0x77d54b cp_parser_postfix_expression
../../gcc-source-trunk/gcc/cp/parser.c:6937
0x77b972 cp_parser_unary_expression
../../gcc-source-trunk/gcc/cp/parser.c:8019
0x785877 cp_parser_cast_expression
../../gcc-source-trunk/gcc/cp/parser.c:8696
0x785e43 cp_parser_binary_expression
../../gcc-source-trunk/gcc/cp/parser.c:8798
0x786733 cp_parser_assignment_expression
../../gcc-source-trunk/gcc/cp/parser.c:9086
0x789069 cp_parser_expression
../../gcc-source-trunk/gcc/cp/parser.c:9253
0x78968f cp_parser_expression_statement
../../gcc-source-trunk/gcc/cp/parser.c:10736
0x797f3a cp_parser_statement
../../gcc-source-trunk/gcc/cp/parser.c:10587
0x798e35 cp_parser_statement_seq_opt
../../gcc-source-trunk/gcc/cp/parser.c:10859
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$ 
$ g++-trunk small.C
small.C:2:18: error: field ‘aligned’ has incomplete type ‘struct2’
   struct struct2 aligned;
  ^~~
small.C:2:10: note: forward declaration of ‘struct struct2’
   struct struct2 aligned;
  ^~~
$ 
$ cat small.C
struct A {
  struct struct2 aligned;
};
void fn1(int) {
  A a;
  fn1((int &)a);
}

[Bug c/77624] New: ICE on x86_64-linux-gnu (internal compiler error: in fold_builtin_atomic_always_lock_free, at builtins.c:5583)

2016-09-16 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77624

Bug ID: 77624
   Summary: ICE on x86_64-linux-gnu (internal compiler error: in
fold_builtin_atomic_always_lock_free, at
builtins.c:5583)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

This is a regression. gcc-4.9 does not ICE.


$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160916 (experimental) [trunk revision 240207] (GCC) 
$ gcc-trunk -c small.c 
small.c: In function ‘main’:
small.c:3:28: warning: passing argument 2 of ‘__atomic_is_lock_free’ makes
pointer from integer without a cast [-Wint-conversion]
   __atomic_is_lock_free(2, a);
^
small.c:3:28: note: expected ‘const volatile void *’ but argument is of type
‘int’
small.c:3:3: internal compiler error: in fold_builtin_atomic_always_lock_free,
at builtins.c:5583
   __atomic_is_lock_free(2, a);
   ^
0x75875e fold_builtin_atomic_always_lock_free
../../gcc-source-trunk/gcc/builtins.c:5583
0x758b44 fold_builtin_atomic_always_lock_free
../../gcc-source-trunk/gcc/builtins.c:5644
0x758b44 fold_builtin_atomic_is_lock_free
../../gcc-source-trunk/gcc/builtins.c:5640
0x769b9b fold_builtin_2
../../gcc-source-trunk/gcc/builtins.c:8440
0x769b9b fold_builtin_n(unsigned int, tree_node*, tree_node**, int, bool)
../../gcc-source-trunk/gcc/builtins.c:8548
0x8eb2f9 fold(tree_node*)
../../gcc-source-trunk/gcc/fold-const.c:11910
0x6bc6f2 c_fully_fold_internal
../../gcc-source-trunk/gcc/c/c-fold.c:556
0x6c019a c_fully_fold(tree_node*, bool, bool*)
../../gcc-source-trunk/gcc/c/c-fold.c:90
0x657e0c c_process_expr_stmt(unsigned int, tree_node*)
../../gcc-source-trunk/gcc/c/c-typeck.c:10342
0x6581fd c_finish_expr_stmt(unsigned int, tree_node*)
../../gcc-source-trunk/gcc/c/c-typeck.c:10387
0x6a5fc8 c_parser_statement_after_labels
../../gcc-source-trunk/gcc/c/c-parser.c:5347
0x6a7f2b c_parser_compound_statement_nostart
../../gcc-source-trunk/gcc/c/c-parser.c:4921
0x6a881e c_parser_compound_statement
../../gcc-source-trunk/gcc/c/c-parser.c:4756
0x6a9d48 c_parser_declaration_or_fndef
../../gcc-source-trunk/gcc/c/c-parser.c:2155
0x6b3446 c_parser_external_declaration
../../gcc-source-trunk/gcc/c/c-parser.c:1570
0x6b3f59 c_parser_translation_unit
../../gcc-source-trunk/gcc/c/c-parser.c:1450
0x6b3f59 c_parse_file()
../../gcc-source-trunk/gcc/c/c-parser.c:18090
0x71e332 c_common_parse_file()
../../gcc-source-trunk/gcc/c-family/c-opts.c:1073
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$ 
$ gcc-4.9 small.c  -c
small.c: In function ‘main’:
small.c:3:28: warning: passing argument 2 of ‘__atomic_is_lock_free’ makes
pointer from integer without a cast
   __atomic_is_lock_free(2, a); 
^
small.c:3:28: note: expected ‘const volatile void *’ but argument is of type
‘int’
$ 
$ cat small.c 
int a;
int main() { 
  __atomic_is_lock_free(2, a); 
  return 0;
}
$

[Bug c/73450] New: wrong code at -Os and above on x86_64-linux-gnu in both 32-bit and 64-bit modes (executable hangs)

2016-08-10 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=73450

Bug ID: 73450
   Summary: wrong code at -Os and above on x86_64-linux-gnu in
both 32-bit and 64-bit modes (executable hangs)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160810 (experimental) [trunk revision 239341] (GCC)
$ gcc-trunk small.c -O1 ; timeout -s 9 1 ./a.out
$ gcc-trunk small.c -Os ; timeout -s 9 1 ./a.out
Killed
$ gcc-trunk small.c -O3 ; timeout -s 9 1 ./a.out
Killed
$ cat small.c
int a;
char b;
int main() {
  char c = 0;
  for (; c != 3; c = c + 7) {
a = b & a;
if (a)
  break;
  }
  return 0;
}
$

[Bug c++/72825] New: ICE on invalid C++ code on x86_64-linux-gnu (internal compiler error: tree check: expected array_type, have error_mark in array_ref_low_bound, at tree.c:13013)

2016-08-06 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72825

Bug ID: 72825
   Summary: ICE on invalid C++ code on x86_64-linux-gnu (internal
compiler error: tree check: expected array_type, have
error_mark in array_ref_low_bound, at tree.c:13013)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$ g++-trunk -v
Using built-in specs.
COLLECT_GCC=g++-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160805 (experimental) [trunk revision 239171] (GCC)
$
$ g++-trunk small.C
small.C:6:12: error: uninitialized const ‘Wrapper::msgPtr’ [-fpermissive]
 const char Wrapper::msgPtr[];
^~~
small.C:6:12: error: storage size of ‘Wrapper::msgPtr’ isn’t known
small.C: In static member function ‘static const char* Wrapper::m_fn1()’:
small.C:4:48: internal compiler error: tree check: expected array_type, have
error_mark in array_ref_low_bound, at tree.c:13013
   static const char *m_fn1() { return &msgPtr[0]; }
^
0x10409ec tree_check_failed(tree_node const*, char const*, int, char const*,
...)
../../gcc-source-trunk/gcc/tree.c:9742
0x105ec87 tree_check(tree_node*, char const*, int, char const*, tree_code)
../../gcc-source-trunk/gcc/tree.h:3023
0x105ec87 array_ref_low_bound(tree_node*)
../../gcc-source-trunk/gcc/tree.c:13013
0xb5f9cf gimplify_compound_lval
../../gcc-source-trunk/gcc/gimplify.c:2117
0xb57891 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc-source-trunk/gcc/gimplify.c:10422
0xb59126 gimplify_addr_expr
../../gcc-source-trunk/gcc/gimplify.c:5211
0xb59126 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc-source-trunk/gcc/gimplify.c:10516
0xb6a287 gimplify_modify_expr
../../gcc-source-trunk/gcc/gimplify.c:4808
0xb59c1d gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc-source-trunk/gcc/gimplify.c:10470
0xb5c576 gimplify_stmt(tree_node**, gimple**)
../../gcc-source-trunk/gcc/gimplify.c:5804
0xb58e79 gimplify_and_add(tree_node*, gimple**)
../../gcc-source-trunk/gcc/gimplify.c:427
0xb58e79 gimplify_return_expr
../../gcc-source-trunk/gcc/gimplify.c:1371
0xb58e79 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc-source-trunk/gcc/gimplify.c:10719
0xb5c576 gimplify_stmt(tree_node**, gimple**)
../../gcc-source-trunk/gcc/gimplify.c:5804
0xb6baee gimplify_body(tree_node*, bool)
../../gcc-source-trunk/gcc/gimplify.c:11653
0xb6c0e6 gimplify_function_tree(tree_node*)
../../gcc-source-trunk/gcc/gimplify.c:11809
0x9d5a37 cgraph_node::analyze()
../../gcc-source-trunk/gcc/cgraphunit.c:625
0x9d8ca5 analyze_functions
../../gcc-source-trunk/gcc/cgraphunit.c:1086
0x9d9a7c symbol_table::finalize_compilation_unit()
../../gcc-source-trunk/gcc/cgraphunit.c:2547
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$
$ cat small.C
class Wrapper {
public:
  static const char msgPtr[];
  static const char *m_fn1() { return &msgPtr[0]; }
};
const char Wrapper::msgPtr[];
int main() { Wrapper::m_fn1(); }
$

[Bug c/72816] New: ICE on x86_64-linux-gnu (tree check: expected tree that contains ‘decl with RTL’ structure, have ‘field_decl’ in set_decl_rtl, at emit-rtl.c:1282)

2016-08-05 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72816

Bug ID: 72816
   Summary: ICE on x86_64-linux-gnu (tree check: expected tree
that contains ‘decl with RTL’ structure, have
‘field_decl’ in set_decl_rtl, at emit-rtl.c:1282)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160805 (experimental) [trunk revision 239162] (GCC)
$ gcc-trunk small.c
small.c:4:5: error: array size missing in ‘a’
   A a;
 ^
small.c:4:3: internal compiler error: tree check: expected tree that contains
‘decl with RTL’ structure, have ‘field_decl’ in set_decl_rtl, at
emit-rtl.c:1282
   A a;
   ^
0xe56494 tree_contains_struct_check_failed(tree_node const*,
tree_node_structure_enum, char const*, int, char const*)
../../gcc-source-trunk/gcc/tree.c:9914
0x88c8fc contains_struct_check(tree_node*, tree_node_structure_enum, char
const*, int, char const*)
../../gcc-source-trunk/gcc/tree.h:3137
0x88c8fc set_decl_rtl(tree_node*, rtx_def*)
../../gcc-source-trunk/gcc/emit-rtl.c:1282
0xac relayout_decl(tree_node*)
../../gcc-source-trunk/gcc/stor-layout.c:781
0x66fa45 finish_decl(tree_node*, unsigned int, tree_node*, tree_node*,
tree_node*)
../../gcc-source-trunk/gcc/c/c-decl.c:4920
0x677117 grokfield(unsigned int, c_declarator*, c_declspecs*, tree_node*,
tree_node**)
../../gcc-source-trunk/gcc/c/c-decl.c:7522
0x6cc785 c_parser_struct_declaration
../../gcc-source-trunk/gcc/c/c-parser.c:3177
0x6ce3c9 c_parser_struct_or_union_specifier
../../gcc-source-trunk/gcc/c/c-parser.c:2982
0x6ce3c9 c_parser_declspecs
../../gcc-source-trunk/gcc/c/c-parser.c:2574
0x6d1920 c_parser_declaration_or_fndef
../../gcc-source-trunk/gcc/c/c-parser.c:1731
0x6de70d c_parser_external_declaration
../../gcc-source-trunk/gcc/c/c-parser.c:1567
0x6defe9 c_parser_translation_unit
../../gcc-source-trunk/gcc/c/c-parser.c:1448
0x6defe9 c_parse_file()
../../gcc-source-trunk/gcc/c/c-parser.c:18047
0x741d82 c_common_parse_file()
../../gcc-source-trunk/gcc/c-family/c-opts.c:1070
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$ cat small.c
typedef const int A[];
struct {
  int add_offset;
  A a;
};
$

[Bug c++/72811] New: ICE on invalid C++ code on x86_64-linux-gnu (internal compiler error: in instantiate_type, perform_implicit_conversion_flags)

2016-08-05 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72811

Bug ID: 72811
   Summary: ICE on invalid C++ code on x86_64-linux-gnu (internal
compiler error: in instantiate_type,
perform_implicit_conversion_flags)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$ g++-trunk -v
Using built-in specs.
COLLECT_GCC=g++-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160805 (experimental) [trunk revision 239162] (GCC)
$
$ g++-trunk small.C
small.C:2:15: internal compiler error: in instantiate_type, at cp/class.c:8248
 } a = C::C ?: 0;
   ^
0x750d0e instantiate_type(tree_node*, tree_node*, int)
../../gcc-source-trunk/gcc/cp/class.c:8245
0x681bb4 perform_implicit_conversion_flags(tree_node*, tree_node*, int, int)
../../gcc-source-trunk/gcc/cp/call.c:9748
0x69067f build_conditional_expr_1
../../gcc-source-trunk/gcc/cp/call.c:4806
0x69244c build_conditional_expr(unsigned int, tree_node*, tree_node*,
tree_node*, int)
../../gcc-source-trunk/gcc/cp/call.c:5231
0x7d5bd0 build_x_conditional_expr(unsigned int, tree_node*, tree_node*,
tree_node*, int)
../../gcc-source-trunk/gcc/cp/typeck.c:6279
0x7abd53 cp_parser_question_colon_clause
../../gcc-source-trunk/gcc/cp/parser.c:9047
0x7abd53 cp_parser_assignment_expression
../../gcc-source-trunk/gcc/cp/parser.c:9083
0x7abf9a cp_parser_constant_expression
../../gcc-source-trunk/gcc/cp/parser.c:9347
0x7ac754 cp_parser_initializer_clause
../../gcc-source-trunk/gcc/cp/parser.c:20885
0x7adf7b cp_parser_initializer
../../gcc-source-trunk/gcc/cp/parser.c:20825
0x7bfa8d cp_parser_init_declarator
../../gcc-source-trunk/gcc/cp/parser.c:18690
0x7c0631 cp_parser_simple_declaration
../../gcc-source-trunk/gcc/cp/parser.c:12415
0x7c095a cp_parser_block_declaration
../../gcc-source-trunk/gcc/cp/parser.c:12283
0x7ca294 cp_parser_declaration
../../gcc-source-trunk/gcc/cp/parser.c:12180
0x7c8b76 cp_parser_declaration_seq_opt
../../gcc-source-trunk/gcc/cp/parser.c:12059
0x7c8eac cp_parser_translation_unit
../../gcc-source-trunk/gcc/cp/parser.c:4350
0x7c8eac c_parse_file()
../../gcc-source-trunk/gcc/cp/parser.c:37549
0x92cc32 c_common_parse_file()
../../gcc-source-trunk/gcc/c-family/c-opts.c:1070
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$ cat small.C
struct C {
} a = C::C ?: 0;
$

[Bug c++/72809] New: ICE on x86_64-linux-gnu (Segmentation fault, tree_check)

2016-08-05 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72809

Bug ID: 72809
   Summary: ICE on x86_64-linux-gnu (Segmentation fault,
tree_check)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$ g++-trunk -v
Using built-in specs.
COLLECT_GCC=g++-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160805 (experimental) [trunk revision 239162] (GCC)
$ g++-trunk small.C
small.C:4:1: internal compiler error: Segmentation fault
 }
 ^
0xdb464f crash_signal
../../gcc-source-trunk/gcc/toplev.c:335
0x7ce965 tree_check(tree_node*, char const*, int, char const*, tree_code)
../../gcc-source-trunk/gcc/tree.h:3022
0x7ce965 get_pseudo_ti_index
../../gcc-source-trunk/gcc/cp/rtti.c:1296
0x7cedf7 get_tinfo_decl(tree_node*)
../../gcc-source-trunk/gcc/cp/rtti.c:421
0x7cf1d5 get_tinfo_ptr
../../gcc-source-trunk/gcc/cp/rtti.c:456
0x7d1224 ptr_initializer
../../gcc-source-trunk/gcc/cp/rtti.c:989
0x7d1224 get_pseudo_ti_init
../../gcc-source-trunk/gcc/cp/rtti.c:1100
0x7d1224 emit_tinfo_decl(tree_node*)
../../gcc-source-trunk/gcc/cp/rtti.c:1599
0x778594 c_parse_final_cleanups()
../../gcc-source-trunk/gcc/cp/decl2.c:4643
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$
$ cat small.C
void fn1() {
  __builtin_va_list a;
  throw(a);
}
$

[Bug c++/72774] New: ICE on invalid C++ code on x86_64-linux-gnu (tree check: expected tree that contains ‘decl minimal’ structure, have ‘tree_list’ in consider_binding_level, at cp/name-lookup.c:4721

2016-08-02 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72774

Bug ID: 72774
   Summary: ICE on invalid C++ code on x86_64-linux-gnu (tree
check: expected tree that contains ‘decl minimal’
structure, have ‘tree_list’ in consider_binding_level,
at cp/name-lookup.c:4721)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$ g++-trunk -v
Using built-in specs.
COLLECT_GCC=g++-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160802 (experimental) [trunk revision 238976] (GCC) 
$ g++-trunk small.C
small.C: In function ‘void bar()’:
small.C:7:19: internal compiler error: tree check: expected tree that contains
‘decl minimal’ structure, have ‘tree_list’ in consider_binding_level, at
cp/name-lookup.c:4721
   0 ? static_cast(0) : __assert_fail;
   ^
0x103eed4 tree_contains_struct_check_failed(tree_node const*,
tree_node_structure_enum, char const*, int, char const*)
../../gcc-source-trunk/gcc/tree.c:9914
0x87cb28 contains_struct_check(tree_node*, tree_node_structure_enum, char
const*, int, char const*)
../../gcc-source-trunk/gcc/tree.h:3137
0x87cb28 consider_binding_level
../../gcc-source-trunk/gcc/cp/name-lookup.c:4721
0x88272a lookup_name_fuzzy(tree_node*, lookup_name_fuzzy_kind)
../../gcc-source-trunk/gcc/cp/name-lookup.c:4742
0x791d5d cp_parser_diagnose_invalid_type_name
../../gcc-source-trunk/gcc/cp/parser.c:3168
0x7b437d cp_parser_parse_and_diagnose_invalid_type_name
../../gcc-source-trunk/gcc/cp/parser.c:3327
0x7a0317 cp_parser_type_specifier_seq
../../gcc-source-trunk/gcc/cp/parser.c:20107
0x7aaa62 cp_parser_type_id_1
../../gcc-source-trunk/gcc/cp/parser.c:19957
0x7a2b99 cp_parser_postfix_expression
../../gcc-source-trunk/gcc/cp/parser.c:6406
0x7a0c8c cp_parser_unary_expression
../../gcc-source-trunk/gcc/cp/parser.c:8012
0x7aac27 cp_parser_cast_expression
../../gcc-source-trunk/gcc/cp/parser.c:8689
0x7ab1db cp_parser_binary_expression
../../gcc-source-trunk/gcc/cp/parser.c:8790
0x7abaa0 cp_parser_assignment_expression
../../gcc-source-trunk/gcc/cp/parser.c:9077
0x7ae3fa cp_parser_expression
../../gcc-source-trunk/gcc/cp/parser.c:9246
0x7abbbd cp_parser_question_colon_clause
../../gcc-source-trunk/gcc/cp/parser.c:9020
0x7abbbd cp_parser_assignment_expression
../../gcc-source-trunk/gcc/cp/parser.c:9083
0x7ae3fa cp_parser_expression
../../gcc-source-trunk/gcc/cp/parser.c:9246
0x7ae9a3 cp_parser_expression_statement
../../gcc-source-trunk/gcc/cp/parser.c:10709
0x7bdcc6 cp_parser_statement
../../gcc-source-trunk/gcc/cp/parser.c:10560
0x7be6ac cp_parser_statement_seq_opt
../../gcc-source-trunk/gcc/cp/parser.c:10832
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$ cat small.C
void __assert_fail();
namespace A {
void g();
}
void bar() {
  using A::g;
  0 ? static_cast(0) : __assert_fail;
}
$

[Bug c++/72759] New: ICE on invalid C++ code on x86_64-linux-gnu (Segmentation fault, tree_class_check, ocp_convert)

2016-07-30 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72759

Bug ID: 72759
   Summary: ICE on invalid C++ code on x86_64-linux-gnu
(Segmentation fault, tree_class_check, ocp_convert)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$ g++-trunk  -v
Using built-in specs.
COLLECT_GCC=g++-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160730 (experimental) [trunk revision 238903] (GCC) 
$ g++-trunk small.C -std=c++14
small.C: In static member function ‘static void Specializer::A<
>::InnerMemberFn()’:
small.C:14:39: error: ‘SpecMbrFnPtr’ was not declared in this scope
   Spec ErrorSite = Spec::SpecMbrFnPtr;
   ^~~~
small.C: In instantiation of ‘static void Specializer::A<
>::InnerMemberFn() [with unsigned int  = 0u]’:
small.C:5:26:   required from here
small.C:14:8: internal compiler error: Segmentation fault
   Spec ErrorSite = Spec::SpecMbrFnPtr;
^
0xdb298f crash_signal
../../gcc-source-trunk/gcc/toplev.c:335
0x7f5a9d tree_class_check(tree_node*, tree_code_class, char const*, int, char
const*)
../../gcc-source-trunk/gcc/tree.h:3145
0x7f5a9d ocp_convert(tree_node*, tree_node*, int, int, int)
../../gcc-source-trunk/gcc/cp/cvt.c:859
0x8049aa expand_default_init
../../gcc-source-trunk/gcc/cp/init.c:1685
0x8049aa expand_aggr_init_1
../../gcc-source-trunk/gcc/cp/init.c:1863
0x8051e4 build_aggr_init(tree_node*, tree_node*, int, int)
../../gcc-source-trunk/gcc/cp/init.c:1602
0x69ba94 build_aggr_init_full_exprs
../../gcc-source-trunk/gcc/cp/decl.c:6004
0x69ba94 check_initializer
../../gcc-source-trunk/gcc/cp/decl.c:6151
0x6bbb2e cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
../../gcc-source-trunk/gcc/cp/decl.c:6856
0x6f0171 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc-source-trunk/gcc/cp/pt.c:15327
0x6ec644 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc-source-trunk/gcc/cp/pt.c:15216
0x6ecb22 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc-source-trunk/gcc/cp/pt.c:15401
0x6ea420 instantiate_decl(tree_node*, int, bool)
../../gcc-source-trunk/gcc/cp/pt.c:22133
0x732729 instantiate_pending_templates(int)
../../gcc-source-trunk/gcc/cp/pt.c:22252
0x778111 c_parse_final_cleanups()
../../gcc-source-trunk/gcc/cp/decl2.c:4601
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$ 
$ cat small.C
template  struct SpecPerType;
class Specializer {
  public:  template  static void MbrFnTempl();
  template  struct A { static void InnerMemberFn(); };
  void Trigger() { A<0>::InnerMemberFn; }
};
template <> struct SpecPerType {
  using FnType = void *;
  template 
  static constexpr FnType SpecMbrFnPtr = Specializer::MbrFnTempl;
};
template  void Specializer::A::InnerMemberFn() {
  using Spec = SpecPerType;
  Spec ErrorSite = Spec::SpecMbrFnPtr;
}
$

[Bug ipa/71981] New: ICE at -O2 and -O3 on x86_64-linux-gnu (internal compiler error: in get_dynamic_type, at ipa-polymorphic-call.c:1667)

2016-07-22 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71981

Bug ID: 71981
   Summary: ICE at -O2 and -O3 on x86_64-linux-gnu (internal
compiler error: in get_dynamic_type, at
ipa-polymorphic-call.c:1667)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ipa
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160722 (experimental) [trunk revision 238670] (GCC)
$
$ gcc-trunk -c -w -O2 small.c
small.c: In function ‘main’:
small.c:7:1: internal compiler error: in get_dynamic_type, at
ipa-polymorphic-call.c:1667
 int main() { fn1(""); return 0; }
 ^~~
0x9de9ae ipa_polymorphic_call_context::get_dynamic_type(tree_node*, tree_node*,
tree_node*, gimple*)
../../gcc-source-trunk/gcc/ipa-polymorphic-call.c:1667
0x9feb91 ipa_compute_jump_functions_for_edge
../../gcc-source-trunk/gcc/ipa-prop.c:1651
0x9feb91 ipa_compute_jump_functions_for_bb
../../gcc-source-trunk/gcc/ipa-prop.c:1765
0x9feb91 analysis_dom_walker::before_dom_children(basic_block_def*)
../../gcc-source-trunk/gcc/ipa-prop.c:2283
0x12319c2 dom_walker::walk(basic_block_def*)
../../gcc-source-trunk/gcc/domwalk.c:265
0xa024ec ipa_analyze_node(cgraph_node*)
../../gcc-source-trunk/gcc/ipa-prop.c:2353
0x128c3af ipcp_generate_summary
../../gcc-source-trunk/gcc/ipa-cp.c:4655
0xaf751e execute_ipa_summary_passes(ipa_opt_pass_d*)
../../gcc-source-trunk/gcc/passes.c:2170
0x7ec838 ipa_passes
../../gcc-source-trunk/gcc/cgraphunit.c:2295
0x7ec838 symbol_table::compile()
../../gcc-source-trunk/gcc/cgraphunit.c:2409
0x7eea97 symbol_table::compile()
../../gcc-source-trunk/gcc/cgraphunit.c:2543
0x7eea97 symbol_table::finalize_compilation_unit()
../../gcc-source-trunk/gcc/cgraphunit.c:2569
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$
$ cat small.c
int **a;
static void fn1(char **p1) {
  char s = *p1, b = &s;
  while (*fn2()[a])
;
}
int main() { fn1(""); return 0; }
$

[Bug c++/71972] New: ICE with "-std=c++14" on x86_64-linux-gnu (internal compiler error: Segmentation fault, cxx_eval_store_expression)

2016-07-22 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71972

Bug ID: 71972
   Summary: ICE with "-std=c++14" on x86_64-linux-gnu (internal
compiler error: Segmentation fault,
cxx_eval_store_expression)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$ g++-trunk -v
Using built-in specs.
COLLECT_GCC=g++-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160722 (experimental) [trunk revision 238645] (GCC)
$
$ g++-trunk -std=c++14 small.C
small.C: In instantiation of ‘auto concat(S, S) [with int N = 1; int M =
1]’:
small.C:14:16:   required from here
small.C:10:59:   in constexpr expansion of ‘s.S::S<1>(s1.S<1>::data)’
small.C:10:59: internal compiler error: Segmentation fault
 template  auto concat(S s1, S) { S<1> s(s1.data); }
   ^
0xdb18cf crash_signal
../../gcc-source-trunk/gcc/toplev.c:335
0x8be3b5 cxx_eval_store_expression
../../gcc-source-trunk/gcc/cp/constexpr.c:3238
0x8bbf7d cxx_eval_constant_expression
../../gcc-source-trunk/gcc/cp/constexpr.c:3741
0x8baee6 cxx_eval_constant_expression
../../gcc-source-trunk/gcc/cp/constexpr.c:4026
0x8bb120 cxx_eval_constant_expression
../../gcc-source-trunk/gcc/cp/constexpr.c:3780
0x8bb120 cxx_eval_constant_expression
../../gcc-source-trunk/gcc/cp/constexpr.c:3780
0x8c1306 cxx_eval_statement_list
../../gcc-source-trunk/gcc/cp/constexpr.c:3438
0x8bb6e0 cxx_eval_constant_expression
../../gcc-source-trunk/gcc/cp/constexpr.c:4082
0x8bbe8a cxx_eval_loop_expr
../../gcc-source-trunk/gcc/cp/constexpr.c:3470
0x8bbe8a cxx_eval_constant_expression
../../gcc-source-trunk/gcc/cp/constexpr.c:4159
0x8c1306 cxx_eval_statement_list
../../gcc-source-trunk/gcc/cp/constexpr.c:3438
0x8bb6e0 cxx_eval_constant_expression
../../gcc-source-trunk/gcc/cp/constexpr.c:4082
0x8c1306 cxx_eval_statement_list
../../gcc-source-trunk/gcc/cp/constexpr.c:3438
0x8bb6e0 cxx_eval_constant_expression
../../gcc-source-trunk/gcc/cp/constexpr.c:4082
0x8bb241 cxx_eval_constant_expression
../../gcc-source-trunk/gcc/cp/constexpr.c:4088
0x8bb241 cxx_eval_constant_expression
../../gcc-source-trunk/gcc/cp/constexpr.c:4088
0x8c1306 cxx_eval_statement_list
../../gcc-source-trunk/gcc/cp/constexpr.c:3438
0x8bb6e0 cxx_eval_constant_expression
../../gcc-source-trunk/gcc/cp/constexpr.c:4082
0x8bb241 cxx_eval_constant_expression
../../gcc-source-trunk/gcc/cp/constexpr.c:4088
0x8c1306 cxx_eval_statement_list
../../gcc-source-trunk/gcc/cp/constexpr.c:3438
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$
$ cat small.C
typedef int size_t;
template  struct S {
  template  constexpr S(char (&)[M]) : data{} {
for (size_t i = 0;;)
  data[i] = data[i];
  }
  char data[N];
};
template  S s(char const (&)[N]);
template  auto concat(S s1, S) { S<1> s(s1.data); }
int main() {
  auto s1 = s("");
  auto s2 = s("");
  concat(s1, s2);
  return 0;
}
$

[Bug tree-optimization/71908] New: ICE at -Os and above in both 32-bit and 64-bit modes on x86_64-linux-gnu (get_constraint_for_component_ref)

2016-07-16 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71908

Bug ID: 71908
   Summary: ICE at -Os and above in both 32-bit and 64-bit modes
on x86_64-linux-gnu (get_constraint_for_component_ref)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160716 (experimental) [trunk revision 238415] (GCC) 
$ 
$ gcc-trunk -O3 small.c
small.c: In function ‘main’:
small.c:10:5: internal compiler error: in get_constraint_for_component_ref, at
tree-ssa-structalias.c:3217
 int main() {
 ^~~~
0xda58ec get_constraint_for_component_ref
../../gcc-source-trunk/gcc/tree-ssa-structalias.c:3217
0xda58ec get_constraint_for_1
../../gcc-source-trunk/gcc/tree-ssa-structalias.c:3485
0xda9500 find_func_aliases
../../gcc-source-trunk/gcc/tree-ssa-structalias.c:4779
0xdaf22e compute_points_to_sets
../../gcc-source-trunk/gcc/tree-ssa-structalias.c:7056
0xdaf22e compute_may_aliases()
../../gcc-source-trunk/gcc/tree-ssa-structalias.c:7414
0xae7924 execute_function_todo
../../gcc-source-trunk/gcc/passes.c:1936
0xae84eb execute_todo
../../gcc-source-trunk/gcc/passes.c:2016
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$  cat small.c
struct S3 {
  int f3;
  int f5;
  char f6;
  int f7;
} b;
int a;
static struct S3 *c = &b;
int *d;
int main() {
  int i;
  for (;;) {
a = 0;
int **e = &d;
i = 0;
for (; i < 2; i++)
  d = &(*c).f5;
*e = d;
**e = 3;
  }
  return 0;
}

$

[Bug tree-optimization/71854] New: ICE at -O3 in both 32-bit and 64-bit modes on x86_64-linux-gnu (verify_gimple failed)

2016-07-12 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71854

Bug ID: 71854
   Summary: ICE at -O3 in both 32-bit and 64-bit modes on
x86_64-linux-gnu (verify_gimple failed)
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160712 (experimental) [trunk revision 238270] (GCC) 
$ 
$ gcc-trunk -O3 small.c
small.c: In function ‘main’:
small.c:7:5: error: the first argument of a VEC_COND_EXPR must be of a boolean
vector type of the same number of elements as the result
 int main() {
 ^~~~
vector(8) short int
vector(16) unsigned char
vect_iftmp.25_131 = VEC_COND_EXPR ;
small.c:7:5: internal compiler error: verify_gimple failed
0xc009c6 verify_gimple_in_cfg(function*, bool)
../../gcc-source-trunk/gcc/tree-cfg.c:5212
0xae784a execute_function_todo
../../gcc-source-trunk/gcc/passes.c:1964
0xae82cb execute_todo
../../gcc-source-trunk/gcc/passes.c:2016
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$ 
$ cat small.c
char a, f;
int b, c;
short d;
int e[8];
short fn1(short p1) { return p1 >= 2 || p1 >> c ? p1 : p1 << c; }

int main() {
  for (;;) {
d = 0;
for (; d <= 7; d++) {
  f = 7 >> b ? a : a << b;
  e[d] = fn1(f);
}
  }
  return 0;
}
$

[Bug tree-optimization/71708] New: ICE at -O3 in both 32-bit and 64-bit modes on x86_64-linux-gnu (vect_get_vec_def_for_stmt_copy)

2016-06-29 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71708

Bug ID: 71708
   Summary: ICE at -O3 in both 32-bit and 64-bit modes on
x86_64-linux-gnu (vect_get_vec_def_for_stmt_copy)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160629 (experimental) [trunk revision 237837] (GCC) 
$ 
$ gcc-trunk small.c -O3 
small.c: In function ‘main’:
small.c:4:5: internal compiler error: in vect_get_vec_def_for_stmt_copy, at
tree-vect-stmts.c:1527
 int main () {
 ^~~~
0xdf715f vect_get_vec_def_for_stmt_copy(vect_def_type, tree_node*)
../../gcc-source-trunk/gcc/tree-vect-stmts.c:1527
0xe0bb2a vectorizable_comparison
../../gcc-source-trunk/gcc/tree-vect-stmts.c:7941
0xe13484 vect_transform_stmt(gimple*, gimple_stmt_iterator*, bool*, _slp_tree*,
_slp_instance*)
../../gcc-source-trunk/gcc/tree-vect-stmts.c:8337
0xe1a3c3 vect_transform_loop(_loop_vec_info*)
../../gcc-source-trunk/gcc/tree-vect-loop.c:6893
0xe3958f vectorize_loops()
../../gcc-source-trunk/gcc/tree-vectorizer.c:554
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$ gcc-trunk small.c -O3  -m32
small.c: In function ‘main’:
small.c:4:5: internal compiler error: in vect_get_vec_def_for_stmt_copy, at
tree-vect-stmts.c:1527
 int main () {
 ^~~~
0xdf715f vect_get_vec_def_for_stmt_copy(vect_def_type, tree_node*)
../../gcc-source-trunk/gcc/tree-vect-stmts.c:1527
0xe0bb2a vectorizable_comparison
../../gcc-source-trunk/gcc/tree-vect-stmts.c:7941
0xe13484 vect_transform_stmt(gimple*, gimple_stmt_iterator*, bool*, _slp_tree*,
_slp_instance*)
../../gcc-source-trunk/gcc/tree-vect-stmts.c:8337
0xe1a3c3 vect_transform_loop(_loop_vec_info*)
../../gcc-source-trunk/gcc/tree-vect-loop.c:6893
0xe3958f vectorize_loops()
../../gcc-source-trunk/gcc/tree-vectorizer.c:554
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$ 
$ cat small.c
char a;
int b, c, d;

int main () {
  unsigned e;
  for (; a; a = a + 7)
c |= !b <= (e = d <= a);
  return 0;
}

[Bug tree-optimization/71691] New: wrong code at -O3 in both 32-bit and 64-bit modes on x86_64-linux-gnu (Floating point exception)

2016-06-28 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71691

Bug ID: 71691
   Summary: wrong code at -O3 in both 32-bit and 64-bit modes on
x86_64-linux-gnu (Floating point exception)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160628 (experimental) [trunk revision 237830] (GCC) 
$ 
$ gcc-trunk -O3 -m32 small.c ; ./a.out
Floating point exception (core dumped)
$ 
$ gcc-trunk -O3 -m64 small.c ; ./a.out
Floating point exception (core dumped)
$ 
$ gcc-trunk -O2 -m64 small.c ; ./a.out
$ 
$ cat small.c
char b;
short f;
unsigned e;
int g = 20;
void fn1() {
  int l = 0;
  for (; l <= 7; l++) {
int h, j = 38;
if (g)
  h = 0;
for (; h <= 7; h++) {
  int i, k = b % (j % 4);
  g = f;
  for (;;) {
j = 6 || b;
if (e) {
  for (; j; --j)
if (k)
  __builtin_printf("%d", 9);
  if (i)
__builtin_printf("%d", j);
}
if (l)
  continue;
break;
  }
  i = f || b; 
}
  }
}

int main() { 
  fn1(); 
  return 0;
}
$

[Bug c++/71638] New: ICE on x86_64-linux-gnu with -Wall (internal compiler error: non-constant element in constant CONSTRUCTOR)

2016-06-23 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71638

Bug ID: 71638
   Summary: ICE on x86_64-linux-gnu with -Wall (internal compiler
error: non-constant element in constant CONSTRUCTOR)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$: g++-trunk -v
Using built-in specs.
COLLECT_GCC=g++-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160623 (experimental) [trunk revision 237733] (GCC) 
$: 
$: g++-trunk -Wall small.C
small.C:3:13: error: invalid conversion from ‘A::*’ to ‘int’
[-fpermissive]
 int j = this;
 ^~~~
small.C: In function ‘void f(A)’:
small.C:9:8: internal compiler error: non-constant element in constant
CONSTRUCTOR
   f(A{});
^
0x103f5bb verify_constructor_flags(tree_node*)
../../gcc-source-trunk/gcc/tree.c:1830
0x8aac29 cxx_eval_constant_expression
../../gcc-source-trunk/gcc/cp/constexpr.c:3945
0x8aad18 cxx_eval_constant_expression
../../gcc-source-trunk/gcc/cp/constexpr.c:4092
0x8ab4ce cxx_eval_indirect_ref
../../gcc-source-trunk/gcc/cp/constexpr.c:2944
0x8ab4ce cxx_eval_constant_expression
../../gcc-source-trunk/gcc/cp/constexpr.c:3771
0x8af369 cxx_eval_component_reference
../../gcc-source-trunk/gcc/cp/constexpr.c:2153
0x8ab7a8 cxx_eval_constant_expression
../../gcc-source-trunk/gcc/cp/constexpr.c:3923
0x8af369 cxx_eval_component_reference
../../gcc-source-trunk/gcc/cp/constexpr.c:2153
0x8ab7a8 cxx_eval_constant_expression
../../gcc-source-trunk/gcc/cp/constexpr.c:3923
0x8b0074 cxx_eval_bare_aggregate
../../gcc-source-trunk/gcc/cp/constexpr.c:2485
0x8aac62 cxx_eval_constant_expression
../../gcc-source-trunk/gcc/cp/constexpr.c:3952
0x8ab28c cxx_eval_constant_expression
../../gcc-source-trunk/gcc/cp/constexpr.c:3694
0x8aadfa cxx_eval_constant_expression
../../gcc-source-trunk/gcc/cp/constexpr.c:3779
0x8aa86b cxx_eval_constant_expression
../../gcc-source-trunk/gcc/cp/constexpr.c:3981
0x8b1419 cxx_eval_outermost_constant_expr
../../gcc-source-trunk/gcc/cp/constexpr.c:4211
0x8b4278 maybe_constant_value_1
../../gcc-source-trunk/gcc/cp/constexpr.c:4405
0x8b4278 maybe_constant_value(tree_node*, tree_node*)
../../gcc-source-trunk/gcc/cp/constexpr.c:4429
0x66bcf2 build_over_call
../../gcc-source-trunk/gcc/cp/call.c:7648
0x6778d1 build_new_method_call_1
../../gcc-source-trunk/gcc/cp/call.c:8515
0x6778d1 build_new_method_call(tree_node*, tree_node*, vec**, tree_node*, int, tree_node**, int)
../../gcc-source-trunk/gcc/cp/call.c:8585
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$: 
$: cat small.C
struct A {
  struct {
int j = this;
  } b;
  int a = b.j;
};

void f(A) { 
  f(A{}); 
}

[Bug c/71632] New: hang at -O3 on x86_64-linux-gnu

2016-06-23 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71632

Bug ID: 71632
   Summary: hang at -O3 on x86_64-linux-gnu
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

This is a recent regression. gcc-5.3 is okay. 

$: gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160623 (experimental) [trunk revision 237726] (GCC) 
$: 
$: timeout -s 9 30 gcc-trunk -O3 small.c
Killed
$: 
$: cat small.c
int a, b;
double **c;
void fn1() {
  double d;
  a = 0;
  for (; a < 6; a++) {
b = 0;
for (; b < 5; b++)
  d = c[a][b] > d;
  }
  c[0][b] = d;
}

$:

[Bug c/71626] New: ICE at -O1 and above on x86_64-linux-gnu (in output_constant_pool_2, at varasm.c:3837)

2016-06-22 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71626

Bug ID: 71626
   Summary: ICE at -O1 and above on x86_64-linux-gnu (in
output_constant_pool_2, at varasm.c:3837)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

This is a regression. gcc-4.9 also ICEs. 

$: gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160622 (experimental) [trunk revision 237712] (GCC) 
$: 
$: gcc-trunk -O1 small.c
small.c: In function ‘fn’:
small.c:5:16: warning: initialization makes integer from pointer without a cast
[-Wint-conversion]
   vllong1 v = {fn};
^~
small.c:5:16: note: (near initialization for ‘v’)
small.c: At top level:
small.c:7:1: internal compiler error: in output_constant_pool_2, at
varasm.c:3837
 }
 ^
0xea3de4 output_constant_pool_2
../../gcc-source-trunk/gcc/varasm.c:3837
0xea3e9d output_constant_pool_1
../../gcc-source-trunk/gcc/varasm.c:3909
0xeb270d output_constant_pool_contents
../../gcc-source-trunk/gcc/varasm.c:4023
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$: 
$: cat small.c
typedef long llong;
typedef llong vllong1 __attribute__((__vector_size__(sizeof(llong;

vllong1 fn() {
  vllong1 v = {fn};
  return v;
}

$:

[Bug c/71606] New: ICE on -O2 and above on x86_64-linux-gnu (internal compiler error: in get_expr_operands, at tree-ssa-operands.c:882)

2016-06-21 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71606

Bug ID: 71606
   Summary: ICE on -O2 and above on x86_64-linux-gnu (internal
compiler error: in get_expr_operands, at
tree-ssa-operands.c:882)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

This is a regression. gcc-4.8 also crashes. 

$: gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160621 (experimental) [trunk revision 237628] (GCC) 
$: 
$: gcc-trunk -O2 small.c
unhandled expression in get_expr_operands():
 
unit size 
align 64 symtab 0 alias set -1 canonical type 0x7fe5fd7ae5e8
precision 64
pointer_to_this >
DC
size 
unit size 
align 64 symtab 0 alias set -1 canonical type 0x7fe5fd7aef18>
side-effects
arg 0 
visiteddef_stmt a.0_1 = a;

version 1>>

small.c: In function ‘main’:
small.c:5:3: internal compiler error: in get_expr_operands, at
tree-ssa-operands.c:882
   fn1 (a);
   ^~~
0xd40154 get_expr_operands
../../gcc-source-trunk/gcc/tree-ssa-operands.c:882
0xd3f81f get_expr_operands
../../gcc-source-trunk/gcc/tree-ssa-operands.c:769
0xd40939 parse_ssa_operands
../../gcc-source-trunk/gcc/tree-ssa-operands.c:932
0xd422ca build_ssa_operands
../../gcc-source-trunk/gcc/tree-ssa-operands.c:947
0xd422ca update_stmt_operands(function*, gimple*)
../../gcc-source-trunk/gcc/tree-ssa-operands.c:1081
0x926466 update_stmt_if_modified
../../gcc-source-trunk/gcc/gimple-ssa.h:185
0x926466 update_modified_stmt
../../gcc-source-trunk/gcc/gimple-iterator.c:44
0x926466 gsi_insert_after(gimple_stmt_iterator*, gimple*, gsi_iterator_update)
../../gcc-source-trunk/gcc/gimple-iterator.c:545
0xc2d157 insert_init_stmt
../../gcc-source-trunk/gcc/tree-inline.c:3054
0xc3a788 setup_one_parameter
../../gcc-source-trunk/gcc/tree-inline.c:3221
0xc3b965 initialize_inlined_parameters
../../gcc-source-trunk/gcc/tree-inline.c:3248
0xc3b965 expand_call_inline
../../gcc-source-trunk/gcc/tree-inline.c:4590
0xc3d644 gimple_expand_calls_inline
../../gcc-source-trunk/gcc/tree-inline.c:4849
0xc3d644 optimize_inline_calls(tree_node*)
../../gcc-source-trunk/gcc/tree-inline.c:4989
0x12c1132 early_inliner(function*)
../../gcc-source-trunk/gcc/ipa-inline.c:2725
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$: 
$: gcc-trunk small.c
$: 
$: cat small.c
_Complex a;
void fn1 ();

int main () {
  fn1 (a);
  return 0;
}

void fn1 (__complex__ long double p1) {
  __imag__ p1 = 6.0L;
}
$:

[Bug c/71602] New: ICE on valid code on x86_64-linux-gnu (in build_va_arg, at c-family/c-common.c:5810)

2016-06-20 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71602

Bug ID: 71602
   Summary: ICE on valid code on x86_64-linux-gnu (in
build_va_arg, at c-family/c-common.c:5810)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

This is a regression. gcc-5.3 and older versions are okay with the following
test program. 

$: gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160620 (experimental) [trunk revision 237605] (GCC) 
$: 
$: gcc-trunk -c small.c
small.c: In function ‘fn1’:
small.c:3:3: internal compiler error: in build_va_arg, at
c-family/c-common.c:5810
   __builtin_va_arg(pap, double);
   ^~~~
0x7067a2 build_va_arg(unsigned int, tree_node*, tree_node*)
../../gcc-source-trunk/gcc/c-family/c-common.c:5810
0x6a0d23 c_parser_postfix_expression
../../gcc-source-trunk/gcc/c/c-parser.c:7668
0x6a335a c_parser_unary_expression
../../gcc-source-trunk/gcc/c/c-parser.c:6942
0x6a418a c_parser_cast_expression
../../gcc-source-trunk/gcc/c/c-parser.c:6771
0x6a4394 c_parser_binary_expression
../../gcc-source-trunk/gcc/c/c-parser.c:6580
0x6a5045 c_parser_conditional_expression
../../gcc-source-trunk/gcc/c/c-parser.c:6351
0x6a56c0 c_parser_expr_no_commas
../../gcc-source-trunk/gcc/c/c-parser.c:6268
0x6a5dc2 c_parser_expression
../../gcc-source-trunk/gcc/c/c-parser.c:8464
0x6a6829 c_parser_expression_conv
../../gcc-source-trunk/gcc/c/c-parser.c:8497
0x6bcb28 c_parser_statement_after_labels
../../gcc-source-trunk/gcc/c/c-parser.c:5287
0x6be9cb c_parser_compound_statement_nostart
../../gcc-source-trunk/gcc/c/c-parser.c:4861
0x6bf25e c_parser_compound_statement
../../gcc-source-trunk/gcc/c/c-parser.c:4696
0x6c0487 c_parser_declaration_or_fndef
../../gcc-source-trunk/gcc/c/c-parser.c:2105
0x6c9625 c_parser_external_declaration
../../gcc-source-trunk/gcc/c/c-parser.c:1549
0x6c9eb9 c_parser_translation_unit
../../gcc-source-trunk/gcc/c/c-parser.c:1430
0x6c9eb9 c_parse_file()
../../gcc-source-trunk/gcc/c/c-parser.c:17931
0x72c2b2 c_common_parse_file()
../../gcc-source-trunk/gcc/c-family/c-opts.c:1070
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$: 
$: gcc-5.3 -c small.c
$: 
$: cat small.c
__builtin_va_list *pap;
void fn1() {
  __builtin_va_arg(pap, double); 
}
$:

[Bug c/71583] ICE on invalid code on x86_64-linux-gnu (in c_parser_postfix_expression_after_paren_type, at c/c-parser.c:8192)

2016-06-18 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71583

Chengnian Sun  changed:

   What|Removed |Added

 CC||chengniansun at gmail dot com

--- Comment #2 from Chengnian Sun  ---
(In reply to Andrew Pinski from comment #1)
> >gcc-5.3 and older versions do not crash. 
> 
> Actually they do:
> >small.c:4: confused by earlier errors, bailing out
> 
> This is just GCC emitting a message that an ICE occurred after an error
> message happened.  GCC emits that message if not configured with checking
> enabled.

Oh, I see. Thank you for the info.

[Bug c/71583] New: ICE on invalid code on x86_64-linux-gnu (in c_parser_postfix_expression_after_paren_type, at c/c-parser.c:8192)

2016-06-18 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71583

Bug ID: 71583
   Summary: ICE on invalid code on x86_64-linux-gnu (in
c_parser_postfix_expression_after_paren_type, at
c/c-parser.c:8192)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

gcc-5.3 and older versions do not crash. 


$: gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160618 (experimental) [trunk revision 237575] (GCC) 
$: 
$: gcc-trunk -c small.c
small.c: In function ‘fn1’:
small.c:4:4: error: expected expression before ‘int’
   {int};
^~~
small.c:4:4: internal compiler error: in
c_parser_postfix_expression_after_paren_type, at c/c-parser.c:8192
0x6ac63f c_parser_postfix_expression_after_paren_type
../../gcc-source-trunk/gcc/c/c-parser.c:8192
0x6a4300 c_parser_cast_expression
../../gcc-source-trunk/gcc/c/c-parser.c:6757
0x6a4374 c_parser_binary_expression
../../gcc-source-trunk/gcc/c/c-parser.c:6580
0x6a5025 c_parser_conditional_expression
../../gcc-source-trunk/gcc/c/c-parser.c:6351
0x6a56a0 c_parser_expr_no_commas
../../gcc-source-trunk/gcc/c/c-parser.c:6268
0x6a5da2 c_parser_expression
../../gcc-source-trunk/gcc/c/c-parser.c:8463
0x6a6809 c_parser_expression_conv
../../gcc-source-trunk/gcc/c/c-parser.c:8496
0x6bcb08 c_parser_statement_after_labels
../../gcc-source-trunk/gcc/c/c-parser.c:5287
0x6be9ab c_parser_compound_statement_nostart
../../gcc-source-trunk/gcc/c/c-parser.c:4861
0x6bf23e c_parser_compound_statement
../../gcc-source-trunk/gcc/c/c-parser.c:4696
0x6c0467 c_parser_declaration_or_fndef
../../gcc-source-trunk/gcc/c/c-parser.c:2105
0x6c9605 c_parser_external_declaration
../../gcc-source-trunk/gcc/c/c-parser.c:1549
0x6c9e99 c_parser_translation_unit
../../gcc-source-trunk/gcc/c/c-parser.c:1430
0x6c9e99 c_parse_file()
../../gcc-source-trunk/gcc/c/c-parser.c:17930
0x72c292 c_common_parse_file()
../../gcc-source-trunk/gcc/c-family/c-opts.c:1070
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$: 
$: gcc-5.3 small.c
small.c: In function ‘fn1’:
small.c:4:4: error: expected expression before ‘int’
   {int};
^
small.c:4: confused by earlier errors, bailing out
$: 
$: cat small.c
int i;
void fn1() {
  (int(*)[++i]) 
  {int};
}
$:

[Bug c/71581] New: ICE on valid code on x86_64-linux-gnu with -Wuninitialized (Segmentation fault)

2016-06-18 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71581

Bug ID: 71581
   Summary: ICE on valid code on x86_64-linux-gnu with
-Wuninitialized (Segmentation fault)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

This is a regression. gcc-4.9 and gcc-4.8 do not ICE. 

$: gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160618 (experimental) [trunk revision 237575] (GCC) 
$: 
$: gcc-trunk -c small.c -Wuninitialized
small.c: In function ‘fn1’:
small.c:4:1: internal compiler error: Segmentation fault
 }
 ^
0xbbb84f crash_signal
../../gcc-source-trunk/gcc/toplev.c:335
0xdbe07f warn_uninit
../../gcc-source-trunk/gcc/tree-ssa-uninit.c:140
0xdbe3fb warn_uninitialized_vars
../../gcc-source-trunk/gcc/tree-ssa-uninit.c:197
0xdbe730 execute_early_warn_uninitialized
../../gcc-source-trunk/gcc/tree-ssa-uninit.c:2449
0xdbe730 execute
../../gcc-source-trunk/gcc/tree-ssa-uninit.c:2484
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$: 
$: gcc-trunk -c small.c 
$: 
$: cat small.c
_Complex long double fn1() {
  long double x;
  return x;
}
$:

[Bug c/71573] New: ICE on invalid C code on x86_64-linux-gnu (tree check: expected function_decl, have var_decl in implicitly_declare)

2016-06-17 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71573

Bug ID: 71573
   Summary: ICE on invalid C code on x86_64-linux-gnu (tree check:
expected function_decl, have var_decl in
implicitly_declare)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

The following code crashes the trunk on on x86_64-linux-gnu in both 32-bit and
64-bit modes. 

gcc-6.1 and all older versions do not crash. This should be a recent
regression.


$: gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160617 (experimental) [trunk revision 237557] (GCC) 
$: 
$: gcc-trunk small.c
small.c: In function ‘f2’:
small.c:4:3: internal compiler error: tree check: expected function_decl, have
var_decl in implicitly_declare, at c/c-decl.c:3313
   t(g);
   ^
0xe6b3bc tree_check_failed(tree_node const*, char const*, int, char const*,
...)
../../gcc-source-trunk/gcc/tree.c:9752
0x64dc01 tree_check
../../gcc-source-trunk/gcc/tree.h:3030
0x64dc01 implicitly_declare(unsigned int, tree_node*)
../../gcc-source-trunk/gcc/c/c-decl.c:3313
0x66ba52 build_external_ref(unsigned int, tree_node*, int, tree_node**)
../../gcc-source-trunk/gcc/c/c-typeck.c:2728
0x6a1457 c_parser_postfix_expression
../../gcc-source-trunk/gcc/c/c-parser.c:7497
0x6a1c2a c_parser_unary_expression
../../gcc-source-trunk/gcc/c/c-parser.c:6942
0x6a2a3a c_parser_cast_expression
../../gcc-source-trunk/gcc/c/c-parser.c:6771
0x6a2c44 c_parser_binary_expression
../../gcc-source-trunk/gcc/c/c-parser.c:6580
0x6a38f5 c_parser_conditional_expression
../../gcc-source-trunk/gcc/c/c-parser.c:6351
0x6a3f70 c_parser_expr_no_commas
../../gcc-source-trunk/gcc/c/c-parser.c:6268
0x6a4672 c_parser_expression
../../gcc-source-trunk/gcc/c/c-parser.c:8463
0x6a50d9 c_parser_expression_conv
../../gcc-source-trunk/gcc/c/c-parser.c:8496
0x6bb408 c_parser_statement_after_labels
../../gcc-source-trunk/gcc/c/c-parser.c:5287
0x6bd2ab c_parser_compound_statement_nostart
../../gcc-source-trunk/gcc/c/c-parser.c:4861
0x6bdb3e c_parser_compound_statement
../../gcc-source-trunk/gcc/c/c-parser.c:4696
0x6bed67 c_parser_declaration_or_fndef
../../gcc-source-trunk/gcc/c/c-parser.c:2105
0x6c7f95 c_parser_external_declaration
../../gcc-source-trunk/gcc/c/c-parser.c:1549
0x6c8829 c_parser_translation_unit
../../gcc-source-trunk/gcc/c/c-parser.c:1430
0x6c8829 c_parse_file()
../../gcc-source-trunk/gcc/c/c-parser.c:17930
0x72b1b2 c_common_parse_file()
../../gcc-source-trunk/gcc/c-family/c-opts.c:1070
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$: 
$: cat small.c
void f1() { extern int t; }
void f2() {
  int g;
  t(g);
}
$:

[Bug tree-optimization/71416] [7 Regression] ICE at -O3 in 32-bit and 64-bit modes on x86_64-linux-gnu (vectorizable_live_operation)

2016-06-11 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71416

Chengnian Sun  changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 CC||chengniansun at gmail dot com
 Resolution|DUPLICATE   |---

--- Comment #7 from Chengnian Sun  ---
As Qirun said, this bug has not been fixed yet.

[Bug tree-optimization/71439] New: wrong code at -O3 in 32-bit and 64-bit mode on x86_64-linux-gnu

2016-06-06 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71439

Bug ID: 71439
   Summary: wrong code at -O3 in 32-bit and 64-bit mode on
x86_64-linux-gnu
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

The following code is miscompiled by the trunk at -O3 in both 32-bit and 64-bit
modes on x86_64-linux-gnu. 

$: gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160606 (experimental) [trunk revision 237156] (GCC) 
$: 
$: gcc-trunk -O3 small.c ; ./a.out
0
$: gcc-trunk -O2 small.c ; ./a.out
6
$: 
$: cat small.c
int printf(const char*, ...);
int a, b, c;
short fn1(int p1, int p2) { return p1 + p2; }

int main() {
  a = 0;
  for (; a < 30; a = fn1(a, 4)) {
c = b;
b = 6;
  }
  printf("%d\n", c);
  return 0;
}
$:

[Bug tree-optimization/71416] New: ICE at -O3 in 32-bit and 64-bit modes on x86_64-linux-gnu (vectorizable_live_operation)

2016-06-04 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71416

Bug ID: 71416
   Summary: ICE at -O3 in 32-bit and 64-bit modes on
x86_64-linux-gnu (vectorizable_live_operation)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$: gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160604 (experimental) [trunk revision 237091] (GCC) 
$: 
$: gcc-trunk -m64 -O3 small.c
small.c: In function ‘main’:
small.c:5:5: internal compiler error: in vectorizable_live_operation, at
tree-vect-loop.c:6377
 int main() {
 ^~~~
0xe0661f vectorizable_live_operation(gimple*, gimple_stmt_iterator*,
_slp_tree*, int, gimple**)
../../gcc-source-trunk/gcc/tree-vect-loop.c:6377
0xe02bcf vect_transform_stmt(gimple*, gimple_stmt_iterator*, bool*, _slp_tree*,
_slp_instance*)
../../gcc-source-trunk/gcc/tree-vect-stmts.c:8336
0xe09a33 vect_transform_loop(_loop_vec_info*)
../../gcc-source-trunk/gcc/tree-vect-loop.c:6911
0xe28baf vectorize_loops()
../../gcc-source-trunk/gcc/tree-vectorizer.c:554
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$: 
$: cat small.c
short a;
char b, e;
static short c;
int d, f;
int main() {
  short g;
  for (; e; ++e) {
d = a;
f = 0;
if (b)
  d = f = g >= c;
  }
  return 0;
}

$:

[Bug tree-optimization/71407] ICE at -O3 in 32-bit and 64-bit modes on x86_64-linux-gnu (verify_gimple: integral result type precision does not match field size of BIT_FIELD_REF)

2016-06-04 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71407

Chengnian Sun  changed:

   What|Removed |Added

 CC||chengniansun at gmail dot com

--- Comment #1 from Chengnian Sun  ---
A better cleaned test case. 

int a, c, d;
short b;

void fn1 ()
{
  int e;
  for (; c; c++)
{
  for (; a; a++)
b = (short) a || e;
  e = d;
}
}

[Bug tree-optimization/71407] New: ICE at -O3 in 32-bit and 64-bit modes on x86_64-linux-gnu (verify_gimple: integral result type precision does not match field size of BIT_FIELD_REF)

2016-06-03 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71407

Bug ID: 71407
   Summary: ICE at -O3 in 32-bit and 64-bit modes on
x86_64-linux-gnu (verify_gimple: integral result type
precision does not match field size of BIT_FIELD_REF)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$: gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160603 (experimental) [trunk revision 237082] (GCC) 
$: 
$: gcc-trunk -O3 small.c -w
small.c: In function ‘fn2’:
small.c:6:6: error: integral result type precision does not match field size of
BIT_FIELD_REF
 void fn2() {
  ^~~
BIT_FIELD_REF 
cc1: note: in statement
_70 = BIT_FIELD_REF ;
small.c:6:6: internal compiler error: verify_gimple failed
0xbf0a26 verify_gimple_in_cfg(function*, bool)
../../gcc-source-trunk/gcc/tree-cfg.c:5211
0xaddd7a execute_function_todo
../../gcc-source-trunk/gcc/passes.c:1964
0xade7fb execute_todo
../../gcc-source-trunk/gcc/passes.c:2016
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$: 
$: cat small.c
int a, d;
char b;
short c;
short fn1() {}

void fn2() {
  int e;
  for (; c; c++) {
for (; a; a++)
  b = fn1() || e;
e = d;
  }
}

int main() {}
$:

[Bug tree-optimization/71398] New: ICE at -O3 in 32-bit and 64-bit mode on x86_64-linux-gnu (Segmentation fault, find_edge)

2016-06-03 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71398

Bug ID: 71398
   Summary: ICE at -O3 in 32-bit and 64-bit mode on
x86_64-linux-gnu (Segmentation fault, find_edge)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$: gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160602 (experimental) [trunk revision 237029] (GCC) 
$: 
$: gcc-trunk -O3 -m32 small.c
small.c:1:16: warning: array ‘c’ assumed to have one element
 unsigned a, b, c[];
^
small.c: In function ‘fn1’:
small.c:3:6: internal compiler error: Segmentation fault
 void fn1() {
  ^~~
0xbbceaf crash_signal
../../gcc-source-trunk/gcc/toplev.c:333
0x7886a4 find_edge(basic_block_def*, basic_block_def*)
../../gcc-source-trunk/gcc/cfganal.c:506
0xd05831 unloop_loops
../../gcc-source-trunk/gcc/tree-ssa-loop-ivcanon.c:633
0xd08ae2 tree_unroll_loops_completely(bool, bool)
../../gcc-source-trunk/gcc/tree-ssa-loop-ivcanon.c:1379
0xd08c93 execute
../../gcc-source-trunk/gcc/tree-ssa-loop-ivcanon.c:1587
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$: 
$: cat small.c
unsigned a, b, c[];
void __assert_fail() __attribute__((__noreturn__));
void fn1() {
  int d;
  unsigned e;
  for (;;) {
d = 0;
for (; d <= 6; d++)
  c[d] || a ? 0 : __assert_fail();
for (; e <= 5; e++)
  a = b;
  }
}

int main() {}
$:

[Bug tree-optimization/71328] [7 Regression] ice in verify_jump_thread

2016-06-01 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71328

Chengnian Sun  changed:

   What|Removed |Added

 CC||chengniansun at gmail dot com

--- Comment #2 from Chengnian Sun  ---
A much smaller test case.


int a, b, c;
void fn1() {
  unsigned char d = 3;
  if (d > 11)
  lbl_596:
  c = 0;
  while (!d)
b = b;
  unsigned char e = e || d;
  d = e;
  if (a)
d = d || a;
  goto lbl_596;
}

[Bug tree-optimization/71359] New: ICE at -Os and above in 32-bit and 64-bit modes on x86_64-linux-gnu (Segmentation fault, vec_safe_length)

2016-05-31 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71359

Bug ID: 71359
   Summary: ICE at -Os and above in 32-bit and 64-bit modes on
x86_64-linux-gnu (Segmentation fault,
vec_safe_length)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$: gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160531 (experimental) [trunk revision 236912] (GCC) 
$: gcc-trunk -w -O3 small.c
small.c: In function ‘fn1’:
small.c:3:6: internal compiler error: Segmentation fault
 void fn1() {
  ^~~
0xbbd02f crash_signal
../../gcc-source-trunk/gcc/toplev.c:333
0xd08d70 vec_safe_length
../../gcc-source-trunk/gcc/vec.h:529
0xd08d70 loop_outer
../../gcc-source-trunk/gcc/cfgloop.h:456
0xd08d70 tree_unroll_loops_completely_1
../../gcc-source-trunk/gcc/tree-ssa-loop-ivcanon.c:1347
0xd08ce0 tree_unroll_loops_completely_1
../../gcc-source-trunk/gcc/tree-ssa-loop-ivcanon.c:1314
0xd08ce0 tree_unroll_loops_completely_1
../../gcc-source-trunk/gcc/tree-ssa-loop-ivcanon.c:1314
0xd09013 tree_unroll_loops_completely(bool, bool)
../../gcc-source-trunk/gcc/tree-ssa-loop-ivcanon.c:1384
0xd09583 execute
../../gcc-source-trunk/gcc/tree-ssa-loop-ivcanon.c:1593
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$: cat small.c
char a[];
int b;
void fn1() {
  int i;
  for (;;) {
i = 0;
for (; i < 6; i++) {
  if (b)
for (;;)
  ;
  int c = a[i];
  printf("", i);
}
  }
}

int main() {}
$:

[Bug tree-optimization/71341] New: ICE at -O2 and -O3 in 32-bit and 64-bit modes on x86_64-linux-gnu (Segmentation fault, duplicate_thread_path)

2016-05-30 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71341

Bug ID: 71341
   Summary: ICE at -O2 and -O3 in 32-bit and 64-bit modes on
x86_64-linux-gnu (Segmentation fault,
duplicate_thread_path)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

The following code crashes the trunk at -O2 and -O3 in 32-bit and 64-bit modes
on x86_64-linux-gnu.


$: gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160529 (experimental) [trunk revision 236861] (GCC) 
$: gcc-trunk -O2 small.c
small.c: In function ‘fn1’:
small.c:5:6: internal compiler error: Segmentation fault
 void fn1() {
  ^~~
0xbbc95f crash_signal
../../gcc-source-trunk/gcc/toplev.c:333
0xdbffac duplicate_thread_path
../../gcc-source-trunk/gcc/tree-ssa-threadupdate.c:2348
0xdbffac thread_through_all_blocks(bool)
../../gcc-source-trunk/gcc/tree-ssa-threadupdate.c:2496
0xdb8bee execute
../../gcc-source-trunk/gcc/tree-ssa-threadbackward.c:686
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$: cat small.c
struct S3 {
  char f0;
};
int a, b;
void fn1() {
  struct S3 c = {1};
  while (!c.f0 || a) {
c.f0 = 0;
for (; c.f0; c.f0 = b)
  ;
  }
}

int main() {}
$:

[Bug tree-optimization/71335] New: wrong code at -O2 and -O3 in 32-bit and 64-bit modes on x86_64-linux-gnu

2016-05-29 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71335

Bug ID: 71335
   Summary: wrong code at -O2 and -O3 in 32-bit and 64-bit modes
on x86_64-linux-gnu
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$: gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160529 (experimental) [trunk revision 236861] (GCC)
$: gcc-trunk small.c -O3 -m64 ; timeout -s 9 2 ./a.out
Killed
$: gcc-trunk small.c -O2 -m64 ; timeout -s 9 2 ./a.out
Killed
$: gcc-trunk small.c -Os -m64 ; timeout -s 9 2 ./a.out
$: cat small.c
int a;
int main() {
  int b = 0;
  while (a < 0 || b) {
b = 0;
for (; b < 9; b++)
  ;
  }
  return 0;
}
$:

[Bug tree-optimization/71263] New: ICE at -O1 and above in 32-bit and 64-bit mode on x86_64-linux-gnu (in zero_one_operation)

2016-05-24 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71263

Bug ID: 71263
   Summary: ICE at -O1 and above in 32-bit and 64-bit mode on
x86_64-linux-gnu (in zero_one_operation)
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$: gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160523 (experimental) [trunk revision 236582] (GCC)
$: gcc-trunk -O1 small.c -m64
small.c: In function ‘fn1’:
small.c:3:6: internal compiler error: in zero_one_operation, at
tree-ssa-reassoc.c:1230
 void fn1() { a = a * 8 + -a * b; }
  ^~~
0xd69d79 zero_one_operation
../../gcc-source-trunk/gcc/tree-ssa-reassoc.c:1229
0xd72232 undistribute_ops_list
../../gcc-source-trunk/gcc/tree-ssa-reassoc.c:1583
0xd72f28 reassociate_bb
../../gcc-source-trunk/gcc/tree-ssa-reassoc.c:5199
0xd72a47 reassociate_bb
../../gcc-source-trunk/gcc/tree-ssa-reassoc.c:5325
0xd75653 do_reassoc
../../gcc-source-trunk/gcc/tree-ssa-reassoc.c:5439
0xd75653 execute_reassoc
../../gcc-source-trunk/gcc/tree-ssa-reassoc.c:5526
0xd75653 execute
../../gcc-source-trunk/gcc/tree-ssa-reassoc.c:5565
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$: gcc-trunk -O1 small.c -m32
small.c: In function ‘fn1’:
small.c:3:6: internal compiler error: in zero_one_operation, at
tree-ssa-reassoc.c:1230
 void fn1() { a = a * 8 + -a * b; }
  ^~~
0xd69d79 zero_one_operation
../../gcc-source-trunk/gcc/tree-ssa-reassoc.c:1229
0xd72232 undistribute_ops_list
../../gcc-source-trunk/gcc/tree-ssa-reassoc.c:1583
0xd72f28 reassociate_bb
../../gcc-source-trunk/gcc/tree-ssa-reassoc.c:5199
0xd72a47 reassociate_bb
../../gcc-source-trunk/gcc/tree-ssa-reassoc.c:5325
0xd75653 do_reassoc
../../gcc-source-trunk/gcc/tree-ssa-reassoc.c:5439
0xd75653 execute_reassoc
../../gcc-source-trunk/gcc/tree-ssa-reassoc.c:5526
0xd75653 execute
../../gcc-source-trunk/gcc/tree-ssa-reassoc.c:5565
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$:
$: cat small.c
unsigned a;
int b;
void fn1() { a = a * 8 + -a * b; }

int main() { return 0; }
$:

[Bug tree-optimization/71206] New: ICE on valid code at all optimization levels in both 32-bit and 64-bit modes on x86_64-linux-gnu. (verify_gimple failed)

2016-05-19 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71206

Bug ID: 71206
   Summary: ICE on valid code at all optimization levels in both
32-bit and 64-bit modes on x86_64-linux-gnu.
(verify_gimple failed)
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

The following code crashes the trunk at all optimization levels in both 32-bit
and 64-bit modes on x86_64-linux-gnu. 


$: gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160519 (experimental) [trunk revision 236439] (GCC)
$:
$: gcc-trunk -O0 small.c
small.c: In function ‘fn1’:
small.c:4:6: error: type mismatch in binary expression
 void fn1() { fn1(b ^ (2 || c) ^ ((a || 3) ^ d)); }
  ^~~
unsigned int

unsigned int

int

_3 = b.0_1 ^ d.1_2;
small.c:4:6: internal compiler error: verify_gimple failed
0xbdf79d verify_gimple_in_seq(gimple*)
../../gcc-source-trunk/gcc/tree-cfg.c:4833
0x950c71 gimplify_body(tree_node*, bool)
../../gcc-source-trunk/gcc/gimplify.c:11548
0x9510a6 gimplify_function_tree(tree_node*)
../../gcc-source-trunk/gcc/gimplify.c:11636
0x7b62f7 cgraph_node::analyze()
../../gcc-source-trunk/gcc/cgraphunit.c:625
0x7b951b analyze_functions
../../gcc-source-trunk/gcc/cgraphunit.c:1086
0x7ba09c symbol_table::finalize_compilation_unit()
../../gcc-source-trunk/gcc/cgraphunit.c:2543
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$:
$: cat small.c
char a;
unsigned b;
int c, d;
void fn1() { fn1(b ^ (2 || c) ^ ((a || 3) ^ d)); }

int main() {}

[Bug tree-optimization/71170] [7 Regression] ICE in rewrite_expr_tree, at tree-ssa-reassoc.c:3898

2016-05-18 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71170

Chengnian Sun  changed:

   What|Removed |Added

 CC||chengniansun at gmail dot com

--- Comment #5 from Chengnian Sun  ---
Another test case possibly triggering the same issue.


$: gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160518 (experimental) [trunk revision 236370] (GCC)
$: gcc-trunk -O1 small.c
small.c: In function ‘fn1’:
small.c:4:6: internal compiler error: in rewrite_expr_tree, at
tree-ssa-reassoc.c:3898
 void fn1() {
  ^~~
0xd6709f rewrite_expr_tree
../../gcc-source-trunk/gcc/tree-ssa-reassoc.c:3897
0xd66980 rewrite_expr_tree
../../gcc-source-trunk/gcc/tree-ssa-reassoc.c:3862
0xd709da reassociate_bb
../../gcc-source-trunk/gcc/tree-ssa-reassoc.c:5249
0xd70207 reassociate_bb
../../gcc-source-trunk/gcc/tree-ssa-reassoc.c:5278
0xd72b03 do_reassoc
../../gcc-source-trunk/gcc/tree-ssa-reassoc.c:5392
0xd72b03 execute_reassoc
../../gcc-source-trunk/gcc/tree-ssa-reassoc.c:5479
0xd72b03 execute
../../gcc-source-trunk/gcc/tree-ssa-reassoc.c:5518
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$:
$: cat small.c
unsigned a;
int b;
short c;
void fn1() {
  int d = 8 * a;
  char e = d || e ^ a;
  b = ~e + (d + a - ~a + c);
}

int main() {}
$:

[Bug tree-optimization/71006] [6/7 Regression] ICE: verify_gimple failed (error: type mismatch in conditional expression) w/ -O1 -ftree-loop-vectorize

2016-05-12 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71006

--- Comment #6 from Chengnian Sun  ---
(In reply to Ilya Enkovich from comment #4)
> (In reply to Chengnian Sun from comment #3)
> > Hi, 
> > 
> > Can you help check whether the following test case is a duplicate? Thanks. 
> 
> This is definitely a separate issue.

Thank you. It has been reported at
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71079.

[Bug tree-optimization/71006] [6/7 Regression] ICE: verify_gimple failed (error: type mismatch in conditional expression) w/ -O1 -ftree-loop-vectorize

2016-05-11 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71006

Chengnian Sun  changed:

   What|Removed |Added

 CC||chengniansun at gmail dot com

--- Comment #3 from Chengnian Sun  ---
Hi, 

Can you help check whether the following test case is a duplicate? Thanks. 



$: gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160511 (experimental) [trunk revision 236116] (GCC)
$:
$: gcc-trunk -O1 small.c
small.c: In function ‘fn1_BOUOUtg_1828_f2’:
small.c:2:6: error: type mismatch in binary expression
 void fn1_BOUOUtg_1828_f2() {
  ^~~
int

int

unsigned int

_4 = a.0_1 ^ b.2_6;
small.c:2:6: internal compiler error: verify_gimple failed
0xbfe24f verify_gimple_in_cfg(function*, bool)
../../gcc-source-trunk/gcc/tree-cfg.c:5166
0xaeca62 execute_function_todo
../../gcc-source-trunk/gcc/passes.c:1964
0xaed45b execute_todo
../../gcc-source-trunk/gcc/passes.c:2016
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$:
$: cat small.c
int a, b;
void fn1_BOUOUtg_1828_f2() {
  unsigned c = 8 < 10;
  int d = fn1_BOUOUtg_1828_f2 || 8;
  b = d ^ a ^ c ^ b;
}

int main() { return 0; }
$:

[Bug tree-optimization/70964] [7 Regression] internal compiler error: in single_succ_edge, at basic-block.h:351

2016-05-10 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70964

Chengnian Sun  changed:

   What|Removed |Added

 CC||chengniansun at gmail dot com

--- Comment #4 from Chengnian Sun  ---
(In reply to ktkachov from comment #3)
> Another testcase that started ICEing with r235842.
> 
> int a, b;
> int
> fn1 (int p1)
> {
>   return p1 < 0 ? p1 : a;
> }
> 
> void
> fn2 ()
> {
> lbl_100:
>   b = 1;
>   for (; b != 21; b = fn1 (b))
> ;
>   goto lbl_100;
> }
> 
> with -Ofast with a different backtrace:
> ice.c:9:1: internal compiler error: in combine_blocks, at tree-if-conv.c:2219
>  fn2 ()
>  ^~~
> 0xb49a15 combine_blocks
> $SRC/gcc/tree-if-conv.c:2219
> 0xb4b17b tree_if_conversion
> $SRC/gcc/tree-if-conv.c:2741
> 0xb4b17b execute
> $SRC/gcc/tree-if-conv.c:2829
> Please submit a full bug report,
> with preprocessed source if appropriate.
> Please include the complete backtrace with any bug report.
> See <http://gcc.gnu.org/bugs.html> for instructions.


Hi, 

May I know how did you find this bug-triggering test case? Is it generated by
some program generator or from the torture test suite?

Thank you.

[Bug tree-optimization/70586] New: wrong code at -O2 and -O3 on x86_64-linux-gnu in 32-bit and 64-bit modes

2016-04-07 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70586

Bug ID: 70586
   Summary: wrong code at -O2 and -O3 on x86_64-linux-gnu in
32-bit and 64-bit modes
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

The following code is miscompiled by the trunk at -O2 and -O3 on
x86_64-linux-gnu in 32-bit and 64-bit modes.


This also affects gcc-4.8 and later versions.


$: gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 6.0.0 20160407 (experimental) [trunk revision 234805] (GCC) 
$: 
$: gcc-trunk -w -m32 small.c -O3 ; ./a.out 
Floating point exception (core dumped)
$: gcc-trunk -w -m32 small.c -O2 ; ./a.out 
Floating point exception (core dumped)
$: gcc-trunk -w -m32 small.c -O1 ; ./a.out 
$: gcc-4.8 -w small.c -O3 ; ./a.out
Floating point exception (core dumped)
$: gcc-4.7 -w small.c -O3 ; ./a.out
$: 
$: cat small.c
int a, e, f;
short b, c, d;
int fn1(p1, p2) { return p2 == 0 || p1 && p2 == 1 ? p1 : p1 % p2; }

static short fn2() {
  int g, h, i = fn1(c, f);
  f = fn1(d, 2);
  g = fn1(b, c);
  h = fn1(g > 0, c);
  c = (3 >= h ^ 7) <= fn1(i, c);
  if (fn1(e, 1))
return a;
}

int main() {
  fn2();
  return 0;
}
$:

[Bug rtl-optimization/70396] New: ICE on valid code at -O3 in 32-bit and 64-bit modes on x86_64-linux-gnu (in immed_wide_int_const, at emit-rtl.c:606)

2016-03-24 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70396

Bug ID: 70396
   Summary: ICE on valid code at -O3 in 32-bit and 64-bit modes on
x86_64-linux-gnu (in immed_wide_int_const, at
emit-rtl.c:606)
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: rtl-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

The following code crashes the trunk at -O3 in 32-bit and 64-bit modes on
x86_64-linux-gnu.



$: gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk
Thread model: posix
gcc version 6.0.0 20160324 (experimental) [trunk revision 234448] (GCC) 
$: 
$: gcc-trunk -O3 small.c
small.c:4:5: warning: array ‘a’ assumed to have one element
 int a[];
 ^
small.c: In function ‘fn1’:
small.c:11:14: warning: iteration 2147483645 invokes undefined behavior
[-Waggressive-loop-optimizations]
   for (; c; c++) {
 ~^~
small.c:11:3: note: within this loop
   for (; c; c++) {
   ^~~
small.c:7:6: internal compiler error: in immed_wide_int_const, at
emit-rtl.c:606
 void fn1() {
  ^~~
0x806f7d immed_wide_int_const(generic_wide_int >
const&, machine_mode)
../../gcc-source-trunk/gcc/emit-rtl.c:606
0x82b5ce const_vector_from_tree
../../gcc-source-trunk/gcc/expr.c:11531
0x82b5ce expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
../../gcc-source-trunk/gcc/expr.c:9748
0xa65c6a expand_expr
../../gcc-source-trunk/gcc/expr.h:256
0xa65c6a vector_compare_rtx
../../gcc-source-trunk/gcc/optabs.c:5299
0xa7025d expand_vec_cond_expr(tree_node*, tree_node*, tree_node*, tree_node*,
rtx_def*)
../../gcc-source-trunk/gcc/optabs.c:5629
0x840c35 expand_expr_real_2(separate_ops*, rtx_def*, machine_mode,
expand_modifier)
../../gcc-source-trunk/gcc/expr.c:9358
0x7274a1 expand_gimple_stmt_1
../../gcc-source-trunk/gcc/cfgexpand.c:3654
0x7274a1 expand_gimple_stmt
../../gcc-source-trunk/gcc/cfgexpand.c:3714
0x7296ea expand_gimple_basic_block
../../gcc-source-trunk/gcc/cfgexpand.c:5720
0x72eafe execute
../../gcc-source-trunk/gcc/cfgexpand.c:6335
Please submit a full bug report,
with preprocessed source if appropriate.
gcc version 6.0.0 20160324 (experimental) [trunk revision 234448] (GCC)
$:
$: gcc-trunk -O3 small.c
small.c:4:5: warning: array ‘a’ assumed to have one element
 int a[];
 ^
small.c: In function ‘fn1’:
small.c:11:14: warning: iteration 2147483645 invokes undefined behavior
[-Waggressive-loop-optimizations]  
   for (; c; c++) {
 ~^~
small.c:11:3: note: within this loop
   for (; c; c++) {
   ^~~
small.c:7:6: internal compiler error: in immed_wide_int_const, at
emit-rtl.c:606
 void fn1() {
  ^~~
0x806f7d immed_wide_int_const(generic_wide_int >
const&, machine_mode)
../../gcc-source-trunk/gcc/emit-rtl.c:606
0x82b5ce const_vector_from_tree
../../gcc-source-trunk/gcc/expr.c:11531
0x82b5ce expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
../../gcc-source-trunk/gcc/expr.c:9748
0xa65c6a expand_expr
../../gcc-source-trunk/gcc/expr.h:256
0xa65c6a vector_compare_rtx
../../gcc-source-trunk/gcc/optabs.c:5299
0xa7025d expand_vec_cond_expr(tree_node*, tree_node*, tree_node*, tree_node*,
rtx_def*)
../../gcc-source-trunk/gcc/optabs.c:5629
0x840c35 expand_expr_real_2(separate_ops*, rtx_def*, machine_mode,
expand_modifier)
../../gcc-source-trunk/gcc/expr.c:9358
0x7274a1 expand_gimple_stmt_1
../../gcc-source-trunk/gcc/cfgexpand.c:3654
0x7274a1 expand_gimple_stmt
../../gcc-source-trunk/gcc/cfgexpand.c:3714
0x7296ea expand_gimple_basic_block
../../gcc-source-trunk/gcc/cfgexpand.c:5720
0x72eafe execute
../../gcc-source-trunk/gcc/cfgexpand.c:6335
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$:
$: cat small.c
struct S2 {
  signed f1 : 3;
};
int a[];
int b, c;
char d;
void fn1() {
  struct S2 e;
  b / e.f1;
  c = 2;
  for (; c; c++) {
d = 0;
a[c] = ~e.f1 != d;
  }
}
$:

[Bug target/69773] gcc ICE at -O2 and above on valid code on x86_64-linux-gnu in "assign_by_spills"

2016-03-23 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69773

Chengnian Sun  changed:

   What|Removed |Added

 CC||chengniansun at gmail dot com

--- Comment #4 from Chengnian Sun  ---
(In reply to Uroš Bizjak from comment #3)
> Another issue with hard registers that live accros insn with single-reg
> constraint.
> 
> *** This bug has been marked as a duplicate of bug 70023 ***

Hi, 

This bug was reported nearly 20 days earlier than PR70023. Should that report
be labeled duplicate of this bug report instead?

Thanks.

[Bug c/70302] New: crash on valid code at -O2 and -O3 in 32-bit mode on x86_64-linux-gnu (in convert_op, at config/i386/i386.c:3414)

2016-03-19 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70302

Bug ID: 70302
   Summary: crash on valid code at -O2 and -O3 in 32-bit mode on
x86_64-linux-gnu (in convert_op, at
config/i386/i386.c:3414)
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

The following code crashes the trunk at -O2 and -O3 in 32-bit mode (not 64-bit)
on x86_64-linux-gnu.



$: gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 6.0.0 20160318 (experimental) [trunk revision 234330] (GCC) 
$: 
$: gcc-trunk -c -w -m32 -O2 small.c
small.c: In function ‘fn1’:
small.c:14:1: internal compiler error: in convert_op, at
config/i386/i386.c:3414
 }
 ^
0xe815c0 scalar_chain::convert_op(rtx_def**, rtx_insn*)
../../gcc-source-trunk/gcc/config/i386/i386.c:3414
0xe817ae scalar_chain::convert_insn(rtx_insn*)
../../gcc-source-trunk/gcc/config/i386/i386.c:3445
0xea3c92 scalar_chain::convert()
../../gcc-source-trunk/gcc/config/i386/i386.c:3521
0xea44d5 convert_scalars_to_vector
../../gcc-source-trunk/gcc/config/i386/i386.c:3582
0xea44d5 execute
../../gcc-source-trunk/gcc/config/i386/i386.c:3674
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$: 
$: gcc-trunk -c -w -m32 -O1 small.c
$: 
$: cat small.c
long a, c, e;
int b, d;
unsigned long long f;
void fn1(long long p1) {
  unsigned long long g;
  int i;
  for (; i;)
if (e)
  g = c;
  if (a)
f = p1;
  if (!f && !g)
printf("", b, d, d);
}
$:

[Bug tree-optimization/70263] New: ICE at -O1 and above in both 32-bit and 64-bit modes on x86_64-linux-gnu (segmentation fault)

2016-03-19 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70263

Bug ID: 70263
   Summary: ICE at -O1 and above in both 32-bit and 64-bit modes
on x86_64-linux-gnu (segmentation fault)
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

The following code crashes the trunk of gcc at -O1 and above in both 32-bit and
64-bit modes on x86_64-linux-gnu. 

This bug also affects gcc-4.9 and later versions. 


$: gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 6.0.0 20160316 (experimental) [trunk revision 234258] (GCC) 
$: 
$: gcc-trunk -O1 small.c
small.c: In function ‘fn1’:
small.c:10:1: internal compiler error: Segmentation fault
 }
 ^
0xb520ff crash_signal
../../gcc-source-trunk/gcc/toplev.c:335
0x996b1d memref_used_between_p
../../gcc-source-trunk/gcc/ira.c:3237
0x996b1d update_equiv_regs
../../gcc-source-trunk/gcc/ira.c:3654
0x998293 ira
../../gcc-source-trunk/gcc/ira.c:5219
0x998293 execute
../../gcc-source-trunk/gcc/ira.c:5549
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$: 
$: cat small.c
int a[91];
int b, c;
void fn1() {
  int n, m;
  do {
a[c--];
a[--c] = m;
a[--m] = b;
  } while (n);
}

int main() {}
$:

[Bug c/70309] wrong code at -O2 and -O3 in both 32-bit and 64-bit modes on x86_64-linux-gnu

2016-03-19 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70309

Chengnian Sun  changed:

   What|Removed |Added

 CC||chengniansun at gmail dot com

--- Comment #2 from Chengnian Sun  ---
(In reply to Andrew Pinski from comment #1)
> Does adding -fno-strict-aliasing "fix" the issue?

Oh, yes. So this case is invalid, right?

[Bug c/70309] New: wrong code at -O2 and -O3 in both 32-bit and 64-bit modes on x86_64-linux-gnu

2016-03-19 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70309

Bug ID: 70309
   Summary: wrong code at -O2 and -O3 in both 32-bit and 64-bit
modes on x86_64-linux-gnu
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

The following code is miscompiled by the trunk at -O2 and -O3 in both 32-bit
and 64-bit modes on x86_64-linux-gnu.

This bug also affects gcc-4.8 and later versions. gcc-4.7 is okay.


$: gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 6.0.0 20160319 (experimental) [trunk revision 234350] (GCC) 
$: 
$: gcc-trunk -O2 small.c ; ./a.out ; echo $?
1
$: gcc-trunk -O1 small.c ; ./a.out ; echo $?
0
$: gcc-4.8 -O3 small.c ; ./a.out ; echo $?
1
$: cat small.c
typedef struct {
unsigned b0:1;
unsigned b1:1;
unsigned b2:1;
unsigned b3:1;
unsigned b4:1;
unsigned b5:1;
unsigned b6:1;
unsigned b7:1;
unsigned b8:1;
unsigned b9:1;
unsigned b10:1;
unsigned b11:1;
unsigned b12:1;
unsigned b13:1;
unsigned b14:1;
unsigned b15:1;
} BitField;

BitField BA;
unsigned short *pA = (unsigned short *) &BA;
BitField BB;
unsigned short *pB = (unsigned short *) &BB;

char * fn(void)
{
if (BA.b11) {
if (BB.b11)
return "F";
else
return "S";
} else
return "F";
}

int
main (void)
{
*pA = 0xedcb;
*pB = 0x1234;
return fn ()[0] == 'F';
}

$:

[Bug c/70264] New: ICE at -O0 to -O3 in both 32-bit and 64-bit modes on x86_64-linux-gnu (compatible_locations_p, at diagnostic-show-locus.c:490)

2016-03-19 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70264

Bug ID: 70264
   Summary: ICE at -O0 to -O3 in both 32-bit and 64-bit modes on
x86_64-linux-gnu (compatible_locations_p, at
diagnostic-show-locus.c:490)
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$: gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 6.0.0 20160316 (experimental) [trunk revision 234270] (GCC) 
$: 
$: gcc-trunk small.c
small.c:1:11: error: expected identifier or ‘(’ before numeric constant

small.c:1:11: internal compiler error: in compatible_locations_p, at
diagnostic-show-locus.c:490
small.c:2:1: note: in expansion of macro ‘X’
 X
 ^
0x1317e8d compatible_locations_p
../../gcc-source-trunk/gcc/diagnostic-show-locus.c:490
0x131884a layout
../../gcc-source-trunk/gcc/diagnostic-show-locus.c:609
0x1318cdf diagnostic_show_locus(diagnostic_context*, diagnostic_info const*)
../../gcc-source-trunk/gcc/diagnostic-show-locus.c:1102
0x6b6960 c_diagnostic_finalizer
../../gcc-source-trunk/gcc/c-family/c-opts.c:167
0x1316019 diagnostic_report_diagnostic(diagnostic_context*, diagnostic_info*)
../../gcc-source-trunk/gcc/diagnostic.c:828
0x1316e95 error(char const*, ...)
../../gcc-source-trunk/gcc/diagnostic.c:1154
0x699f7c c_parse_error(char const*, cpp_ttype, tree_node*, unsigned char)
../../gcc-source-trunk/gcc/c-family/c-common.c:10138
0x6421ec c_parser_direct_declarator
../../gcc-source-trunk/gcc/c/c-parser.c:3485
0x6421ec c_parser_declarator
../../gcc-source-trunk/gcc/c/c-parser.c:3369
0x64a6fb c_parser_declaration_or_fndef
../../gcc-source-trunk/gcc/c/c-parser.c:1815
0x654cae c_parser_external_declaration
../../gcc-source-trunk/gcc/c/c-parser.c:1548
0x6557b9 c_parser_translation_unit
../../gcc-source-trunk/gcc/c/c-parser.c:1429
0x6557b9 c_parse_file()
../../gcc-source-trunk/gcc/c/c-parser.c:17840
0x6b9512 c_common_parse_file()
../../gcc-source-trunk/gcc/c-family/c-opts.c:1064
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$: 
$: cat small.c
#define X __LINE__
X
$:

[Bug c/70306] New: wrong code at -O2 and -O3 in 32-bit and 64-bit mode on x86_64-linux-gnu [related to __attribute__((destructor)) and __attribute__((constructor))]

2016-03-19 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70306

Bug ID: 70306
   Summary: wrong code at -O2 and -O3 in 32-bit and 64-bit mode on
x86_64-linux-gnu [related to
__attribute__((destructor)) and
__attribute__((constructor))]
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

The following code is miscompiled by the trunk at -O2 and -O3 in 32-bit and
64-bit modes on x86_64-linux-gnu. 

This bug also affects gcc-5.1. 


$: gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 6.0.0 20160318 (experimental) [trunk revision 234347] (GCC) 
$: 
$: gcc-trunk -O1 small.c ; ./a.out
A
A
B
B
$: gcc-trunk -O2 small.c ; ./a.out
A
B
$: gcc-4.9 -O3 small.c ; ./a.out
A
A
B
B
$: 
$: cat small.c
int printf(const char *, ...);

__attribute__((constructor))
void A() { printf("A\n"); }

__attribute__((destructor))
void B() { printf("B\n"); }

__attribute__((constructor))
static void C() { printf("A\n"); }

__attribute__((destructor))
static void D() { printf("B\n"); }

int main() { return 0; }
$:

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

2016-03-14 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69951

--- Comment #7 from Chengnian Sun  ---
(In reply to Richard Biener from comment #6)
> Seems I typoed the PR reference in the commit:
> 
> Author: rguenth
> Date: Fri Feb 26 08:34:58 2016
> New Revision: 233734
> 
> URL: https://gcc.gnu.org/viewcvs?rev=233734&root=gcc&view=rev
> Log:
> 2016-02-26  Richard Biener  
> 
>   PR tree-optimization/69551
>   * tree-ssa-structalias.c (get_constraint_for_ssa_var): When
>   looking through aliases adjust DECL_PT_UID to refer to the
>   ultimate alias target.
> 
>   * gcc.dg/torture/pr69951.c: New testcase.
> 
> Added:
> trunk/gcc/testsuite/gcc.dg/torture/pr69951.c
> Modified:
> trunk/gcc/ChangeLog
> trunk/gcc/testsuite/ChangeLog
> trunk/gcc/tree-ssa-structalias.c

Thank you so much, Richard.

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

2016-03-13 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69951

Chengnian Sun  changed:

   What|Removed |Added

 CC||chengniansun at gmail dot com

--- Comment #5 from Chengnian Sun  ---
(In reply to Richard Biener from comment #4)
> Fixed for GCC 6.

Hi Richard, 

Is there any way to get the id of the revision that fixed this issue?

Thanks.

[Bug web/70127] New: wrong code on x86_64-linux-gnu at -O3 in 32-bit and 64-bit modes

2016-03-07 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70127

Bug ID: 70127
   Summary: wrong code on x86_64-linux-gnu at -O3 in 32-bit and
64-bit modes
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: web
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

The following code is miscompiled by the trunk, gcc-4.7 and gcc-4.8 at -O3 in
both 32-bit and 64-bit modes on x86_64-linux-gnu. 


$: gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 6.0.0 20160307 (experimental) [trunk revision 234022] (GCC) 
$: 
$: gcc-trunk -O3 small.c ; ./a.out
0
$: gcc-4.7 -O3 small.c ; ./a.out
0
$: gcc-4.8 -O3 small.c ; ./a.out
0
$: gcc-trunk -O0 small.c ; ./a.out
1
$: cat small.c
int printf(const char *, ...);
struct S0 {
int f0;
signed f1 : 2;
} a[1], c = {5, 1}, d;
short b;
int main() {
for (; b <= 0; b++) {
struct S0 e = {1, 1};
d = e = a[0] = c;
}
printf("%d\n", a[0].f1);
return 0;
}
$:

[Bug tree-optimization/69068] [6 Regression] ICE in bb_contains_loop_phi_nodes, at graphite-isl-ast-to-gimple.c:1279

2016-02-29 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69068

Chengnian Sun  changed:

   What|Removed |Added

 CC||chengniansun at gmail dot com

--- Comment #4 from Chengnian Sun  ---
The following test case might be another case of this bug report. 




$: gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 6.0.0 20160229 (experimental) [trunk revision 233802] (GCC) 
$: 
$: gcc-trunk -O2  -fgraphite-identity   small.c
small.c: In function ‘main’:
small.c:3:5: internal compiler error: in bb_contains_loop_phi_nodes, at
graphite-isl-ast-to-gimple.c:1077
 int main() {
 ^~~~
0x122c688 bb_contains_loop_phi_nodes
../../gcc-source-trunk/gcc/graphite-isl-ast-to-gimple.c:1077
0x123355f
translate_isl_ast_to_gimple::copy_bb_and_scalar_dependences(basic_block_def*,
edge_def*, vec)
../../gcc-source-trunk/gcc/graphite-isl-ast-to-gimple.c:2727
0x1233abb
translate_isl_ast_to_gimple::translate_isl_ast_node_user(isl_ast_node*,
edge_def*, std::map,
std::allocator > >&)
../../gcc-source-trunk/gcc/graphite-isl-ast-to-gimple.c:935
0x1234275 translate_isl_ast_to_gimple::translate_isl_ast_node_block(loop*,
isl_ast_node*, edge_def*, std::map,
std::allocator > >&)
../../gcc-source-trunk/gcc/graphite-isl-ast-to-gimple.c:964
0x1233e7f translate_isl_ast_to_gimple::translate_isl_ast_for_loop(loop*,
isl_ast_node*, edge_def*, tree_node*, tree_node*, tree_node*, std::map, std::allocator > >&)
../../gcc-source-trunk/gcc/graphite-isl-ast-to-gimple.c:685
0x12340f6 translate_isl_ast_to_gimple::translate_isl_ast_node_for(loop*,
isl_ast_node*, edge_def*, std::map,
std::allocator > >&)
../../gcc-source-trunk/gcc/graphite-isl-ast-to-gimple.c:854
0x1234275 translate_isl_ast_to_gimple::translate_isl_ast_node_block(loop*,
isl_ast_node*, edge_def*, std::map,
std::allocator > >&)
../../gcc-source-trunk/gcc/graphite-isl-ast-to-gimple.c:964
0x1234bee graphite_regenerate_ast_isl(scop*)
../../gcc-source-trunk/gcc/graphite-isl-ast-to-gimple.c:3183
0x122bdde graphite_transform_loops()
../../gcc-source-trunk/gcc/graphite.c:329
0x122c3a0 graphite_transforms
../../gcc-source-trunk/gcc/graphite.c:356
0x122c3a0 execute
../../gcc-source-trunk/gcc/graphite.c:433
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$: 
$: cat small.c
short a, e;
int b, c, d;
int main() {
  int f = e;
  long g[8];
  for (; d; d++) {
b = 5;
for (; b; b--)
  c |= g[b];
e = f < 2 || 5 >> f ? a : f;
  }
  return 0;
}
$:

[Bug tree-optimization/69989] [6 Regression] ICE on x86_64-linux-gnu at -O3 in both 32-bit and 64-bit modes (in verify_loop_structure, at cfgloop.c:1639)

2016-02-27 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69989

Chengnian Sun  changed:

   What|Removed |Added

 CC||chengniansun at gmail dot com

--- Comment #6 from Chengnian Sun  ---
Another example with a similar stack trace. 

$: gcc-trunk -w -O3 small.c
small.c: In function ‘fn1’:
small.c:5:6: error: loop verification on loop tree that needs fixup
 void fn1() {
  ^~~
small.c:5:6: internal compiler error: in verify_loop_structure, at
cfgloop.c:1639
0x72f9f7 verify_loop_structure()
../../gcc-source-trunk/gcc/cfgloop.c:1639
0xca037f checking_verify_loop_structure
../../gcc-source-trunk/gcc/cfgloop.h:324
0xca037f tree_transform_and_unroll_loop(loop*, unsigned int, edge_def*,
tree_niter_desc*, void (*)(loop*, void*), void*)
../../gcc-source-trunk/gcc/tree-ssa-loop-manip.c:1362
0xc07819 tree_predictive_commoning_loop
../../gcc-source-trunk/gcc/tree-predcom.c:2530
0xc07819 tree_predictive_commoning()
../../gcc-source-trunk/gcc/tree-predcom.c:2565
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$: 
$: cat small.c
int a, b, d;
short c[] = {4073709551611, 1, 4, 4}

;
void fn1() {
  if (a)
goto LABEL_vhvhP;
  for (;;) {
for (; b; b++)
  d = c[b + 3] | c[b];
  LABEL_vhvhP:
if (d)
  break;
  }
}

int main() { return 0; }

[Bug tree-optimization/69989] New: ICE on x86_64-linux-gnu at -O3 in both 32-bit and 64-bit modes (in verify_loop_structure, at cfgloop.c:1639)

2016-02-27 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69989

Bug ID: 69989
   Summary: ICE on x86_64-linux-gnu at -O3 in both 32-bit and
64-bit modes (in verify_loop_structure, at
cfgloop.c:1639)
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

The following code crashes the trunk on x86_64-linux-gnu at -O3 in both 32-bit
and 64-bit modes. 

$: gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 6.0.0 20160227 (experimental) [trunk revision 233778] (GCC) 
$: 
$: gcc-trunk -O3 small.c
small.c: In function ‘fn1’:
small.c:3:6: error: loop verification on loop tree that needs fixup
 void fn1() {
  ^~~
small.c:3:6: internal compiler error: in verify_loop_structure, at
cfgloop.c:1639
0x72f9f7 verify_loop_structure()
../../gcc-source-trunk/gcc/cfgloop.c:1639
0xbd54d5 checking_verify_loop_structure
../../gcc-source-trunk/gcc/cfgloop.h:324
0xbd54d5 execute
../../gcc-source-trunk/gcc/tree-loop-distribution.c:1818
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$: 
$: cat small.c
int a, b, d;
char c[0];
void fn1() {
  for (;;) {
if (b)
LABEL_T5T5T:
for (; d; d++)
  c[d] = 6;
break;
  }
  a = 1;
  goto LABEL_T5T5T;
}

int main() {}
$:

[Bug c/69936] New: ICE on x86_64-linux-gnu at -Os and above in both 32-bit and 64-bit modes (internal compiler error: cannot update SSA form)

2016-02-24 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69936

Bug ID: 69936
   Summary: ICE on x86_64-linux-gnu at -Os and above in both
32-bit and 64-bit modes (internal compiler error:
cannot update SSA form)
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

The following code crashes the trunk at -Os and above in both 32-bit and 64-bit
modes on x86_64-linux-gnu. 

$: gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --prefix=/usr/local/gcc-trunk
--enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
gcc version 6.0.0 20160223 (experimental) [trunk revision 233632] (GCC) 
$:
$: gcc-trunk -O3 small.c
small.c: In function ‘fn3’:
small.c:22:1: error: statement uses released SSA name:
 int main() { return 0; }
 ^~~
d_17 = (int) _16;
The use of _16 should have been replaced
small.c:22:1: internal compiler error: cannot update SSA form
0xbb0995 update_ssa(unsigned int)
../../gcc-trunk/gcc/tree-into-ssa.c:3195
0xa59713 execute_function_todo
../../gcc-trunk/gcc/passes.c:1926
0xa5a03b execute_todo
../../gcc-trunk/gcc/passes.c:2010
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$: 
$: 
$: cat small.c
int a;
char b;
void fn1(int p1) {}

int fn2() { return 5; }

void fn3() {
  if (fn2())
;
  else {
char c[5];
c[0] = 5;
  lbl_608:
fn1(c[9]);
int d = c[9];
c[2] | a;
d = c[b];
  }
  goto lbl_608;
}

int main() { return 0; }
$:

[Bug c/69771] New: ICE on x86_64-linux-gnu at -O0 (in extract_insn, at recog.c:2287)

2016-02-11 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69771

Bug ID: 69771
   Summary: ICE on x86_64-linux-gnu at -O0 (in extract_insn, at
recog.c:2287)
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

The following code crashes the gcc trunk in both 32-bit and 64-bit modes at -O0
on x86_64-linux-gnu. 

$: gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap : (reconfigured)
../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap : (reconfigured)
../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap : (reconfigured)
../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 6.0.0 20160211 (experimental) [trunk revision 233350] (GCC) 
$: 
$: gcc-trunk small.c 
small.c: In function ¡®fn1¡¯:
small.c:4:20: warning: right shift count is negative [-Wshift-count-negative]
 void fn1() { c = d >> ~(a || ~b); }
  ~~^
small.c:4:1: error: unrecognizable insn:
 void fn1() { c = d >> ~(a || ~b); }
 ^~~~
(insn 7 6 8 2 (set (reg:QI 91)
(const_int 254 [0xfe])) small.c:4 -1
 (nil))
small.c:4:1: internal compiler error: in extract_insn, at recog.c:2287
0xad889a _fatal_insn(char const*, rtx_def const*, char const*, int, char
const*)
../../gcc-source-trunk/gcc/rtl-error.c:108
0xad88c9 _fatal_insn_not_found(rtx_def const*, char const*, int, char const*)
../../gcc-source-trunk/gcc/rtl-error.c:116
0xaa5ce7 extract_insn(rtx_insn*)
../../gcc-source-trunk/gcc/recog.c:2287
0x883932 instantiate_virtual_regs_in_insn
../../gcc-source-trunk/gcc/function.c:1582
0x883932 instantiate_virtual_regs
../../gcc-source-trunk/gcc/function.c:1950
0x883932 execute
../../gcc-source-trunk/gcc/function.c:1999
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$: 
$: cat small.c
char a, c;
unsigned short b;
unsigned d;
void fn1() { c = d >> ~(a || ~b); }

int main() {}
$:

[Bug rtl-optimization/69764] New: ICE on x86_64-linux-gnu at -O0 (in decompose, at rtl.h:2107)

2016-02-11 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69764

Bug ID: 69764
   Summary: ICE on x86_64-linux-gnu at -O0 (in decompose, at
rtl.h:2107)
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: rtl-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

The following code crashes the trunk in both 32-bit and 64-bit modes. gcc-5.1
is fine with the code. 


$: gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap : (reconfigured)
../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap : (reconfigured)
../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 6.0.0 20160211 (experimental) [trunk revision 233315] (GCC) 
$: gcc-trunk -w small.c
small.c: In function ‘fn1’:
small.c:1:29: internal compiler error: in decompose, at rtl.h:2107
 void fn1() { unsigned short a = a >> ~8; }
 ^
0x8274ea wi::int_traits >::decompose(long*,
unsigned int, std::pair const&)
../../gcc-source-trunk/gcc/rtl.h:2105
0x8274ea wide_int_ref_storage >
../../gcc-source-trunk/gcc/wide-int.h:936
0x8274ea generic_wide_int >
../../gcc-source-trunk/gcc/wide-int.h:714
0x8274ea convert_modes(machine_mode, machine_mode, rtx_def*, int)
../../gcc-source-trunk/gcc/expr.c:697
0xa5897c expand_binop_directly
../../gcc-source-trunk/gcc/optabs.c:1026
0xa56785 expand_binop(machine_mode, optab_tag, rtx_def*, rtx_def*, rtx_def*,
int, optab_methods)
../../gcc-source-trunk/gcc/optabs.c:1133
0x80c9e4 expand_shift_1
../../gcc-source-trunk/gcc/expmed.c:2458
0x834473 expand_expr_real_2(separate_ops*, rtx_def*, machine_mode,
expand_modifier)
../../gcc-source-trunk/gcc/expr.c:9029
0x71e741 expand_gimple_stmt_1
../../gcc-source-trunk/gcc/cfgexpand.c:3642
0x71e741 expand_gimple_stmt
../../gcc-source-trunk/gcc/cfgexpand.c:3702
0x72098a expand_gimple_basic_block
../../gcc-source-trunk/gcc/cfgexpand.c:5708
0x726056 execute
../../gcc-source-trunk/gcc/cfgexpand.c:6323
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$: cat small.c
void fn1() { unsigned short a = a >> ~8; }

[Bug c/69661] New: missing -Wsequence-point warning

2016-02-03 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69661

Bug ID: 69661
   Summary: missing -Wsequence-point warning
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

The following code has a sequence point violation, but gcc does not emit a
warning. 


$: cat small.c
int a, b;
short c;
void fn1(int p) {}

void fn2() { fn1(a == (c &= a = b)); }
$: 
$: gcc-5.1 -Wsequence-point -c small.c
$: 
$: clang-3.9 -Wunsequenced -c small.c
small.c:5:31: warning: unsequenced modification and access to 'a'
[-Wunsequenced]
void fn2() { fn1(a == (c &= a = b)); }
 ~^
1 warning generated.
$: 
$:

[Bug tree-optimization/69342] New: wrong code at -O1, -O2, -O3 (NOT -Os) on x86-64-linux-gnu (in 32- and 64-bit modes)

2016-01-17 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69342

Bug ID: 69342
   Summary: wrong code at -O1, -O2, -O3 (NOT -Os) on
x86-64-linux-gnu (in 32- and 64-bit modes)
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

The following code is miscompiled by gcc trunk at -O1, -O2, -O3 (but not -Os)
in 32-bit and 64-bit modes. 

$: gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --prefix=/usr/local/gcc-trunk
--enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
gcc version 6.0.0 20160117 (experimental) [trunk revision 232481] (GCC) 
$: 
$: gcc-trunk small.c -O1 ; ./a.out
1
$: gcc-trunk small.c -O2 ; ./a.out
1
$: gcc-trunk small.c -O3 ; ./a.out
1
$: gcc-trunk small.c -O1 -m32 ; ./a.out
1
$: gcc-trunk small.c -O2 -m32 ; ./a.out
1
$: gcc-trunk small.c -O3 -m32 ; ./a.out
1
$: gcc-trunk small.c -Os -m32 ; ./a.out
4
$: gcc-trunk small.c -Os -m64 ; ./a.out
4
$: gcc-trunk small.c -O0 ; ./a.out
4
$: 
$: cat small.c
int printf(const char*, ...);
static int a[40] = {7, 5, 3, 3, 0, 0, 3};
short b;
int c = 5;
int main() {
  b = 0;
  for (; b <= 3; b++)
if (a[b + 6] ^ (0 || c))
  ;
else
  break;
  printf("%d\n", b);
  return 0;
}
$:

[Bug tree-optimization/69325] New: wrong code at -O3 on x86-64-linux-gnu (in 32- and 64-bit modes)

2016-01-16 Thread chengniansun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69325

Bug ID: 69325
   Summary: wrong code at -O3 on x86-64-linux-gnu (in 32- and
64-bit modes)
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com
  Target Milestone: ---

The following code is miscompiled by the gcc trunk at -O2 and -O3 in both
32-bit and 64-bit modes. 

$: gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --prefix=/usr/local/gcc-trunk
--enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
gcc version 6.0.0 20160116 (experimental) [trunk revision 232466] (GCC) 
$: 
$: gcc-trunk small.c -O3 -m32 ; ./a.out
$: gcc-trunk small.c -O3 -m64 ; ./a.out
$: gcc-trunk small.c -O2 -m32 ; ./a.out
$: gcc-trunk small.c -O2 -m64 ; ./a.out
$: gcc-trunk small.c -O0 -m64 ; ./a.out
g_302=4
$: cat small.c
int printf(const char*, ...);
int a, b, d, f;
char c;
static int *e = &d;
int main() {
  int g = -1L;
  *e = g;
  c = 4;
  for (; c >= 14; c++)
*e = 1;
  f = a == 0;
  *e ^= f;
  int h = ~d;
  if (d)
b = h;
  if (h)
printf("g_302=%llu\n", (unsigned long long)c);
  return 0;
}
$:

  1   2   3   >