Summary: | [4.6 Regression] ICE when using cold attribute | ||
---|---|---|---|
Product: | gcc | Reporter: | Matt Hargett <matt> |
Component: | middle-end | Assignee: | Jan Hubicka <hubicka> |
Status: | RESOLVED FIXED | ||
Severity: | major | CC: | hubicka, jakub, jianghan08, vincenzo.innocente |
Priority: | P2 | Keywords: | ice-on-valid-code |
Version: | 4.6.0 | ||
Target Milestone: | 4.6.4 | ||
Host: | Target: | ||
Build: | Known to work: | 4.7.0 | |
Known to fail: | 4.5.3, 4.6.2 | Last reconfirmed: | 2012-01-19 00:00:00 |
Bug Depends on: | |||
Bug Blocks: | 51460 | ||
Attachments: | source file which elicits the error at -O[123] |
Description
Matt Hargett
2011-04-14 02:36:18 UTC
-ENOATTACHMENT Created attachment 23983 [details]
source file which elicits the error at -O[123]
I added the attachment; are you still waiting on something from me? Let me know :) Simplified testcase for -O: struct A { ~A (); }; const A &operator << (const A &, const char *); void bar () __attribute__ ((cold)); void foo (void) { for (;;) { A a; a << "foo"; bar (); } } Caused by http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=161691 found is false and leads into infinite recursion in predict_paths_for_bb (alternating 3 bbs forever). any chance this can be fixed for 4.6.1? this is a critical regression for us. GCC 4.6.1 is being released. *** Bug 50112 has been marked as a duplicate of this bug. *** Honza? mine GCC 4.6.2 is being released. *** Bug 51460 has been marked as a duplicate of this bug. *** Testcase from PR51460 class mx { public: mx(); }; int main() { while (true) { mx *bar = new mx; mx *baz = new mx; continue; } return 0; } Honza, please work on your bugs! Honza, ping? Sorry, missed this bug (and for really long file as I see now). It is originally Zdenek's code. Will check it now. I am testing the attached patch Index: predict.c =================================================================== --- predict.c (revision 183666) +++ predict.c (working copy) @@ -1833,6 +1833,10 @@ predict_paths_for_bb (basic_block cur, b edge_iterator ei; basic_block son; + /* AUX is used to detect cycles while walking predictors with only EH/FAKE + succestors. */ + cur->aux = (void *)(size_t) 1; + /* We are looking for all edges forming edge cut induced by set of all blocks postdominated by BB. */ FOR_EACH_EDGE (e, ei, cur->preds) @@ -1848,7 +1852,7 @@ predict_paths_for_bb (basic_block cur, b continue; gcc_assert (bb == cur || dominated_by_p (CDI_POST_DOMINATORS, cur, bb)); - /* See if there is how many edge from e->src that is not abnormal + /* See if there is an edge from e->src that is not abnormal and does not lead to BB. */ FOR_EACH_EDGE (e2, ei2, e->src->succs) if (e2 != e @@ -1864,13 +1868,14 @@ predict_paths_for_bb (basic_block cur, b leading to e->src. */ if (found) predict_edge_def (e, pred, taken); - else + else if (!e->src->aux) predict_paths_for_bb (e->src, e->src, pred, taken); } for (son = first_dom_son (CDI_POST_DOMINATORS, cur); son; son = next_dom_son (CDI_POST_DOMINATORS, son)) predict_paths_for_bb (son, bb, pred, taken); + cur->aux = (void *)(size_t) NULL; } /* Sets branch probabilities according to PREDiction and Author: hubicka Date: Fri Feb 10 12:21:16 2012 New Revision: 184089 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=184089 Log: PR middle-end/48600 * predict.c (predict_paths_for_bb): Prevent looping. (predict_paths_leading_to_edge, predict_paths_leading_to): Update. * g++.dg/torture/pr48600.C: New testcase. Added: trunk/gcc/testsuite/g++.dg/torture/pr48600.C Modified: trunk/gcc/ChangeLog trunk/gcc/predict.c trunk/gcc/testsuite/ChangeLog Fixed in 4.7. Backport to 4.6 should be easy. GCC 4.6.3 is being released. *** Bug 52649 has been marked as a duplicate of this bug. *** Author: hubicka Date: Fri Mar 23 14:22:24 2012 New Revision: 185739 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=185739 Log: Backport from mainline PR middle-end/48600 * predict.c (predict_paths_for_bb): Prevent looping. (predict_paths_leading_to_edge, predict_paths_leading_to): Update. Modified: branches/gcc-4_6-branch/gcc/ChangeLog branches/gcc-4_6-branch/gcc/predict.c branches/gcc-4_6-branch/gcc/testsuite/ChangeLog Fixed. Author: jye2 Date: Mon Jun 11 09:10:07 2012 New Revision: 188381 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=188381 Log: 2012-06-11 Joey Ye <joey.ye@arm.com> Backport r184089,184180 from mainline 2012-02-10 Jan Hubicka <jh@suse.cz> PR middle-end/48600 * predict.c (predict_paths_for_bb): Prevent looping. (predict_paths_leading_to_edge, predict_paths_leading_to): Update. 2012-02-13 Jan Hubicka <jh@suse.cz> PR middle-end/52214 * predict.c (predict_paths_for_bb): Fix thinko in prevoius patch. Backport partly r181172 from mainline 2011-11-08 Michael Matz <matz@suse.de> PR bootstrap/51969 * gengtype.c (write_field_root): Avoid out-of-scope access of newv. testsuite: Backport r184089 from mainline 2012-02-10 Jan Hubicka <jh@suse.cz> PR middle-end/48600 * g++.dg/torture/pr48600.C: New testcase. Added: branches/ARM/embedded-4_6-branch/gcc/testsuite/c-c++-common/pr52181.c branches/ARM/embedded-4_6-branch/gcc/testsuite/g++.dg/torture/pr48600.C Modified: branches/ARM/embedded-4_6-branch/gcc/ChangeLog.arm branches/ARM/embedded-4_6-branch/gcc/gengtype.c branches/ARM/embedded-4_6-branch/gcc/predict.c branches/ARM/embedded-4_6-branch/gcc/testsuite/ChangeLog.arm |