diff mbox

[PR,61540] Do not ICE on impossible devirtualization

Message ID 20140625082122.GD32150@virgil.suse
State New
Headers show

Commit Message

Martin Jambor June 25, 2014, 8:21 a.m. UTC
Hi,

On Mon, Jun 23, 2014 at 01:38:03PM +0100, James Greenhalgh wrote:
> On Thu, Jun 19, 2014 at 12:49:55PM +0100, Martin Jambor wrote:
> > Hi,
> > 
> > On Wed, Jun 18, 2014 at 06:12:34PM +0200, Bernhard Reutner-Fischer wrote:
> > > On 18 June 2014 10:24:16 Martin Jambor <mjambor@suse.cz> wrote:
> > > 
> > > >@@ -3002,10 +3014,8 @@ try_make_edge_direct_virtual_call (struct
> > > >cgraph_edge *ie,
> > > >
> > > >   if (target)
> > > >     {
> > > >-#ifdef ENABLE_CHECKING
> > > >-      gcc_assert (possible_polymorphic_call_target_p
> > > >-	 (ie, cgraph_get_node (target)));
> > > >-#endif
> > > >+      if (!possible_polymorphic_call_target_p (ie, cgraph_get_node (target)))
> > > >+	return ipa_make_edge_direct_to_target (ie, target);
> > > >       return ipa_make_edge_direct_to_target (ie, target);
> > > >     }
> > > 
> > > The above looks odd. You return the same thing both conditionally
> > > and unconditionally?
> > > 
> > 
> > You are obviously right, apparently I was too tired to attempt to work
> > that night.  Thanks, for spotting it.  The following patch has this
> > corrected and it also passes bootstrap and testing on x86_64-linux on
> > both the trunk and the 4.9 branch. OK for both?
> > 
> > Thanks,
> > 
> > Martin
> 
> Hi Martin,
> 
> This new test fails for test variants with -fPIC. ( trunk and gcc-4_9-branch )
> I've confirmed this on ARM, AArch64 and x86_64.
> 
>   FAIL: g++.dg/ipa/pr61540.C -std=gnu++11  scan-ipa-dump cp "Type inconsident devirtualization"
>   FAIL: g++.dg/ipa/pr61540.C -std=gnu++1y  scan-ipa-dump cp "Type inconsident devirtualization"
>   FAIL: g++.dg/ipa/pr61540.C -std=gnu++98  scan-ipa-dump cp "Type inconsident devirtualization"
> 
> I don't understand enough of this area to be more helpful, but I've
> attached the relevant dump and the generated assembly for x86_64 for this
> command:

I had a look at ARM cross and on the input IPA-CP does not have some
clones of constructors there, I assume due to ABI differences.  This
results in different heuristics results and cloning is not performed.
Since the PR was about an ICE, I'm going to remove the dumping test
altogether with the following patch which I hope does fall into the
obvious category.

Thanks,

Martin


2014-06-25  Martin Jambor  <mjambor@suse.cz>

	* g++.dg/ipa/pr61540.C: Remove dumping test.
diff mbox

Patch

diff --git a/gcc/testsuite/g++.dg/ipa/pr61540.C b/gcc/testsuite/g++.dg/ipa/pr61540.C
index d298964..e7dee72 100644
--- a/gcc/testsuite/g++.dg/ipa/pr61540.C
+++ b/gcc/testsuite/g++.dg/ipa/pr61540.C
@@ -1,5 +1,5 @@ 
 /* { dg-do compile } */
-/* { dg-options "-O3 -fno-early-inlining -fdump-ipa-cp" } */
+/* { dg-options "-O3 -fno-early-inlining" } */
 
 struct data {
   data(int) {}
@@ -36,6 +36,3 @@  int main (int argc, char **argv)
   test (c);
   return 0;
 }
-
-/* { dg-final { scan-ipa-dump "Type inconsident devirtualization" "cp" } } */
-/* { dg-final { cleanup-ipa-dump "cp" } } */