diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2014-02-18 11:07:34 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2014-02-18 11:07:34 +0000 |
commit | 20afe6403b216d1f0a2cc9e119efbac514acb533 (patch) | |
tree | db6dc729ce3c1dbfad3480aa1b60c35dc51fe4e7 | |
parent | 2a144f64c934939d1b484dc2b285231cb2f3d0cf (diff) | |
download | gcc-20afe6403b216d1f0a2cc9e119efbac514acb533.zip gcc-20afe6403b216d1f0a2cc9e119efbac514acb533.tar.gz gcc-20afe6403b216d1f0a2cc9e119efbac514acb533.tar.bz2 |
ipa-prop.c (compute_complex_ancestor_jump_func): Replace overzealous assertion with conditional return.
* ipa-prop.c (compute_complex_ancestor_jump_func): Replace overzealous
assertion with conditional return.
From-SVN: r207838
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/ipa-prop.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/opt32.adb | 37 |
4 files changed, 48 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b1287f8..5266500 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2014-02-18 Eric Botcazou <ebotcazou@adacore.com> + + * ipa-prop.c (compute_complex_ancestor_jump_func): Replace overzealous + assertion with conditional return. + 2014-02-18 Jakub Jelinek <jakub@redhat.com> Uros Bizjak <ubizjak@gmail.com> diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index bc23da65..0f29399 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -1211,7 +1211,8 @@ compute_complex_ancestor_jump_func (struct ipa_node_params *info, return; parm = TREE_OPERAND (expr, 0); index = ipa_get_param_decl_index (info, SSA_NAME_VAR (parm)); - gcc_assert (index >= 0); + if (index < 0) + return; cond_bb = single_pred (assign_bb); cond = last_stmt (cond_bb); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 92ae0d4..65c70b5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2014-02-18 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/opt32.adb: New test. + 2014-02-18 Janus Weil <janus@gcc.gnu.org> PR fortran/60231 diff --git a/gcc/testsuite/gnat.dg/opt32.adb b/gcc/testsuite/gnat.dg/opt32.adb new file mode 100644 index 0000000..93f31c2 --- /dev/null +++ b/gcc/testsuite/gnat.dg/opt32.adb @@ -0,0 +1,37 @@ +-- { dg-do compile } +-- { dg-options "-O2" } + +with Ada.Containers; use Ada.Containers; +with Ada.Containers.Vectors; + +function Opt32 return Natural is + + package My_Vectors + is new Vectors (Index_Type => Natural, Element_Type => Integer); + use My_Vectors; + + V : Vector; + + function Sign_Changes return Natural is + Cur : Cursor := To_Cursor (V, 0); + R : Natural := 0; + Negative : Boolean; + begin + Negative := Element (Cur) < 0; + + loop + Cur := Next (Cur); + exit when R > 100; + + if (Element (Cur) < 0) /= Negative then + Negative := not Negative; + R := R + 1; + end if; + end loop; + + return R; + end; + +begin + return Sign_Changes; +end; |