This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix PR47559


We perform store-motion on loops without exits - which for the
testcase makes us fail to properly handle must-not-throw info.
The patch below simply disables store-motion for loops without
exits (technically the transformation is profitable though),
a workaround for the ICE.

Bootstrapped and tested on x86_64-unknown-linux-gnu.  Ok?

Any better idea where to check for the throwing statement?

Thanks,
Richard.

2011-02-01  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/47559
	* tree-ssa-loop-im.c (loop_suitable_for_sm): Do not perform
	store-motion on loops without exits.

	* g++.dg/torture/pr47559.C: New testcase.

Index: gcc/tree-ssa-loop-im.c
===================================================================
*** gcc/tree-ssa-loop-im.c	(revision 169434)
--- gcc/tree-ssa-loop-im.c	(working copy)
*************** loop_suitable_for_sm (struct loop *loop
*** 2368,2373 ****
--- 2368,2376 ----
    unsigned i;
    edge ex;
  
+   if (VEC_empty (edge, exits))
+     return false;
+ 
    FOR_EACH_VEC_ELT (edge, exits, i, ex)
      if (ex->flags & (EDGE_ABNORMAL | EDGE_EH))
        return false;
Index: gcc/testsuite/g++.dg/torture/pr47559.C
===================================================================
*** gcc/testsuite/g++.dg/torture/pr47559.C	(revision 0)
--- gcc/testsuite/g++.dg/torture/pr47559.C	(revision 0)
***************
*** 0 ****
--- 1,8 ----
+ // { dg-do compile }
+ // { dg-options "-std=c++0x -fnon-call-exceptions" }
+ 
+ void foo (int *k) noexcept
+ {
+   for (;;)
+     *k = 0;
+ }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]