]> gcc.gnu.org Git - gcc.git/commitdiff
re PR c++/41536 (always_inline does not work always with constructors)
authorAndrew Pinski <andrew_pinski@playstation.sony.com>
Fri, 6 Nov 2009 19:10:07 +0000 (19:10 +0000)
committerAndrew Pinski <pinskia@gcc.gnu.org>
Fri, 6 Nov 2009 19:10:07 +0000 (11:10 -0800)
2009-11-06  Andrew Pinski  <andrew_pinski@playstation.sony.com>

        PR c++/41536
        * optimize.c (maybe_clone_body): Copy DECL_ATTRIBUTES and
        DECL_DISREGARD_INLINE_LIMITS also.

2009-11-06  Andrew Pinski  <andrew_pinski@playstation.sony.com>

        PR c++/41536
        * g++.dg/ext/always_inline-5.C: New test.

From-SVN: r153974

gcc/cp/ChangeLog
gcc/cp/optimize.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ext/always_inline-5.C [new file with mode: 0644]

index 21a2221538583cdb9a1426de4e6db13e4580b8f0..6d7fd34cb614b2a6e3a559704bd79a34df78fd62 100644 (file)
@@ -1,3 +1,9 @@
+2009-11-06  Andrew Pinski  <andrew_pinski@playstation.sony.com>
+
+       PR c++/41536
+       * optimize.c (maybe_clone_body): Copy DECL_ATTRIBUTES and
+       DECL_DISREGARD_INLINE_LIMITS also.
+
 2009-11-06  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/41967
index 58d5b9001d2646f23bf7b1723a86740adf238e18..662bd4a22a38d3644ca5ec33b7f881e9c462e82d 100644 (file)
@@ -199,6 +199,8 @@ maybe_clone_body (tree fn)
       DECL_VISIBILITY (clone) = DECL_VISIBILITY (fn);
       DECL_VISIBILITY_SPECIFIED (clone) = DECL_VISIBILITY_SPECIFIED (fn);
       DECL_DLLIMPORT_P (clone) = DECL_DLLIMPORT_P (fn);
+      DECL_ATTRIBUTES (clone) = copy_list (DECL_ATTRIBUTES (fn));
+      DECL_DISREGARD_INLINE_LIMITS (clone) = DECL_DISREGARD_INLINE_LIMITS (fn);
 
       /* Adjust the parameter names and locations.  */
       parm = DECL_ARGUMENTS (fn);
index 5ea0e42aa0432ddb6606acac5eb82d1248cffd5d..1c31757dfbc1dfc206741910fa739b82a4c8de00 100644 (file)
@@ -1,3 +1,8 @@
+2009-11-06  Andrew Pinski  <andrew_pinski@playstation.sony.com>
+
+       PR c++/41536
+       * g++.dg/ext/always_inline-5.C: New test.
+
 2009-11-06  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/41967
diff --git a/gcc/testsuite/g++.dg/ext/always_inline-5.C b/gcc/testsuite/g++.dg/ext/always_inline-5.C
new file mode 100644 (file)
index 0000000..73caa09
--- /dev/null
@@ -0,0 +1,28 @@
+// { dg-do compile }
+struct f
+{
+  inline f(void);
+  inline void f1(void);
+  int a;
+};
+
+inline __attribute__((always_inline))  f::f(void)
+{
+  a++;
+}
+
+inline __attribute__((always_inline)) void  f::f1(void)
+{
+  a++;
+}
+
+void g(void)
+{
+  f a, b, c, d;
+  a.f1();
+}
+
+// f::f() should be inlined even at -O0
+// { dg-final { scan-assembler-not "_ZN1fC1Ev" } }
+// Likewise for f::f1()
+// { dg-final { scan-assembler-not "_ZN1f2f1Ev" } }
This page took 0.079421 seconds and 5 git commands to generate.