Hi!

This patch introduces a new effective target check and adds it to the pr64612.C
- if comdat groups aren't used, there is no guarantee that the D2 dtor will
be emitted always alongside of D1 dtor.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2015-01-27  Jakub Jelinek  <ja...@redhat.com>

        PR bootstrap/64612
        * lib/target-supports.exp (check_effective_target_comdat_group): New.
        * g++.dg/ipa/pr64612.C: Guard scan-assembler test with
        { target comdat_group }.

        * doc/sourcebuild.texi (comdat_group): Document.

--- gcc/testsuite/lib/target-supports.exp.jj    2015-01-15 23:39:06.000000000 
+0100
+++ gcc/testsuite/lib/target-supports.exp       2015-01-26 15:24:55.325236098 
+0100
@@ -6198,3 +6198,13 @@ proc check_effective_target_pie_copyrelo
 
     return $pie_copyreloc_available_saved
 }
+
+# Return 1 if the target uses comdat groups.
+
+proc check_effective_target_comdat_group {} {
+    return [check_no_messages_and_pattern comdat_group 
"\.section\[^\n\r]*,comdat" assembly {
+       // C++
+       inline int foo () { return 1; }
+       int (*fn) () = foo;
+    }]
+}
--- gcc/testsuite/g++.dg/ipa/pr64612.C.jj       2015-01-26 15:25:43.301410027 
+0100
+++ gcc/testsuite/g++.dg/ipa/pr64612.C  2015-01-26 15:23:11.380025863 +0100
@@ -1,6 +1,6 @@
 /* { dg-do compile } */
 /* { dg-options "-O3 -std=c++11" } */
-/* { dg-final { scan-assembler "_ZN5QListI7QStringED1Ev" } } */
+/* { dg-final { scan-assembler "_ZN5QListI7QStringED1Ev" { target comdat_group 
} } } */
 
 class A
 {
--- gcc/doc/sourcebuild.texi.jj 2015-01-15 23:39:02.000000000 +0100
+++ gcc/doc/sourcebuild.texi    2015-01-27 16:07:37.504081520 +0100
@@ -1930,6 +1930,9 @@ Target supports @code{wchar_t} that is c
 
 @item wchar_t_char32_t_compatible
 Target supports @code{wchar_t} that is compatible with @code{char32_t}.
+
+@item comdat_group
+Target uses comdat groups.
 @end table
 
 @subsubsection Local to tests in @code{gcc.target/i386}

        Jakub

Reply via email to