]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/43611 (ICE: SIGSEGV with -fipa-cp-clone -fkeep-inline-functions)
authorRichard Guenther <rguenther@suse.de>
Mon, 12 Apr 2010 09:52:50 +0000 (09:52 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 12 Apr 2010 09:52:50 +0000 (09:52 +0000)
2010-04-12  Richard Guenther  <rguenther@suse.de>

PR c++/43611
* semantics.c (expand_or_defer_fn_1): Do not keep extern
template inline functions.

* g++.dg/torture/pr43611.C: New testcase.

From-SVN: r158218

gcc/cp/ChangeLog
gcc/cp/semantics.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/torture/pr43611.C [new file with mode: 0644]

index c40e368f46c871c474064bc40c5c3cb5e6e9c819..e56c77c35a5374d58b3464b8cf60a3ffb91a3f83 100644 (file)
@@ -1,3 +1,9 @@
+2010-04-12  Richard Guenther  <rguenther@suse.de>
+
+       PR c++/43611
+       * semantics.c (expand_or_defer_fn_1): Do not keep extern
+       template inline functions.
+
 2010-04-09  Manuel López-Ibáñez  <manu@gcc.gnu.org>
 
        PR c++/28584
index d425402e3ce868e17697fd777c27470729fc5728..66d152de8b8bdbde255227d8ab406a362ba2c310 100644 (file)
@@ -3446,7 +3446,9 @@ expand_or_defer_fn_1 (tree fn)
         this function as needed so that finish_file will make sure to
         output it later.  Similarly, all dllexport'd functions must
         be emitted; there may be callers in other DLLs.  */
-      if ((flag_keep_inline_functions && DECL_DECLARED_INLINE_P (fn))
+      if ((flag_keep_inline_functions
+          && DECL_DECLARED_INLINE_P (fn)
+          && !DECL_REALLY_EXTERN (fn))
          || lookup_attribute ("dllexport", DECL_ATTRIBUTES (fn)))
        mark_needed (fn);
     }
index d5cddd4cf345dba9175d6e452b9627cfe4c87b13..547ea328e2e5cc9cbbd24f943b124dd122d5af6b 100644 (file)
@@ -1,3 +1,8 @@
+2010-04-12  Richard Guenther  <rguenther@suse.de>
+
+       PR c++/43611
+       * g++.dg/torture/pr43611.C: New testcase.
+
 2010-04-12  Shujing Zhao  <pearly.zhao@oracle.com>
 
        PR c/36774
diff --git a/gcc/testsuite/g++.dg/torture/pr43611.C b/gcc/testsuite/g++.dg/torture/pr43611.C
new file mode 100644 (file)
index 0000000..6899a6e
--- /dev/null
@@ -0,0 +1,22 @@
+// { dg-do compile }
+// { dg-options "-fkeep-inline-functions" }
+
+template < typename >
+struct A {
+  void init (int);
+  A ()
+  {
+    this->init (0);
+  }
+};
+
+template < typename >
+struct B : A < int > {
+  A < int > a;
+  B () {}
+};
+
+extern template struct A < int >;
+extern template struct B < int >;
+
+B < int > b;