public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/41536]  New: always_inline does not work always with constructors
@ 2009-10-01 16:17 pinskia at gcc dot gnu dot org
  2009-10-01 17:04 ` [Bug c++/41536] " pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-10-01 16:17 UTC (permalink / raw)
  To: gcc-bugs

The following testcase fails:
// { 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-assembly-not "_ZN1fC1Ev" } }
// Likewise for f::f1()
// { dg-final { scan-assembly-not "_ZN1f2f1Ev" } }

--- CUT ---
_ZN1fC1Ev is being defined in the source still and not being inlined.


-- 
           Summary: always_inline does not work always with constructors
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41536


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/41536] always_inline does not work always with constructors
  2009-10-01 16:17 [Bug c++/41536] New: always_inline does not work always with constructors pinskia at gcc dot gnu dot org
@ 2009-10-01 17:04 ` pinskia at gcc dot gnu dot org
  2009-10-01 17:47 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-10-01 17:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2009-10-01 17:04 -------
Here is the fix I am working for:
Index: optimize.c
===================================================================
--- optimize.c  (revision 152380)
+++ optimize.c  (working copy)
@@ -199,6 +199,7 @@ 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) = DECL_ATTRIBUTES (fn);

       /* Adjust the parameter names and locations.  */
       parm = DECL_ARGUMENTS (fn);


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pinskia at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-10-01 17:04:40
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41536


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/41536] always_inline does not work always with constructors
  2009-10-01 16:17 [Bug c++/41536] New: always_inline does not work always with constructors pinskia at gcc dot gnu dot org
  2009-10-01 17:04 ` [Bug c++/41536] " pinskia at gcc dot gnu dot org
@ 2009-10-01 17:47 ` pinskia at gcc dot gnu dot org
  2009-11-06 19:10 ` pinskia at gcc dot gnu dot org
  2009-11-06 19:12 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-10-01 17:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2009-10-01 17:46 -------
DECL_DISREGARD_INLINE_LIMITS (clone) = DECL_DISREGARD_INLINE_LIMITS (fn);
needs to be done too.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41536


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/41536] always_inline does not work always with constructors
  2009-10-01 16:17 [Bug c++/41536] New: always_inline does not work always with constructors pinskia at gcc dot gnu dot org
  2009-10-01 17:04 ` [Bug c++/41536] " pinskia at gcc dot gnu dot org
  2009-10-01 17:47 ` pinskia at gcc dot gnu dot org
@ 2009-11-06 19:10 ` pinskia at gcc dot gnu dot org
  2009-11-06 19:12 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-11-06 19:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2009-11-06 19:10 -------
Subject: Bug 41536

Author: pinskia
Date: Fri Nov  6 19:10:07 2009
New Revision: 153974

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=153974
Log:
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.



Added:
    trunk/gcc/testsuite/g++.dg/ext/always_inline-5.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/optimize.c
    trunk/gcc/testsuite/ChangeLog


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41536


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/41536] always_inline does not work always with constructors
  2009-10-01 16:17 [Bug c++/41536] New: always_inline does not work always with constructors pinskia at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2009-11-06 19:10 ` pinskia at gcc dot gnu dot org
@ 2009-11-06 19:12 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-11-06 19:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2009-11-06 19:11 -------
Fixed.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.5.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41536


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-11-06 19:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-01 16:17 [Bug c++/41536] New: always_inline does not work always with constructors pinskia at gcc dot gnu dot org
2009-10-01 17:04 ` [Bug c++/41536] " pinskia at gcc dot gnu dot org
2009-10-01 17:47 ` pinskia at gcc dot gnu dot org
2009-11-06 19:10 ` pinskia at gcc dot gnu dot org
2009-11-06 19:12 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).