From: Eric Botcazou Date: Tue, 18 Feb 2014 11:07:34 +0000 (+0000) Subject: ipa-prop.c (compute_complex_ancestor_jump_func): Replace overzealous assertion with... X-Git-Tag: upstream/12.2.0~64701 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=20afe6403b216d1f0a2cc9e119efbac514acb533;p=platform%2Fupstream%2Fgcc.git 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 --- 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 + + * ipa-prop.c (compute_complex_ancestor_jump_func): Replace overzealous + assertion with conditional return. + 2014-02-18 Jakub Jelinek Uros Bizjak 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 + + * gnat.dg/opt32.adb: New test. + 2014-02-18 Janus Weil 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;