[Bug tree-optimization/84740] [8 Regression] ICE in build_constructors, at tree-switch-conversion.c:965

2018-03-07 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84740

Jakub Jelinek  changed:

   What|Removed |Added

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

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

[Bug tree-optimization/84740] [8 Regression] ICE in build_constructors, at tree-switch-conversion.c:965

2018-03-07 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84740

--- Comment #5 from Jakub Jelinek  ---
Author: jakub
Date: Thu Mar  8 07:29:42 2018
New Revision: 258354

URL: https://gcc.gnu.org/viewcvs?rev=258354=gcc=rev
Log:
PR tree-optimization/84740
* tree-switch-conversion.c (process_switch): Call build_constructors
only if info.phi_count is non-zero.

* gcc.dg/torture/pr84740.c: New test.

Added:
trunk/gcc/testsuite/gcc.dg/torture/pr84740.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-switch-conversion.c

[Bug tree-optimization/84740] [8 Regression] ICE in build_constructors, at tree-switch-conversion.c:965

2018-03-07 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84740

--- Comment #4 from Jakub Jelinek  ---
Created attachment 43583
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43583=edit
gcc8-pr84740.patch

Full untested patch.

[Bug tree-optimization/84740] [8 Regression] ICE in build_constructors, at tree-switch-conversion.c:965

2018-03-07 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84740

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org
   Assignee|marxin at gcc dot gnu.org  |jakub at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek  ---
Untested fix:
--- gcc/tree-switch-conversion.c.jj 2018-01-09 08:58:15.0 +0100
+++ gcc/tree-switch-conversion.c2018-03-07 12:03:42.228246408 +0100
@@ -1563,7 +1563,8 @@ process_switch (gswitch *swtch)
   gather_default_values (info.default_case_nonstandard
 ? gimple_switch_label (swtch, 1)
 : gimple_switch_default_label (swtch), );
-  build_constructors (swtch, );
+  if (info.phi_count)
+build_constructors (swtch, );

   build_arrays (swtch, ); /* Build the static arrays and assignments.  
*/
   gen_inbound_check (swtch, );/* Build the bounds check.  */

I think it is better to do this rather than if (info.phi_count) return "no
non-virtual phis"; before create_temp_arrays, because this way we optimize the
switch into if, while otherwise we don't.  Most of the functions will not
really do much, e.g. allocate 0 elts arrays, etc., but only build_constructors
relies on info->phi_count > 0.

[Bug tree-optimization/84740] [8 Regression] ICE in build_constructors, at tree-switch-conversion.c:965

2018-03-07 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84740

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P1
   Target Milestone|--- |8.0

[Bug tree-optimization/84740] [8 Regression] ICE in build_constructors, at tree-switch-conversion.c:965

2018-03-06 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84740

Martin Liška  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |marxin at gcc dot 
gnu.org

--- Comment #2 from Martin Liška  ---
I can take a look.

[Bug tree-optimization/84740] [8 Regression] ICE in build_constructors, at tree-switch-conversion.c:965

2018-03-06 Thread dmalcolm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84740

David Malcolm  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2018-03-06
 CC||dmalcolm at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from David Malcolm  ---
Confirmed; assertion failure here:
#1  0x00e405ce in build_constructors (info=0x7fffdb80,
swtch=)
at ../../src/gcc/tree-switch-conversion.c:965

965   gcc_assert (!info->contiguous_range);

(gdb) p info->contiguous_range 
$1 = true

(gdb) call debug (info->range_min)
0
(gdb) call debug (info->range_max)
2

Started between r247528 (not affected) and r247538 (affected); probably
r247538.