This fixes PR50723, a common error when inserting stmts after some
others and using GSI_NEW (which will make the iterator point to
the _first_ newly inserted stmt).

Bootstrap and regtest running on x86_64-unknown-linux-gnu.

Richard.

2011-10-14  Richard Guenther  <rguent...@suse.de>

        PR tree-optimization/50723
        * ipa-split.c (split_function): Use GSI_CONTINUE_LINKING.

        * gcc.dg/torture/pr50723.c: New testcase.

Index: gcc/ipa-split.c
===================================================================
*** gcc/ipa-split.c     (revision 179962)
--- gcc/ipa-split.c     (working copy)
*************** split_function (struct split_point *spli
*** 1134,1140 ****
      if (!is_gimple_val (arg))
        {
        arg = force_gimple_operand_gsi (&gsi, arg, true, NULL_TREE,
!                                       false, GSI_NEW_STMT);
        VEC_replace (tree, args_to_pass, i, arg);
        }
    call = gimple_build_call_vec (node->decl, args_to_pass);
--- 1134,1140 ----
      if (!is_gimple_val (arg))
        {
        arg = force_gimple_operand_gsi (&gsi, arg, true, NULL_TREE,
!                                       false, GSI_CONTINUE_LINKING);
        VEC_replace (tree, args_to_pass, i, arg);
        }
    call = gimple_build_call_vec (node->decl, args_to_pass);
Index: gcc/testsuite/gcc.dg/torture/pr50723.c
===================================================================
*** gcc/testsuite/gcc.dg/torture/pr50723.c      (revision 0)
--- gcc/testsuite/gcc.dg/torture/pr50723.c      (revision 0)
***************
*** 0 ****
--- 1,26 ----
+ /* { dg-do compile } */
+ 
+ typedef short unsigned int wchar_t;
+ typedef unsigned int size_t;
+ int* _errno(void);
+ int WideCharToMultiByte (wchar_t *);
+ int __attribute__ ((__nonnull__ (1)))
+ __wcrtomb_cp (char *dst, wchar_t wc, const unsigned int cp,
+             const unsigned int mb_max)
+ {
+   if (cp == 0)     {
+       if (wc > 255) 
+       (*_errno()) = 42;
+       return 1;
+   }
+   else 
+     return WideCharToMultiByte (&wc);
+ }
+ void wcsrtombs (char *dst, const wchar_t *pwc, unsigned int cp,
+               unsigned int mb_max)
+ {
+   if ((__wcrtomb_cp (dst, *pwc, cp, mb_max)) <= 0)
+     return;
+   if ((__wcrtomb_cp (dst, *pwc, cp, mb_max)) <= 0)
+     return;
+ }

Reply via email to