[Bug c++/84938] [7/8 Regression] internal compiler error: in gen_reg_rtx, at emit-rtl.c:1187 (gen_reg_rtx()/maybe_legitimize_operand())

2018-04-04 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84938

--- Comment #4 from Jason Merrill  ---
Author: jason
Date: Thu Apr  5 00:09:10 2018
New Revision: 259108

URL: https://gcc.gnu.org/viewcvs?rev=259108=gcc=rev
Log:
PR c++/84938 - ICE with division by ~-1.

* call.c (set_up_extended_ref_temp): Call cp_fully_fold.

Added:
trunk/gcc/testsuite/g++.dg/expr/div-by-zero1.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/call.c

[Bug c++/84938] [7/8 Regression] internal compiler error: in gen_reg_rtx, at emit-rtl.c:1187 (gen_reg_rtx()/maybe_legitimize_operand())

2018-04-04 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84938

Jason Merrill  changed:

   What|Removed |Added

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

[Bug c++/84938] [7/8 Regression] internal compiler error: in gen_reg_rtx, at emit-rtl.c:1187 (gen_reg_rtx()/maybe_legitimize_operand())

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

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org,
   ||jason at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek  ---
Perhaps instead of integer_zerop for div_by_zero build2 could use
div_by_zero = TREE_CONSTANT (arg1) && !integer_nonzerop (arg1);
i.e. be conservative rather than optimistic when arg1 is TREE_CONSTANT, but not
INTEGER_CST/COMPLEX_CST.  But integer_nonzerop doesn't handle for some reason
VECTOR_CSTs, so we'd either need to change integer_nonzerop or for now build2
to handle VECTOR_CST somehow.

[Bug c++/84938] [7/8 Regression] internal compiler error: in gen_reg_rtx, at emit-rtl.c:1187 (gen_reg_rtx()/maybe_legitimize_operand())

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

--- Comment #2 from Jakub Jelinek  ---
int & = 1 / ~-1;
is enough.

When we have
int & = 1 / 0;
this doesn't ICE.  When creating TRUNC_DIV_EXPR for the latter, we don't set
the constant bit on it, because the last argument is integer_zerop.  That is
not the case with the former testcase, but both arguments are TREE_CONSTANT and
so we set TREE_CONSTANT on the TRUNC_DIV_EXPR as well.

I'm surprised we never cp_fold this initializer.

[Bug c++/84938] [7/8 Regression] internal compiler error: in gen_reg_rtx, at emit-rtl.c:1187 (gen_reg_rtx()/maybe_legitimize_operand())

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

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P2

[Bug c++/84938] [7/8 Regression] internal compiler error: in gen_reg_rtx, at emit-rtl.c:1187 (gen_reg_rtx()/maybe_legitimize_operand())

2018-03-19 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84938

Marek Polacek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2018-03-19
 CC||mpolacek at gcc dot gnu.org
   Target Milestone|--- |7.4
Summary|internal compiler error: in |[7/8 Regression] internal
   |gen_reg_rtx, at |compiler error: in
   |emit-rtl.c:1187 |gen_reg_rtx, at
   |(gen_reg_rtx()/maybe_legiti |emit-rtl.c:1187
   |mize_operand()) |(gen_reg_rtx()/maybe_legiti
   ||mize_operand())
 Ever confirmed|0   |1

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