Hi,
this is a regression present on all active branches. The following assertion
triggers in compute_complex_ancestor_jump_func:
index = ipa_get_param_decl_index (info, SSA_NAME_VAR (parm));
gcc_assert (index >= 0);
because the PARM_DECL is the static_chain_decl so the returned index is -1.
It seems to me that this assertion is overzealous: in many other places, the
code explicitly tests for the non-negativity of index and returns otherwise.
Hence the proposed fix, tested on x86_64-suse-linux, OK for all branches?
2014-02-17 Eric Botcazou <ebotca...@adacore.com>
* ipa-prop.c (compute_complex_ancestor_jump_func): Replace overzealous
assertion with conditional return.
2014-02-17 Eric Botcazou <ebotca...@adacore.com>
* gnat.dg/opt32.adb: New test.
--
Eric Botcazou
Index: ipa-prop.c
===================================================================
--- ipa-prop.c (revision 207796)
+++ ipa-prop.c (working copy)
@@ -1211,7 +1211,8 @@ compute_complex_ancestor_jump_func (stru
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);
-- { 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;