re PR tree-optimization/57980 (gcc 4.8.1 -foptimize-sibling-calls -O1 ICE in build_int_cst_wide, at tree.c:1210)

2013-08-13  Marek Polacek  <polacek@redhat.com>
	    Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/57980
	* tree-tailcall.c (process_assignment): Return false
	when not dealing with integers or floats.

	* gcc.dg/pr57980.c: New test.

From-SVN: r201688
This commit is contained in:
Marek Polacek 2013-08-13 13:42:28 +00:00 committed by Marek Polacek
parent f9003a6855
commit 03c2ff37a5
4 changed files with 43 additions and 2 deletions

View File

@ -1,3 +1,13 @@
2013-08-13 Marek Polacek <polacek@redhat.com>
Backport from 4.8:
2013-0813 Marek Polacek <polacek@redhat.com>
Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/57980
* tree-tailcall.c (process_assignment): Return false
when not dealing with integers or floats.
2013-08-12 David Edelsohn <dje.gcc@gmail.com>
Backport from mainline

View File

@ -1,3 +1,11 @@
2013-08-13 Marek Polacek <polacek@redhat.com>
Backport from 4.8:
2013-08-13 Marek Polacek <polacek@redhat.com>
PR tree-optimization/57980
* gcc.dg/pr57980.c: New test.
2013-08-11 Janus Weil <janus@gcc.gnu.org>
Backport from trunk:

View File

@ -0,0 +1,19 @@
/* PR tree-optimization/57980 */
/* { dg-do compile } */
/* { dg-options "-O -foptimize-sibling-calls -w" } */
typedef int V __attribute__ ((vector_size (2 * sizeof (int))));
extern V f (void);
V
bar (void)
{
return -f ();
}
V
foo (void)
{
V v = { };
return v - f ();
}

View File

@ -329,8 +329,10 @@ process_assignment (gimple stmt, gimple_stmt_iterator call, tree *m,
case NEGATE_EXPR:
if (FLOAT_TYPE_P (TREE_TYPE (op0)))
*m = build_real (TREE_TYPE (op0), dconstm1);
else
else if (INTEGRAL_TYPE_P (TREE_TYPE (op0)))
*m = build_int_cst (TREE_TYPE (op0), -1);
else
return false;
*ass_var = dest;
return true;
@ -342,8 +344,10 @@ process_assignment (gimple stmt, gimple_stmt_iterator call, tree *m,
{
if (FLOAT_TYPE_P (TREE_TYPE (non_ass_var)))
*m = build_real (TREE_TYPE (non_ass_var), dconstm1);
else
else if (INTEGRAL_TYPE_P (TREE_TYPE (non_ass_var)))
*m = build_int_cst (TREE_TYPE (non_ass_var), -1);
else
return false;
*a = fold_build1 (NEGATE_EXPR, TREE_TYPE (non_ass_var), non_ass_var);
}