public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jakub at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/34969] [4.3 regression] ICE with -fipa-cp -ffast-math Date: Mon, 28 Jan 2008 10:10:00 -0000 [thread overview] Message-ID: <20080128095221.8384.qmail@sourceware.org> (raw) In-Reply-To: <bug-34969-1771@http.gcc.gnu.org/bugzilla/> ------- Comment #2 from jakub at gcc dot gnu dot org 2008-01-28 09:52 ------- Fix: 2008-01-28 Jakub Jelinek <jakub@redhat.com> PR middle-end/34969 * tree-inline.c (fold_marked_statements): Update resp. remove cgraph edges if a call statement has been folded. * cgraphunit.c (verify_cgraph_node): Set cfun to this_cfun for debug_generic_stmt calls, reset it back afterwards. * gcc.dg/pr34969.c: New test. --- gcc/tree-inline.c.jj 2008-01-22 15:03:23.000000000 +0100 +++ gcc/tree-inline.c 2008-01-28 10:43:17.000000000 +0100 @@ -2936,9 +2936,48 @@ fold_marked_statements (int first, struc if (pointer_set_contains (statements, bsi_stmt (bsi))) { tree old_stmt = bsi_stmt (bsi); + tree old_call = get_call_expr_in (old_stmt); + if (fold_stmt (bsi_stmt_ptr (bsi))) { update_stmt (bsi_stmt (bsi)); + if (old_call) + { + /* Update or remove corresponding cgraph edge if something changed. */ + tree new_stmt = bsi_stmt (bsi); + tree new_call = get_call_expr_in (new_stmt); + struct cgraph_node *node = cgraph_node (cfun->decl); + + if (old_call != new_call) + { + struct cgraph_edge *e = cgraph_edge (node, old_stmt); + struct cgraph_edge *ne = NULL; + tree new_decl; + + if (e) + { + if (new_call) + { + new_decl = get_callee_fndecl (new_call); + if (new_decl) + { + ne = cgraph_create_edge (node, cgraph_node (new_decl), + new_stmt, e->count, e->frequency, + e->loop_nest); + ne->inline_failed = e->inline_failed; + } + } + cgraph_remove_edge (e); + } + } + else if (old_stmt != new_stmt) + { + struct cgraph_edge *e = cgraph_edge (node, old_stmt); + + if (e) + cgraph_set_call_stmt (e, new_stmt); + } + } if (maybe_clean_or_replace_eh_stmt (old_stmt, bsi_stmt (bsi))) tree_purge_dead_eh_edges (BASIC_BLOCK (first)); } --- gcc/cgraphunit.c.jj 2008-01-28 09:30:03.000000000 +0100 +++ gcc/cgraphunit.c 2008-01-28 09:31:03.000000000 +0100 @@ -658,6 +658,7 @@ verify_cgraph_node (struct cgraph_node * struct cgraph_edge *e; struct cgraph_node *main_clone; struct function *this_cfun = DECL_STRUCT_FUNCTION (node->decl); + struct function *saved_cfun = cfun; basic_block this_block; block_stmt_iterator bsi; bool error_found = false; @@ -666,6 +667,8 @@ verify_cgraph_node (struct cgraph_node * return; timevar_push (TV_CGRAPH_VERIFY); + /* debug_generic_stmt needs correct cfun */ + set_cfun (this_cfun); for (e = node->callees; e; e = e->next_callee) if (e->aux) { @@ -808,6 +811,7 @@ verify_cgraph_node (struct cgraph_node * dump_cgraph_node (stderr, node); internal_error ("verify_cgraph_node failed"); } + set_cfun (saved_cfun); timevar_pop (TV_CGRAPH_VERIFY); } --- gcc/testsuite/gcc.dg/pr34969.c.jj 2008-01-28 10:45:55.000000000 +0100 +++ gcc/testsuite/gcc.dg/pr34969.c 2008-01-28 10:45:29.000000000 +0100 @@ -0,0 +1,15 @@ +/* PR middle-end/34969 */ +/* { dg-do compile } */ +/* { dg-options "-O -fipa-cp -ffast-math" } */ + +double +foo (double x) +{ + return x * x; +} + +double +bar (void) +{ + return foo (0); +} If any call is folded during ipa-cp, we IMHO have to update cgraph edges, otherwise cgraph verification afterwards can't succeed. Honza, does this make sense or should it be done elsewhere? Haven't bootstrapped/regtested this yet. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34969
next prev parent reply other threads:[~2008-01-28 9:53 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2008-01-25 8:53 [Bug middle-end/34969] New: " reichelt at gcc dot gnu dot org 2008-01-25 9:03 ` [Bug middle-end/34969] " reichelt at gcc dot gnu dot org 2008-01-25 10:26 ` rguenth at gcc dot gnu dot org 2008-01-28 9:17 ` jakub at gcc dot gnu dot org 2008-01-28 10:10 ` jakub at gcc dot gnu dot org [this message] 2008-01-28 12:35 ` rguenth at gcc dot gnu dot org 2008-01-28 13:44 ` jakub at gcc dot gnu dot org 2008-01-28 13:44 ` rguenth at gcc dot gnu dot org 2008-01-28 21:48 ` hubicka at ucw dot cz 2008-01-30 0:03 ` jakub at gcc dot gnu dot org 2008-01-30 0:07 ` jakub at gcc dot gnu dot org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20080128095221.8384.qmail@sourceware.org \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).