Launchpad has imported 20 comments from the remote bug at http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45709.
If you reply to an imported comment from within Launchpad, your comment will be sent to the remote bug automatically. Read more about Launchpad's inter-bugtracker facilities at https://help.launchpad.net/InterBugTracking. ------------------------------------------------------------------------ On 2010-09-17T19:51:35+00:00 Hjl-tools wrote: [hjl@gnu-35 rrs]$ cat foo.cc struct foo { virtual void bar(); struct Rect { int bottom; }; struct Region { static Region subtract(const Rect& lhs, const Rect& rhs) { Region reg; Rect* storage = reg.storage; { if (lhs.bottom > rhs.bottom) storage++; reg.count = storage - reg.storage; } return reg; } Rect storage[4]; int count; }; Rect dirtyRegion; Rect oldDirtyRegion; }; void foo::bar() { const Region copyBack(Region::subtract(oldDirtyRegion, dirtyRegion)); } [hjl@gnu-35 rrs]$ /export/gnu/import/rrs/164143/usr/bin/gcc -S -O foo.cc foo.cc: In member function ‘virtual void foo::bar()’: foo.cc:27:70: internal compiler error: in add_phi_arg, at tree-phinodes.c:395 Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. [hjl@gnu-35 rrs]$ Reply at: https://bugs.launchpad.net/gcc/+bug/885280/comments/0 ------------------------------------------------------------------------ On 2010-09-17T20:25:35+00:00 Pinskia wrote: Reduced testcase: struct Region { int storage[4]; int count; }; static inline Region subtract(int lhs) { Region reg; int* storage = reg.storage; if (lhs > 0) storage++; reg.count = storage - reg.storage; return reg; } void bar(int a) { const Region copyBack(subtract(a)); } ---- CUT --- Comes from inlining. Reply at: https://bugs.launchpad.net/gcc/+bug/885280/comments/1 ------------------------------------------------------------------------ On 2010-09-17T20:35:51+00:00 Pinskia wrote: Not what is happening is an interaction between the inlining and the return slot optimization and the named value optimization. Before inlining we have: # storage_1 = PHI <&<retval>.storage[0](2), &<retval>.storage[1](3)> ... copyBack.1_1 = (struct Region *) ©Back; *copyBack.1_1 ={v} subtract (a_2(D)) [return slot optimization]; --- Cut ---- Since &(*copyBack.1_1).storage[0] is not a constant we get an ICE. Why we don't remove the extra cast to begin is questionable. If we change: const Region copyBack(subtract(a)); to const Region copyBack = (subtract(a)); We can remove the cast and it works. Reply at: https://bugs.launchpad.net/gcc/+bug/885280/comments/2 ------------------------------------------------------------------------ On 2010-09-17T22:02:08+00:00 Hjl-tools wrote: It was introduced between revision 127644 and 127649. Reply at: https://bugs.launchpad.net/gcc/+bug/885280/comments/3 ------------------------------------------------------------------------ On 2010-09-17T22:17:16+00:00 Hjl-tools wrote: Revision 127647: http://gcc.gnu.org/ml/gcc-cvs/2007-08/msg00541.html introduced: [hjl@gnu-26 gcc]$ ./xgcc -B./ -S -O ../../../pr45709.cc ../../../pr45709.cc: In member function ‘virtual void foo::bar()’: ../../../pr45709.cc:27: error: PHI def is not a GIMPLE value storage_8 = PHI <©Back.1_1->storage[0](2), ©Back.1_1->storage[1](3)> ©Back.1_1->storage[0]; ../../../pr45709.cc:27: error: PHI def is not a GIMPLE value storage_8 = PHI <©Back.1_1->storage[0](2), ©Back.1_1->storage[1](3)> ©Back.1_1->storage[1]; ../../../pr45709.cc:27: error: invalid operand to unary operator ©Back.1_1->storage; ../../../pr45709.cc:27: internal compiler error: verify_stmts failed Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. [hjl@gnu-26 gcc]$ Reply at: https://bugs.launchpad.net/gcc/+bug/885280/comments/4 ------------------------------------------------------------------------ On 2010-09-17T22:20:40+00:00 Hjl-tools wrote: Revision 127647 is the first revision which failed to compile this. Reply at: https://bugs.launchpad.net/gcc/+bug/885280/comments/5 ------------------------------------------------------------------------ On 2010-09-18T02:59:20+00:00 Hjl-tools wrote: This patch: http://gcc.gnu.org/ml/gcc-patches/2010-09/msg01459.html fixes the bug, but caused: FAIL: g++.dg/conversion/op5.C (test for errors, line 18) FAIL: g++.dg/conversion/op5.C (test for excess errors) Now, we get [hjl@gnu-6 gcc]$ ./xgcc -B./ -S -O /export/gnu/import/git/gcc/gcc/testsuite/g++.dg/conversion/op5.C -ansi -pedantic-errors /export/gnu/import/git/gcc/gcc/testsuite/g++.dg/conversion/op5.C: In function \u2018void foo(const B&)\u2019: /export/gnu/import/git/gcc/gcc/testsuite/g++.dg/conversion/op5.C:18:15: error: conversion from \u2018const B\u2019 to non-scalar type \u2018A\u2019 requested [hjl@gnu-6 gcc]$ "const" is missing. Reply at: https://bugs.launchpad.net/gcc/+bug/885280/comments/6 ------------------------------------------------------------------------ On 2010-09-18T03:36:23+00:00 Hjl-tools wrote: A patch is posted at http://gcc.gnu.org/ml/gcc-patches/2010-09/msg01461.html Reply at: https://bugs.launchpad.net/gcc/+bug/885280/comments/7 ------------------------------------------------------------------------ On 2010-09-18T09:53:15+00:00 Rguenth wrote: We run into /* With return slot optimization we can end up with non-gimple (foo *)&this->m, fix that here. */ if (TREE_CODE (new_arg) != SSA_NAME && TREE_CODE (new_arg) != FUNCTION_DECL && !is_gimple_val (new_arg)) { gimple_seq stmts = NULL; new_arg = force_gimple_operand (new_arg, &stmts, true, NULL); gsi_insert_seq_on_edge_immediate (new_edge, stmts); but inserting on an edge that needs splitting, which wrecks new_edge. Index: tree-inline.c =================================================================== --- tree-inline.c (revision 164388) +++ tree-inline.c (working copy) @@ -2021,8 +2021,11 @@ copy_phis_for_bb (basic_block bb, copy_b && !is_gimple_val (new_arg)) { gimple_seq stmts = NULL; + basic_block tem; new_arg = force_gimple_operand (new_arg, &stmts, true, NULL); - gsi_insert_seq_on_edge_immediate (new_edge, stmts); + tem = gsi_insert_seq_on_edge_immediate (new_edge, stmts); + if (tem) + new_edge = find_edge (tem, new_bb); } add_phi_arg (new_phi, new_arg, new_edge, gimple_phi_arg_location_from_edge (phi, old_edge)); fixes that. Reply at: https://bugs.launchpad.net/gcc/+bug/885280/comments/8 ------------------------------------------------------------------------ On 2010-09-18T11:38:41+00:00 Rguenth wrote: Subject: Bug 45709 Author: rguenth Date: Sat Sep 18 11:38:25 2010 New Revision: 164390 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=164390 Log: 2010-09-18 Richard Guenther <[email protected]> PR tree-optimization/45709 * tree-inline.c (copy_phis_for_bb): Fixup new_edge when we splitted it. * g++.dg/torture/pr45709.C: New testcase. Added: trunk/gcc/testsuite/g++.dg/torture/pr45709.C Modified: trunk/gcc/ChangeLog trunk/gcc/tree-inline.c Reply at: https://bugs.launchpad.net/gcc/+bug/885280/comments/9 ------------------------------------------------------------------------ On 2010-09-18T11:39:55+00:00 Rguenth wrote: Subject: Bug 45709 Author: rguenth Date: Sat Sep 18 11:39:44 2010 New Revision: 164391 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=164391 Log: 2010-09-18 Richard Guenther <[email protected]> PR tree-optimization/45709 * tree-inline.c (copy_phis_for_bb): Fixup new_edge when we splitted it. * g++.dg/torture/pr45709.C: New testcase. Added: branches/gcc-4_5-branch/gcc/testsuite/g++.dg/torture/pr45709.C Modified: branches/gcc-4_5-branch/gcc/ChangeLog branches/gcc-4_5-branch/gcc/tree-inline.c Reply at: https://bugs.launchpad.net/gcc/+bug/885280/comments/10 ------------------------------------------------------------------------ On 2010-09-18T12:30:55+00:00 Rguenth wrote: Stopping here for now - I guess doing immediate insertion still can break things as if there is another PHI node we'll iterate over the edges again (but now including split ones) and find_edge (new_edge->src->aux, bb) will break as new_edge->src is the newly inserted block. I suppose delaying edge insert commits until after at least this block is finished is better. Reply at: https://bugs.launchpad.net/gcc/+bug/885280/comments/11 ------------------------------------------------------------------------ On 2010-09-18T12:42:58+00:00 Rguenth wrote: Yep - testcase that still ICEs (now w/ a segfault): struct Region { int storage[4]; int count; }; static inline Region subtract(int lhs) { Region reg; int* storage = reg.storage; int* storage2 = reg.storage; if (lhs > 0) storage++, storage2--; reg.count = storage - reg.storage + storage2 - reg.storage; return reg; } void bar(int a) { const Region copyBack(subtract(a)); } Reply at: https://bugs.launchpad.net/gcc/+bug/885280/comments/12 ------------------------------------------------------------------------ On 2010-09-18T12:54:30+00:00 Rguenth wrote: new patch in testing. Reply at: https://bugs.launchpad.net/gcc/+bug/885280/comments/13 ------------------------------------------------------------------------ On 2010-09-18T17:13:16+00:00 Rguenth wrote: Subject: Bug 45709 Author: rguenth Date: Sat Sep 18 17:13:04 2010 New Revision: 164397 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=164397 Log: 2010-09-18 Richard Guenther <[email protected]> PR tree-optimization/45709 * tree-inline.c (copy_phis_for_bb): Delay commit of edge insertions until after all PHI nodes of the block are processed. * g++.dg/torture/pr45709-2.C: New testcase. Added: trunk/gcc/testsuite/g++.dg/torture/pr45709-2.C Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-inline.c Reply at: https://bugs.launchpad.net/gcc/+bug/885280/comments/14 ------------------------------------------------------------------------ On 2010-09-18T17:16:55+00:00 Rguenth wrote: Subject: Bug 45709 Author: rguenth Date: Sat Sep 18 17:16:42 2010 New Revision: 164398 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=164398 Log: 2010-09-18 Richard Guenther <[email protected]> PR tree-optimization/45709 * tree-inline.c (copy_phis_for_bb): Delay commit of edge insertions until after all PHI nodes of the block are processed. * g++.dg/torture/pr45709-2.C: New testcase. Added: branches/gcc-4_5-branch/gcc/testsuite/g++.dg/torture/pr45709-2.C Modified: branches/gcc-4_5-branch/gcc/ChangeLog branches/gcc-4_5-branch/gcc/testsuite/ChangeLog branches/gcc-4_5-branch/gcc/tree-inline.c Reply at: https://bugs.launchpad.net/gcc/+bug/885280/comments/15 ------------------------------------------------------------------------ On 2010-09-18T17:23:36+00:00 Rguenth wrote: Subject: Bug 45709 Author: rguenth Date: Sat Sep 18 17:23:20 2010 New Revision: 164399 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=164399 Log: 2010-09-18 Richard Guenther <[email protected]> PR tree-optimization/45709 * tree-inline.c (copy_phis_for_bb): Delay commit of edge insertions until after all PHI nodes of the block are processed. * g++.dg/torture/pr45709.C: New testcase. * g++.dg/torture/pr45709-2.C: Likewise. Added: branches/gcc-4_4-branch/gcc/testsuite/g++.dg/torture/pr45709-2.C branches/gcc-4_4-branch/gcc/testsuite/g++.dg/torture/pr45709.C Modified: branches/gcc-4_4-branch/gcc/ChangeLog branches/gcc-4_4-branch/gcc/testsuite/ChangeLog branches/gcc-4_4-branch/gcc/tree-inline.c Reply at: https://bugs.launchpad.net/gcc/+bug/885280/comments/16 ------------------------------------------------------------------------ On 2010-09-18T17:24:14+00:00 Rguenth wrote: Backport for 4.3 pending testing. Reply at: https://bugs.launchpad.net/gcc/+bug/885280/comments/17 ------------------------------------------------------------------------ On 2010-09-18T18:54:09+00:00 Rguenth wrote: Subject: Bug 45709 Author: rguenth Date: Sat Sep 18 18:53:53 2010 New Revision: 164400 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=164400 Log: 2010-09-18 Richard Guenther <[email protected]> PR tree-optimization/45709 * tree-inline.c (copy_phis_for_bb): Delay commit of edge insertions until after all PHI nodes of the block are processed. * g++.dg/torture/pr45709.C: New testcase. * g++.dg/torture/pr45709-2.C: Likewise. Added: branches/gcc-4_3-branch/gcc/testsuite/g++.dg/torture/pr45709-2.C branches/gcc-4_3-branch/gcc/testsuite/g++.dg/torture/pr45709.C Modified: branches/gcc-4_3-branch/gcc/ChangeLog branches/gcc-4_3-branch/gcc/testsuite/ChangeLog branches/gcc-4_3-branch/gcc/tree-inline.c Reply at: https://bugs.launchpad.net/gcc/+bug/885280/comments/18 ------------------------------------------------------------------------ On 2010-09-18T18:54:33+00:00 Rguenth wrote: Fixed. Reply at: https://bugs.launchpad.net/gcc/+bug/885280/comments/19 ** Changed in: gcc Status: Unknown => Fix Released ** Changed in: gcc Importance: Unknown => Medium -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/885280 Title: internal compiler error: in add_phi_arg, at tree-phinodes.c:391 [maverick] To manage notifications about this bug go to: https://bugs.launchpad.net/gcc/+bug/885280/+subscriptions -- ubuntu-bugs mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
