On 06 Apr 20:41, Jan Hubicka wrote:
> > 2015-04-03 20:12 GMT+03:00 Jan Hubicka <hubi...@ucw.cz>:
> > >>
> > >> Currently ipa_comdats doesn't set comdat groups for thunks. At the
> > >
> > > I see, that is a bug.  It is supposed to keep thunks in the same section
> > > as their target (thunks doesn't really work across sections on some 
> > > target,
> > > like PPC, because there is no way to produce a tailcall)
> > > Does the following fix the problem?
> > 
> > I believe this should help.  Will try it.
> If it passes testing, the patch is preapproved.
> 
> Thanks!
> Honza

Here is a committed version.

Thanks,
Ilya
--
diff --git a/gcc/ipa-comdats.c b/gcc/ipa-comdats.c
index f349f9f..e24359c 100644
--- a/gcc/ipa-comdats.c
+++ b/gcc/ipa-comdats.c
@@ -377,7 +377,7 @@ ipa_comdats (void)
              fprintf (dump_file, "To group: %s\n", IDENTIFIER_POINTER (group));
            }
          if (is_a <cgraph_node *> (symbol))
-          dyn_cast <cgraph_node *>(symbol)->call_for_symbol_and_aliases
+          dyn_cast <cgraph_node *>(symbol)->call_for_symbol_thunks_and_aliases
                  (set_comdat_group_1,
                   *comdat_head_map.get (group),
                   true);
diff --git a/gcc/testsuite/gcc.target/i386/mpx/chkp-thunk-comdat-1.cc 
b/gcc/testsuite/gcc.target/i386/mpx/chkp-thunk-comdat-1.cc
new file mode 100644
index 0000000..26d3c48
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/mpx/chkp-thunk-comdat-1.cc
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fcheck-pointer-bounds -mmpx" } */
+
+namespace
+{
+  template <int dim>
+  int __attribute__((noinline))
+  f1 ()
+  {
+    return dim;
+  }
+}
+
+int
+test ()
+{
+  return f1<3> ();
+}
diff --git a/gcc/testsuite/gcc.target/i386/mpx/chkp-thunk-comdat-2.cc 
b/gcc/testsuite/gcc.target/i386/mpx/chkp-thunk-comdat-2.cc
new file mode 100644
index 0000000..2b1abe9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/mpx/chkp-thunk-comdat-2.cc
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fcheck-pointer-bounds -mmpx" } */
+
+class c1
+{
+public:
+  virtual int test1 (const char *);
+};
+
+class c2
+{
+public:
+  int test2 (const char *);
+};
+
+int
+c1::test1 (const char *)
+{
+  return 0;
+}
+
+int
+c2::test2 (const char *)
+{
+  return 0;
+}

Reply via email to