re PR middle-end/60729 (Compiler failure for combination of -ftrapv and -O3: compiler error: in prepare_cmp_insn)

2014-04-02  Richard Biener  <rguenther@suse.de>

	PR middle-end/60729
	* optabs.c (expand_abs_nojump): Honor flag_trapv only for
	MODE_INTs.  Properly use negv_optab.
	(expand_abs): Likewise.

	* g++.dg/vect/pr60729.cc: New testcase.

From-SVN: r209012
This commit is contained in:
Richard Biener 2014-04-02 08:26:57 +00:00 committed by Richard Biener
parent 21b624f069
commit dad16761d1
4 changed files with 28 additions and 3 deletions

View File

@ -1,3 +1,10 @@
2014-04-02 Richard Biener <rguenther@suse.de>
PR middle-end/60729
* optabs.c (expand_abs_nojump): Honor flag_trapv only for
MODE_INTs. Properly use negv_optab.
(expand_abs): Likewise.
2014-04-02 Richard Biener <rguenther@suse.de>
PR bootstrap/60719

View File

@ -3384,7 +3384,8 @@ expand_abs_nojump (enum machine_mode mode, rtx op0, rtx target,
{
rtx temp;
if (! flag_trapv)
if (GET_MODE_CLASS (mode) != MODE_INT
|| ! flag_trapv)
result_unsignedp = 1;
/* First try to do it with a special abs instruction. */
@ -3407,7 +3408,8 @@ expand_abs_nojump (enum machine_mode mode, rtx op0, rtx target,
{
rtx last = get_last_insn ();
temp = expand_unop (mode, neg_optab, op0, NULL_RTX, 0);
temp = expand_unop (mode, result_unsignedp ? neg_optab : negv_optab,
op0, NULL_RTX, 0);
if (temp != 0)
temp = expand_binop (mode, smax_optab, op0, temp, target, 0,
OPTAB_WIDEN);
@ -3449,7 +3451,8 @@ expand_abs (enum machine_mode mode, rtx op0, rtx target,
{
rtx temp, op1;
if (! flag_trapv)
if (GET_MODE_CLASS (mode) != MODE_INT
|| ! flag_trapv)
result_unsignedp = 1;
temp = expand_abs_nojump (mode, op0, target, result_unsignedp);

View File

@ -1,3 +1,8 @@
2014-04-02 Richard Biener <rguenther@suse.de>
PR middle-end/60729
* g++.dg/vect/pr60729.cc: New testcase.
2014-04-01 Fabien Chêne <fabien@gcc.gnu.org>
* g++.dg/init/ctor4.C: Adjust.

View File

@ -0,0 +1,10 @@
// { dg-do compile }
// { dg-additional-options "-ftrapv" }
void doSomething(int dim, double *Y, double *A)
{
for (int k=0; k<dim; k++)
Y[k] += __builtin_fabs (A[k]);
}
// { dg-final { cleanup-tree-dump "vect" } }