This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix PR47559
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Zdenek Dvorak <ook at ucw dot cz>
- Date: Tue, 1 Feb 2011 14:18:59 +0100 (CET)
- Subject: [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;
+ }