[Bug tree-optimization/77677] [7 Regression] 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-29 Thread jamborm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77677

Martin Jambor  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #13 from Martin Jambor  ---
So if I understand this correctly, this bug is fixed, right?

[Bug tree-optimization/77677] [7 Regression] 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-27 Thread pthaugen at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77677

--- Comment #12 from Pat Haugen  ---
(In reply to kugan from comment #11)
> 2016-09-27  Kugan Vivekanandarajah  
> 
>   PR ipa/77677
>   * ipa-prop.c (ipa_compute_jump_functions_for_edge): Use
>   extract_range_from_unary_expr to convert value_range.
>   * tree-vrp.c (extract_range_from_unary_expr_1): Rename to.
>   (extract_range_from_unary_expr): This.
>   * tree-vrp.h (extract_range_from_unary_expr): Declare.

176.gcc is working on powerpc now, thanks.

[Bug tree-optimization/77677] [7 Regression] 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-26 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77677

--- Comment #11 from kugan at gcc dot gnu.org ---
Author: kugan
Date: Tue Sep 27 03:41:14 2016
New Revision: 240517

URL: https://gcc.gnu.org/viewcvs?rev=240517&root=gcc&view=rev
Log:
Fix ipa-vrp convert value_range

gcc/ChangeLog:

2016-09-27  Kugan Vivekanandarajah  

PR ipa/77677
* ipa-prop.c (ipa_compute_jump_functions_for_edge): Use
extract_range_from_unary_expr to convert value_range.
* tree-vrp.c (extract_range_from_unary_expr_1): Rename to.
(extract_range_from_unary_expr): This.
* tree-vrp.h (extract_range_from_unary_expr): Declare.

gcc/testsuite/ChangeLog:

2016-09-27  Kugan Vivekanandarajah  

PR ipa/77677
* gcc.dg/torture/pr77677-2.c: New test.


Added:
trunk/gcc/testsuite/gcc.dg/torture/pr77677-2.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/ipa-prop.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-vrp.c
trunk/gcc/tree-vrp.h

[Bug tree-optimization/77677] [7 Regression] 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-23 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77677

--- Comment #10 from kugan at gcc dot gnu.org ---
(In reply to Pat Haugen from comment #9)
> (In reply to kugan from comment #8)
> > Author: kugan
> > Date: Fri Sep 23 10:25:09 2016
> > New Revision: 240420
> > 
> > URL: https://gcc.gnu.org/viewcvs?rev=240420&root=gcc&view=rev
> > Log:
> > Drop TREE_OVERFLOW
> > 
> > gcc/ChangeLog:
> > 
> > 2016-09-23  Kugan Vivekanandarajah  
> > 
> > PR ipa/77677
> > * ipa-cp.c (propagate_vr_accross_jump_function): Drop TREE_OVERFLOW
> > from constant while creating value range.
> 
> 
> Unfortunately this does not fix the problem building 176.gcc on powerpc.
> Following is reduced testcase. Failure occurs with 'gcc -O2'.
> 
> enum machine_mode { MAX_MACHINE_MODE };
> struct {
>   int mode : 8
> } a;
> b;
> static fn1();
> fn2() { fn1(a, a.mode); }
> 
> fn1(x, mode) enum machine_mode mode;
> { int c = b = c; }

Sorry for the breakage. Posted a patch at
https://gcc.gnu.org/ml/gcc-patches/2016-09/msg01746.html for this.

[Bug tree-optimization/77677] [7 Regression] 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-23 Thread pthaugen at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77677

--- Comment #9 from Pat Haugen  ---
(In reply to kugan from comment #8)
> Author: kugan
> Date: Fri Sep 23 10:25:09 2016
> New Revision: 240420
> 
> URL: https://gcc.gnu.org/viewcvs?rev=240420&root=gcc&view=rev
> Log:
> Drop TREE_OVERFLOW
> 
> gcc/ChangeLog:
> 
> 2016-09-23  Kugan Vivekanandarajah  
> 
>   PR ipa/77677
>   * ipa-cp.c (propagate_vr_accross_jump_function): Drop TREE_OVERFLOW
>   from constant while creating value range.


Unfortunately this does not fix the problem building 176.gcc on powerpc.
Following is reduced testcase. Failure occurs with 'gcc -O2'.

enum machine_mode { MAX_MACHINE_MODE };
struct {
  int mode : 8
} a;
b;
static fn1();
fn2() { fn1(a, a.mode); }

fn1(x, mode) enum machine_mode mode;
{ int c = b = c; }

[Bug tree-optimization/77677] [7 Regression] 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-23 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77677

--- Comment #8 from kugan at gcc dot gnu.org ---
Author: kugan
Date: Fri Sep 23 10:25:09 2016
New Revision: 240420

URL: https://gcc.gnu.org/viewcvs?rev=240420&root=gcc&view=rev
Log:
Drop TREE_OVERFLOW

gcc/ChangeLog:

2016-09-23  Kugan Vivekanandarajah  

PR ipa/77677
* ipa-cp.c (propagate_vr_accross_jump_function): Drop TREE_OVERFLOW
from constant while creating value range.

gcc/testsuite/ChangeLog:

2016-09-23  Kugan Vivekanandarajah  

PR ipa/77677
* gcc.dg/torture/pr77677.c: New test.



Added:
trunk/gcc/testsuite/gcc.dg/torture/pr77677.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/ipa-cp.c
trunk/gcc/testsuite/ChangeLog

[Bug tree-optimization/77677] [7 Regression] 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-22 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77677

--- Comment #7 from kugan at gcc dot gnu.org ---
(In reply to Bill Seurer from comment #6)
> The test case 176.gcc in the spec2000 benchmarks still fails apparently with
> the same error even after 240352
> 
> (this is with 240383)
> 
> loop.c: At top level:
> loop.c:6648:1: internal compiler error: in set_value_range, at tree-vrp.c:367
>  }
>  ^
> 0x10bf4f6f set_value_range
>   /home/seurer/gcc/gcc-test/gcc/tree-vrp.c:367
> 0x10bf9067 vrp_meet_1
>   /home/seurer/gcc/gcc-test/gcc/tree-vrp.c:8639
> 0x10bf9067 vrp_meet(value_range*, value_range const*)
>   /home/seurer/gcc/gcc-test/gcc/tree-vrp.c:8716
> 0x110a14c3 ipcp_vr_lattice::meet_with_1(value_range const*)
>   /home/seurer/gcc/gcc-test/gcc/ipa-cp.c:987
> 0x110a4c9f ipcp_vr_lattice::meet_with(value_range const*)
>   /home/seurer/gcc/gcc-test/gcc/ipa-cp.c:969
> 0x110a4c9f propagate_vr_accross_jump_function
>   /home/seurer/gcc/gcc-test/gcc/ipa-cp.c:2077
> 0x110a4c9f propagate_constants_accross_call
>   /home/seurer/gcc/gcc-test/gcc/ipa-cp.c:2435
> 0x110abdc7 propagate_constants_topo
>   /home/seurer/gcc/gcc-test/gcc/ipa-cp.c:3329
> 0x110abdc7 ipcp_propagate_stage
>   /home/seurer/gcc/gcc-test/gcc/ipa-cp.c:3439
> 0x110acf13 ipcp_driver
>   /home/seurer/gcc/gcc-test/gcc/ipa-cp.c:5246
> 0x110acf13 execute
>   /home/seurer/gcc/gcc-test/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  for instructions.
> specmake: *** [loop.o] Error 1
> specmake: *** Waiting for unfinished jobs
> specmake -j20 options 2> options.err | tee options.out
> COMP: /home/seurer/gcc/install/gcc-test/bin/gcc -c -o options.o 
> -fno-strict-aliasing -m32 -DHOST_WORDS_BIG_ENDIAN -DSPEC_CPU2000_LINUX_PPC32
> -O3 -mcpu=power7 -fpeel-loops -funroll-loops -ffast-math -fvect-cost-model
> -mpopcntd -mrecip=rsqrt  
> LINK: /home/seurer/gcc/install/gcc-test/bin/gcc -m32 -Wl,-q
> -Wl,-rpath=/home/seurer/gcc/install/gcc-test/lib  -O3 -mcpu=power7
> -fpeel-loops -funroll-loops -ffast-math -fvect-cost-model -mpopcntd
> -mrecip=rsqrt  -lm  -o options
>   Some files did not appear to be built: cc1
> *** Error building 176.gcc

Sorry about the breakage. As Richard pointed out, it could come from other
places too. I have posted a patch at
https://gcc.gnu.org/ml/gcc-patches/2016-09/msg01629.html. I haven’t tested the
patch with spec2000 yet.

[Bug tree-optimization/77677] [7 Regression] 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-22 Thread seurer at linux dot vnet.ibm.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77677

Bill Seurer  changed:

   What|Removed |Added

 CC||seurer at linux dot 
vnet.ibm.com

--- Comment #6 from Bill Seurer  ---
The test case 176.gcc in the spec2000 benchmarks still fails apparently with
the same error even after 240352

(this is with 240383)

loop.c: At top level:
loop.c:6648:1: internal compiler error: in set_value_range, at tree-vrp.c:367
 }
 ^
0x10bf4f6f set_value_range
/home/seurer/gcc/gcc-test/gcc/tree-vrp.c:367
0x10bf9067 vrp_meet_1
/home/seurer/gcc/gcc-test/gcc/tree-vrp.c:8639
0x10bf9067 vrp_meet(value_range*, value_range const*)
/home/seurer/gcc/gcc-test/gcc/tree-vrp.c:8716
0x110a14c3 ipcp_vr_lattice::meet_with_1(value_range const*)
/home/seurer/gcc/gcc-test/gcc/ipa-cp.c:987
0x110a4c9f ipcp_vr_lattice::meet_with(value_range const*)
/home/seurer/gcc/gcc-test/gcc/ipa-cp.c:969
0x110a4c9f propagate_vr_accross_jump_function
/home/seurer/gcc/gcc-test/gcc/ipa-cp.c:2077
0x110a4c9f propagate_constants_accross_call
/home/seurer/gcc/gcc-test/gcc/ipa-cp.c:2435
0x110abdc7 propagate_constants_topo
/home/seurer/gcc/gcc-test/gcc/ipa-cp.c:3329
0x110abdc7 ipcp_propagate_stage
/home/seurer/gcc/gcc-test/gcc/ipa-cp.c:3439
0x110acf13 ipcp_driver
/home/seurer/gcc/gcc-test/gcc/ipa-cp.c:5246
0x110acf13 execute
/home/seurer/gcc/gcc-test/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  for instructions.
specmake: *** [loop.o] Error 1
specmake: *** Waiting for unfinished jobs
specmake -j20 options 2> options.err | tee options.out
COMP: /home/seurer/gcc/install/gcc-test/bin/gcc -c -o options.o 
-fno-strict-aliasing -m32 -DHOST_WORDS_BIG_ENDIAN -DSPEC_CPU2000_LINUX_PPC32   
-O3 -mcpu=power7 -fpeel-loops -funroll-loops -ffast-math -fvect-cost-model
-mpopcntd -mrecip=rsqrt  
LINK: /home/seurer/gcc/install/gcc-test/bin/gcc -m32 -Wl,-q
-Wl,-rpath=/home/seurer/gcc/install/gcc-test/lib  -O3 -mcpu=power7 -fpeel-loops
-funroll-loops -ffast-math -fvect-cost-model -mpopcntd -mrecip=rsqrt  -lm 
-o options
  Some files did not appear to be built: cc1
*** Error building 176.gcc

[Bug tree-optimization/77677] [7 Regression] 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-22 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77677

--- Comment #5 from Richard Biener  ---
Somewhat mitigated but it is bound to happen again (the IL is not TREE_OVERFLOW
clean) -> fix IPA propagation.

[Bug tree-optimization/77677] [7 Regression] 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-22 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77677

--- Comment #4 from Richard Biener  ---
Author: rguenth
Date: Thu Sep 22 12:16:12 2016
New Revision: 240352

URL: https://gcc.gnu.org/viewcvs?rev=240352&root=gcc&view=rev
Log:
2016-09-22  Richard Biener  

PR middle-end/77677
* gimple-match-head.c (gimple_resimplify1): Drop TREE_OVERFLOW
from constant folding results.
(gimple_resimplify2): Likewise.
(gimple_resimplify3): Likewise.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/gimple-match-head.c

[Bug tree-optimization/77677] [7 Regression] 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-22 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77677

--- Comment #3 from Richard Biener  ---
#4  0x0189c86e in ipcp_vr_lattice::meet_with_1 (this=0x280a780, 
other_vr=0x769a3e88) at /space/rguenther/src/svn/trunk/gcc/ipa-cp.c:987
987   vrp_meet (&m_vr, other_vr);
(gdb) l
982 return false;
983
984   if (other_vr->type == VR_VARYING)
985 return set_to_bottom ();
986
987   vrp_meet (&m_vr, other_vr);
988   if (type != m_vr.type
989   || min != m_vr.min
990   || max != m_vr.max)
991 return true;
(gdb) p debug_value_range(other_vr)
[-25536(OVF), -25536(OVF)]

those overflow bits are bogus.  Ultimatively comes from the jump function VR:

  else if (jfunc->type == IPA_JF_CONST)
{
  tree val = ipa_get_jf_constant (jfunc);
  if (TREE_CODE (val) == INTEGER_CST)
{
  jfunc->vr_known = true;
  jfunc->m_vr.type = VR_RANGE;
  jfunc->m_vr.min = val;
  jfunc->m_vr.max = val;
  return dest_lat->meet_with (&jfunc->m_vr);

and basically means that IPA_JF_CONST should be stripping overflow flags.

The overflow flag is ultimatively introduced at FRE1:

main ()
{
  int c$0;
  int c[1];

  :
  fn1 (-25536(OVF));

Setting value number of _1 to 4 (changed)
Value numbering _2 stmt = _2 = (short int) _1;
Match-and-simplified (short int) _1 to -25536(OVF)
RHS (short int) _1 simplified to -25536(OVF)


I have a patch to fix this particular source of overflow flags but given the
assert VRP routine users should make sure to strip overflow themselves.


Index: gcc/gimple-match-head.c
===
--- gcc/gimple-match-head.c (revision 240342)
+++ gcc/gimple-match-head.c (working copy)
@@ -89,6 +89,8 @@ gimple_resimplify1 (gimple_seq *seq,
   if (tem != NULL_TREE
  && CONSTANT_CLASS_P (tem))
{
+ if (TREE_OVERFLOW_P (tem))
+   tem = drop_tree_overflow (tem);
  res_ops[0] = tem;
  res_ops[1] = NULL_TREE;
  res_ops[2] = NULL_TREE;
@@ -134,6 +136,8 @@ gimple_resimplify2 (gimple_seq *seq,
   if (tem != NULL_TREE
  && CONSTANT_CLASS_P (tem))
{
+ if (TREE_OVERFLOW_P (tem))
+   tem = drop_tree_overflow (tem);
  res_ops[0] = tem;
  res_ops[1] = NULL_TREE;
  res_ops[2] = NULL_TREE;
@@ -194,6 +198,8 @@ gimple_resimplify3 (gimple_seq *seq,
   if (tem != NULL_TREE
  && CONSTANT_CLASS_P (tem))
{
+ if (TREE_OVERFLOW_P (tem))
+   tem = drop_tree_overflow (tem);
  res_ops[0] = tem;
  res_ops[1] = NULL_TREE;
  res_ops[2] = NULL_TREE;

[Bug tree-optimization/77677] [7 Regression] 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 su at cs dot ucdavis.edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77677

Zhendong Su  changed:

   What|Removed |Added

 CC||su at cs dot ucdavis.edu

--- Comment #2 from Zhendong Su  ---
Here is another test that triggers the same 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 20160921 (experimental) [trunk revision 240310] (GCC)
$
$ gcc-trunk -Os small.c
small.c:15:1: internal compiler error: in set_value_range, at tree-vrp.c:361
 }
 ^
0xe70f86 set_value_range
../../gcc-source-trunk/gcc/tree-vrp.c:360
0xe738f7 vrp_meet_1
../../gcc-source-trunk/gcc/tree-vrp.c:8639
0xe738f7 vrp_meet(value_range*, value_range const*)
../../gcc-source-trunk/gcc/tree-vrp.c:8716
0x13001e5 ipcp_vr_lattice::meet_with_1(value_range const*)
../../gcc-source-trunk/gcc/ipa-cp.c:987
0x1305e54 ipcp_vr_lattice::meet_with(value_range const*)
../../gcc-source-trunk/gcc/ipa-cp.c:969
0x1305e54 propagate_vr_accross_jump_function
../../gcc-source-trunk/gcc/ipa-cp.c:2072
0x1305e54 propagate_constants_accross_call
../../gcc-source-trunk/gcc/ipa-cp.c:2435
0x1307990 propagate_constants_topo
../../gcc-source-trunk/gcc/ipa-cp.c:3329
0x1307990 ipcp_propagate_stage
../../gcc-source-trunk/gcc/ipa-cp.c:3439
0x1309f03 ipcp_driver
../../gcc-source-trunk/gcc/ipa-cp.c:5246
0x1309f03 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  for instructions.
$
$ cat small.c
int a, b;

static void fn1 (short p1)
{ 
  a = -p1;
  if (a || b)
__builtin_printf ("%d\n", b);
}

int main ()
{ 
  int c[] = { 4 };
  fn1 (c[0]);
  return 0;
}
$

[Bug tree-optimization/77677] [7 Regression] 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 mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77677

Marek Polacek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-09-21
 CC||mpolacek at gcc dot gnu.org
   Target Milestone|--- |7.0
Summary|ICE at -O1 and above in |[7 Regression] ICE at -O1
   |both 32-bit and 64-bit  |and above in both 32-bit
   |modes on x86_64-linux-gnu   |and 64-bit modes on
   |(internal compiler error:   |x86_64-linux-gnu (internal
   |in set_value_range, at  |compiler error: in
   |tree-vrp.c:361) |set_value_range, at
   ||tree-vrp.c:361)
 Ever confirmed|0   |1

--- Comment #1 from Marek Polacek  ---
Confirmed.