public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [committed] Workaround for PR c++/52582
@ 2012-03-14 14:32 Jakub Jelinek
  0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2012-03-14 14:32 UTC (permalink / raw)
  To: David Edelsohn, Richard Guenther; +Cc: gcc-patches

Hi!

I've committed the following workaround for PR52582 to 4.7 branch (acked
on IRC by David and Richard) after bootstrapping/regtesting it on
powerpc64-linux (--with-cpu=default32 as well as -m64 defaulted build),
and for trunk committed just the testcase.  Richard committed some fix to
the trunk already, but we still should figure out why the DECL_EXTERNAL
on the devirtualized fndecl isn't set.

2012-03-14  Jakub Jelinek  <jakub@redhat.com>

	PR c++/52582
	* config/rs6000/rs6000.c (call_ABI_of_interest): Return true
	if c_node is NULL.

	* g++.dg/opt/pr52582.C: New test.

--- gcc/config/rs6000/rs6000.c.jj	2012-03-12 10:45:17.000000000 +0100
+++ gcc/config/rs6000/rs6000.c	2012-03-14 11:34:18.043648481 +0100
@@ -7452,6 +7452,9 @@ call_ABI_of_interest (tree fndecl)
       /* Interesting functions that we are emitting in this object file.  */
       c_node = cgraph_get_node (fndecl);
       c_node = cgraph_function_or_thunk_node (c_node, NULL);
+      if (c_node == NULL)
+	return true;
+
       return !cgraph_only_called_directly_p (c_node);
     }
   return false;
--- gcc/testsuite/g++.dg/opt/pr52582.C.jj	2012-03-14 11:29:34.008618924 +0100
+++ gcc/testsuite/g++.dg/opt/pr52582.C	2012-03-14 11:20:26.000000000 +0100
@@ -0,0 +1,28 @@
+// PR c++/52582
+// { dg-do compile }
+// { dg-options "-O2" }
+
+inline void *operator new (__SIZE_TYPE__, void *p) throw ()
+{
+  return p;
+}
+
+struct B
+{
+  virtual ~B ();
+  B ();
+};
+
+struct A : B
+{
+  A () : B () {}
+  virtual void bar ();
+};
+
+void
+foo ()
+{
+  char a[64];
+  B *b = new (&a) A ();
+  b->~B ();
+}

	Jakub

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-03-14 14:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-14 14:32 [committed] Workaround for PR c++/52582 Jakub Jelinek

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).