re PR c++/6352 (GCC 3.1 inliner regression from March)
authorMark Mitchell <mark@codesourcery.com>
Fri, 19 Apr 2002 16:21:58 +0000 (16:21 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Fri, 19 Apr 2002 16:21:58 +0000 (16:21 +0000)
PR c++/6352
* toplev.c (rest_of_compilation): Do not defer functions for which
TREE_SYMBOL_REFERENCED has already been set.

* PR6352
* g++.dg/opt/inline2.C: New test.

From-SVN: r52521

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/opt/inline2.C [new file with mode: 0644]
gcc/toplev.c

index 0571b4e0ad248bcc64e698a31330baf48a095439..579cdf6802bc11b1ad6fbe8f3a34cae1f2de321e 100644 (file)
@@ -1,3 +1,9 @@
+2002-04-19  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/6352
+       * toplev.c (rest_of_compilation): Do not defer functions for which
+       TREE_SYMBOL_REFERENCED has already been set.
+
 Fri Apr 19 15:53:03 CEST 2002  Jan Hubicka  <jh@suse.cz>
 
        * i386.md (movsi_1, movhi_1): Force reload to use more flexible
index 60b580ea6967ede3fe56355ff39d7c35ef54e769..8cf71e96409ee63c99c40001af654bd58ed3a66b 100644 (file)
@@ -1,3 +1,8 @@
+2002-04-19  Mark Mitchell  <mark@codesourcery.com>
+
+       * PR6352
+       * g++.dg/opt/inline2.C: New test.
+
 2002-04-18  Richard Henderson  <rth@redhat.com>
 
         * gcc.dg/20000906-1.c: Enable for all targets.
diff --git a/gcc/testsuite/g++.dg/opt/inline2.C b/gcc/testsuite/g++.dg/opt/inline2.C
new file mode 100644 (file)
index 0000000..6e6889f
--- /dev/null
@@ -0,0 +1,18 @@
+// { dg-do link }
+// { dg-options "-O1 -finline-functions" }
+
+static void g ();
+
+void f()
+{
+  void g();
+  g();
+}
+
+void g()
+{
+}
+
+int main () {
+  f ();
+}
index 3fe01db5b8771b661e4297e362b843cbf45584cb..fa8e2893a54428dd1ff78e34c8cfe3a476a41b48 100644 (file)
@@ -2374,6 +2374,7 @@ rest_of_compilation (decl)
       if (inlinable
          || (DECL_INLINE (decl)
              && ((! TREE_PUBLIC (decl) && ! TREE_ADDRESSABLE (decl)
+                  && ! TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))
                   && ! flag_keep_inline_functions)
                  || DECL_EXTERNAL (decl))))
        DECL_DEFER_OUTPUT (decl) = 1;