[Bug tree-optimization/77901] ICE in tree-sse-reassoc,c:2881

2016-10-08 Thread bernd.edlinger at hotmail dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77901

--- Comment #1 from Bernd Edlinger  ---
this seems to fix it:

Index: gcc/tree-ssa-reassoc.c
===
--- gcc/tree-ssa-reassoc.c  (revision 240867)
+++ gcc/tree-ssa-reassoc.c  (working copy)
@@ -2876,7 +2876,7 @@
   gimple *stmt;
   tree_code ccode;
   tree rhs1, rhs2;
-  if (ranges[i].exp)
+  if (ranges[i].exp && TREE_CODE (ranges[i].exp) == SSA_NAME)
{
  stmt = SSA_NAME_DEF_STMT (ranges[i].exp);
  if (!is_gimple_assign (stmt))

[Bug tree-optimization/77901] ICE in tree-sse-reassoc,c:2881

2016-10-08 Thread bernd.edlinger at hotmail dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77901

--- Comment #2 from Bernd Edlinger  ---
reproducer:

cat min.c
union internal_auxent
{
 struct {
  union {
   long l;
  } x_tagndx;
 } x_sym;
};
struct coff_symbol
{
 int c_sclass;
};
int complaint ();
int decode_type (struct coff_symbol * cs, union internal_auxent * aux)
{
if (aux->x_sym.x_tagndx.l)
 if (cs->c_sclass != 10 && cs->c_sclass != 12 && aux->x_sym.x_tagndx.l >= 0)
   complaint ();
}

[Bug tree-optimization/77901] ICE in tree-sse-reassoc,c:2881

2016-10-08 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77901

Jakub Jelinek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2016-10-08
   Assignee|unassigned at gcc dot gnu.org  |jakub at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #3 from Jakub Jelinek  ---
Created attachment 39775
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=39775&action=edit
gcc7-pr77901.patch

Thanks for the report, but the #c1 patch is incorrect, we don't want to handle
.exp non-NULL other than SSA_NAME as if it is a GIMPLE_COND comparison at the
end of bb, we just want to ignore that instead.

[Bug tree-optimization/77901] ICE in tree-sse-reassoc,c:2881

2016-10-08 Thread bernd.edlinger at hotmail dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77901

--- Comment #4 from Bernd Edlinger  ---
ok, thanks.

[Bug tree-optimization/77901] ICE in tree-sse-reassoc,c:2881

2016-10-09 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77901

--- Comment #5 from Jakub Jelinek  ---
Author: jakub
Date: Sun Oct  9 11:18:53 2016
New Revision: 240899

URL: https://gcc.gnu.org/viewcvs?rev=240899&root=gcc&view=rev
Log:
PR tree-optimization/77901
* tree-ssa-reassoc.c (optimize_range_tests_var_bound): Only optimize
if ranges[i].exp is SSA_NAME when looking for >= and only when
ranges[i].exp is NULL or SSA_NAME when looking for the other
comparison.

* gcc.c-torture/compile/pr77901.c: New test.

Added:
trunk/gcc/testsuite/gcc.c-torture/compile/pr77901.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-ssa-reassoc.c

[Bug tree-optimization/77901] ICE in tree-sse-reassoc,c:2881

2016-10-10 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77901

Jakub Jelinek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #6 from Jakub Jelinek  ---
Fixed.