From 4e11510216215d01cd88fa7310703d432c532a0a Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Mon, 12 Aug 2013 08:46:41 +0000 Subject: [PATCH] re PR tree-optimization/57980 (gcc 4.8.1 -foptimize-sibling-calls -O1 ICE in build_int_cst_wide, at tree.c:1210) PR tree-optimization/57980 Co-Authored-By: Marc Glisse From-SVN: r201660 --- gcc/ChangeLog | 7 +++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr57980.c | 19 +++++++++++++++++++ gcc/tree-tailcall.c | 12 ++---------- 4 files changed, 33 insertions(+), 10 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/pr57980.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 09899f30671..cda36e7257c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2013-08-12 Marek Polacek + Marc Glisse + + PR tree-optimization/57980 + * tree-tailcall.c (process_assignment): Call build_minus_one_cst + when creating -1 constant. + 2013-08-10 Jan Hubicka Workaround binutils PR14342. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3ff0e588d6f..4f0e3f12944 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-08-12 Marek Polacek + + PR tree-optimization/57980 + * gcc.dg/pr57980.c: New test. + 2013-08-12 Thomas Koenig PR fortran/56666 diff --git a/gcc/testsuite/gcc.dg/pr57980.c b/gcc/testsuite/gcc.dg/pr57980.c new file mode 100644 index 00000000000..682f0f477d9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr57980.c @@ -0,0 +1,19 @@ +/* PR tree-optimization/57980 */ +/* { dg-do compile } */ +/* { dg-options "-O -foptimize-sibling-calls" } */ + +typedef int V __attribute__ ((vector_size (sizeof (int)))); +extern V f (void); + +V +bar (void) +{ + return -f (); +} + +V +foo (void) +{ + V v = { }; + return v - f (); +} diff --git a/gcc/tree-tailcall.c b/gcc/tree-tailcall.c index 8cd7255e49b..c9716e708c0 100644 --- a/gcc/tree-tailcall.c +++ b/gcc/tree-tailcall.c @@ -326,11 +326,7 @@ process_assignment (gimple stmt, gimple_stmt_iterator call, tree *m, return true; case NEGATE_EXPR: - if (FLOAT_TYPE_P (TREE_TYPE (op0))) - *m = build_real (TREE_TYPE (op0), dconstm1); - else - *m = build_int_cst (TREE_TYPE (op0), -1); - + *m = build_minus_one_cst (TREE_TYPE (op0)); *ass_var = dest; return true; @@ -339,11 +335,7 @@ process_assignment (gimple stmt, gimple_stmt_iterator call, tree *m, *a = fold_build1 (NEGATE_EXPR, TREE_TYPE (non_ass_var), non_ass_var); else { - if (FLOAT_TYPE_P (TREE_TYPE (non_ass_var))) - *m = build_real (TREE_TYPE (non_ass_var), dconstm1); - else - *m = build_int_cst (TREE_TYPE (non_ass_var), -1); - + *m = build_minus_one_cst (TREE_TYPE (non_ass_var)); *a = fold_build1 (NEGATE_EXPR, TREE_TYPE (non_ass_var), non_ass_var); }