ipa-prop.c (compute_complex_ancestor_jump_func): Replace overzealous assertion with...
authorEric Botcazou <ebotcazou@adacore.com>
Tue, 18 Feb 2014 11:07:34 +0000 (11:07 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Tue, 18 Feb 2014 11:07:34 +0000 (11:07 +0000)
* ipa-prop.c (compute_complex_ancestor_jump_func): Replace overzealous
assertion with conditional return.

From-SVN: r207838

gcc/ChangeLog
gcc/ipa-prop.c
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/opt32.adb [new file with mode: 0644]

index b1287f8..5266500 100644 (file)
@@ -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>
 
 2014-02-18  Jakub Jelinek  <jakub@redhat.com>
            Uros Bizjak  <ubizjak@gmail.com>
 
index bc23da6..0f29399 100644 (file)
@@ -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));
     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);
 
   cond_bb = single_pred (assign_bb);
   cond = last_stmt (cond_bb);
index 92ae0d4..65c70b5 100644 (file)
@@ -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
 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 (file)
index 0000000..93f31c2
--- /dev/null
@@ -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;