public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/24561]  New: no static definition
@ 2005-10-27 23:47 bkoz at gcc dot gnu dot org
  2005-10-27 23:56 ` [Bug c++/24561] " pinskia at gcc dot gnu dot org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: bkoz at gcc dot gnu dot org @ 2005-10-27 23:47 UTC (permalink / raw)
  To: gcc-bugs

4.0.x and mainline have regressed WRT 3.4.x

  // Ensure freelist is constructed first.
  static int freelist_mutex = 1;

  static void 
  _M_destroy_thread_key(void* __id)
  {  int i = 0; }

  void 
  _M_destroy_thread(void* __id)
  {  int i = 0; }


gives:

%gcc -x c -g -O0 -c testme.cc
%nm testme.o
00000000 d freelist_mutex
0000000f T _M_destroy_thread
00000000 t _M_destroy_thread_key

%gcc -x c++ -g -O0 -c testme.cc
%nm testme.o
00000000 T _Z17_M_destroy_threadPv


-- 
           Summary: no static definition
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bkoz at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

* [Bug c++/24561] no static definition
  2005-10-27 23:47 [Bug c++/24561] New: no static definition bkoz at gcc dot gnu dot org
@ 2005-10-27 23:56 ` pinskia at gcc dot gnu dot org
  2005-10-27 23:58 ` pinskia at gcc dot gnu dot org
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-10-27 23:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2005-10-27 23:56 -------
This is because unit at a time is turned on by default.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mmitchel at gcc dot gnu dot
                   |                            |org


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


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

* [Bug c++/24561] no static definition
  2005-10-27 23:47 [Bug c++/24561] New: no static definition bkoz at gcc dot gnu dot org
  2005-10-27 23:56 ` [Bug c++/24561] " pinskia at gcc dot gnu dot org
@ 2005-10-27 23:58 ` pinskia at gcc dot gnu dot org
  2005-10-28  0:11 ` mmitchel at gcc dot gnu dot org
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-10-27 23:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2005-10-27 23:58 -------
I don't know if this is really can be considered a bug as the static defintions
are unused.  If you want to keep them, you have to use the attribute used.  But
I will let someone else (Mark?) to decide.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |4.0.0 4.1.0
      Known to work|                            |3.4.0


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


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

* [Bug c++/24561] no static definition
  2005-10-27 23:47 [Bug c++/24561] New: no static definition bkoz at gcc dot gnu dot org
  2005-10-27 23:56 ` [Bug c++/24561] " pinskia at gcc dot gnu dot org
  2005-10-27 23:58 ` pinskia at gcc dot gnu dot org
@ 2005-10-28  0:11 ` mmitchel at gcc dot gnu dot org
  2005-10-28  0:24 ` pinskia at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-10-28  0:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from mmitchel at gcc dot gnu dot org  2005-10-28 00:11 -------
I wouldn't call this a regression; I don't think there's any guarantee that
unused statics stay around, even with -O0.  

However, I tend to agree that it would be better if they did stay around at
-O0.  In other words, I wouldn't be opposed to adding such a guarantee.

Do we know if this is a front-end problem or a cgraph problem?  Is cgraph
throwing stuff away at -O0, or are we not telling cgraph about the variable?


-- 


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


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

* [Bug c++/24561] no static definition
  2005-10-27 23:47 [Bug c++/24561] New: no static definition bkoz at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2005-10-28  0:11 ` mmitchel at gcc dot gnu dot org
@ 2005-10-28  0:24 ` pinskia at gcc dot gnu dot org
  2005-10-28  0:50 ` mark at codesourcery dot com
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-10-28  0:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2005-10-28 00:24 -------
(In reply to comment #3)
> I wouldn't call this a regression; I don't think there's any guarantee that
> unused statics stay around, even with -O0.  

It is a regression as turning on unit-at-a-time at -O0 changed it.

> However, I tend to agree that it would be better if they did stay around at
> -O0.  In other words, I wouldn't be opposed to adding such a guarantee.
> Do we know if this is a front-end problem or a cgraph problem? 

I think this is a cgraph issue but that is only because nobody thought unit
at a time would be enabled at -O0 when it was first made.

> Is cgraph
> throwing stuff away at -O0, or are we not telling cgraph about the variable?

cgraph is throwing things away when unit-at-a-time is enabled which is all the
time with C++ in 4.0 and above.


-- 


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


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

* [Bug c++/24561] no static definition
  2005-10-27 23:47 [Bug c++/24561] New: no static definition bkoz at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2005-10-28  0:24 ` pinskia at gcc dot gnu dot org
@ 2005-10-28  0:50 ` mark at codesourcery dot com
  2005-10-28  1:34 ` pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: mark at codesourcery dot com @ 2005-10-28  0:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from mark at codesourcery dot com  2005-10-28 00:50 -------
Subject: Re:  no static definition

pinskia at gcc dot gnu dot org wrote:
> ------- Comment #4 from pinskia at gcc dot gnu dot org  2005-10-28 00:24 -------
> (In reply to comment #3)
> 
>>I wouldn't call this a regression; I don't think there's any guarantee that
>>unused statics stay around, even with -O0.  
> 
> It is a regression as turning on unit-at-a-time at -O0 changed it.

I understand it's a change.  That's different from saying it's a regression.

>>However, I tend to agree that it would be better if they did stay around at
>>-O0.  In other words, I wouldn't be opposed to adding such a guarantee.
>>Do we know if this is a front-end problem or a cgraph problem? 
>
> cgraph is throwing things away when unit-at-a-time is enabled which is all the
> time with C++ in 4.0 and above.

Then, this bug should be changed to be a middle-end bug.


-- 


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


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

* [Bug c++/24561] no static definition
  2005-10-27 23:47 [Bug c++/24561] New: no static definition bkoz at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2005-10-28  0:50 ` mark at codesourcery dot com
@ 2005-10-28  1:34 ` pinskia at gcc dot gnu dot org
  2005-10-28  2:16 ` mark at codesourcery dot com
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-10-28  1:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pinskia at gcc dot gnu dot org  2005-10-28 01:34 -------
(In reply to comment #5)
> I understand it's a change.  That's different from saying it's a regression.

It was an unexpected change really at least as far as I can tell
> Then, this bug should be changed to be a middle-end bug.

Not really as unit at a time is considered an optimization and the C++
front-end just turns it on always.


-- 


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


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

* [Bug c++/24561] no static definition
  2005-10-27 23:47 [Bug c++/24561] New: no static definition bkoz at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2005-10-28  1:34 ` pinskia at gcc dot gnu dot org
@ 2005-10-28  2:16 ` mark at codesourcery dot com
  2006-02-01  1:59 ` [Bug c++/24561] no static definition at -O0 pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: mark at codesourcery dot com @ 2005-10-28  2:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from mark at codesourcery dot com  2005-10-28 02:16 -------
Subject: Re:  no static definition

pinskia at gcc dot gnu dot org wrote:

> Not really as unit at a time is considered an optimization and the C++
> front-end just turns it on always.

I don't think that's accurate.  Rather, the plan is that all front-ends
will switch to using unit-at-a-time unconditionally; they just don't do
that yet.


-- 


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


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

* [Bug c++/24561] no static definition at -O0
  2005-10-27 23:47 [Bug c++/24561] New: no static definition bkoz at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2005-10-28  2:16 ` mark at codesourcery dot com
@ 2006-02-01  1:59 ` pinskia at gcc dot gnu dot org
  2006-04-30 13:56 ` hubicka at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-02-01  1:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from pinskia at gcc dot gnu dot org  2006-02-01 01:59 -------
Confirmed.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-02-01 01:59:22
               date|                            |


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


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

* [Bug c++/24561] no static definition at -O0
  2005-10-27 23:47 [Bug c++/24561] New: no static definition bkoz at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2006-02-01  1:59 ` [Bug c++/24561] no static definition at -O0 pinskia at gcc dot gnu dot org
@ 2006-04-30 13:56 ` hubicka at gcc dot gnu dot org
  2006-04-30 16:50 ` mark at codesourcery dot com
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: hubicka at gcc dot gnu dot org @ 2006-04-30 13:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from hubicka at gcc dot gnu dot org  2006-04-30 13:56 -------
Concerning the comments, unit-at-a-time is not optimization, it is just way
overall compilation is driven.
I don't quite see reason for outputting unneeded static functions even at -O0
that it mostly just slows down the compilation process, but I am testing patch
that makes cgraph believe that every function passed to it should be output
unless it is extern inline and will post it for consideration once testing
converge.

Honza


-- 

hubicka at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |hubicka at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED


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


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

* [Bug c++/24561] no static definition at -O0
  2005-10-27 23:47 [Bug c++/24561] New: no static definition bkoz at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2006-04-30 13:56 ` hubicka at gcc dot gnu dot org
@ 2006-04-30 16:50 ` mark at codesourcery dot com
  2006-05-09 19:19 ` hubicka at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: mark at codesourcery dot com @ 2006-04-30 16:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from mark at codesourcery dot com  2006-04-30 16:50 -------
Subject: Re:  no static definition at -O0

hubicka at gcc dot gnu dot org wrote:

> I don't quite see reason for outputting unneeded static functions even at -O0
> that it mostly just slows down the compilation process, but I am testing patch
> that makes cgraph believe that every function passed to it should be output
> unless it is extern inline and will post it for consideration once testing
> converge.

The reason for emitting all static functions at -O0 is that,
historically, most compilers have done that.  People tend to call these
functions from the debugger.  Of course, in GCC, we have attributes to
say that a function should be kept, even though it's static, but some
other compilers don't, so people tend to rely on the fact that these
functions are emitted when optimization is disabled.

We could document that GCC no longer keeps static functions at -O0.  As
you say, dropping these functions should improve compile times, although
we don't really know by how much.  My guess would be that there aren't
very many unnecessary static functions.

Please do be careful that your patch doesn't cause cgraph to emit all
COMDAT functions.  COMDAT functions (or weak/linkonce) functions should
not be emitted at -O0, if they are not needed, because there tend to be
*tons* of them; that would probably impact compile-time a lot.


-- 


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


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

* [Bug c++/24561] no static definition at -O0
  2005-10-27 23:47 [Bug c++/24561] New: no static definition bkoz at gcc dot gnu dot org
                   ` (9 preceding siblings ...)
  2006-04-30 16:50 ` mark at codesourcery dot com
@ 2006-05-09 19:19 ` hubicka at gcc dot gnu dot org
  2006-05-10 22:54 ` sje at cup dot hp dot com
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: hubicka at gcc dot gnu dot org @ 2006-05-09 19:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from hubicka at gcc dot gnu dot org  2006-05-09 19:19 -------
Fixed in mainline by patch
http://gcc.gnu.org/ml/gcc-patches/2006-05/msg00315.html
(I got the PR number wrong, sorry).

It fixes the functions only, variables still can be optimized out.  Do we wish
to do the same here too?
Comdats should be still elliminated.

Honza


-- 


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


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

* [Bug c++/24561] no static definition at -O0
  2005-10-27 23:47 [Bug c++/24561] New: no static definition bkoz at gcc dot gnu dot org
                   ` (10 preceding siblings ...)
  2006-05-09 19:19 ` hubicka at gcc dot gnu dot org
@ 2006-05-10 22:54 ` sje at cup dot hp dot com
  2006-05-26 18:40 ` mueller at gcc dot gnu dot org
  2006-05-26 18:43 ` pinskia at gcc dot gnu dot org
  13 siblings, 0 replies; 15+ messages in thread
From: sje at cup dot hp dot com @ 2006-05-10 22:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from sje at cup dot hp dot com  2006-05-10 22:54 -------
I believe the patch checked in for this defect is causing
g++.old-deja/g++.other/static14.C and
g++.old-deja/g++.other/static20.C to fail.


-- 

sje at cup dot hp dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sje at cup dot hp dot com


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


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

* [Bug c++/24561] no static definition at -O0
  2005-10-27 23:47 [Bug c++/24561] New: no static definition bkoz at gcc dot gnu dot org
                   ` (11 preceding siblings ...)
  2006-05-10 22:54 ` sje at cup dot hp dot com
@ 2006-05-26 18:40 ` mueller at gcc dot gnu dot org
  2006-05-26 18:43 ` pinskia at gcc dot gnu dot org
  13 siblings, 0 replies; 15+ messages in thread
From: mueller at gcc dot gnu dot org @ 2006-05-26 18:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #13 from mueller at gcc dot gnu dot org  2006-05-26 18:39 -------
It also causes bootstrap failures (see PR18058)


-- 

mueller at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mueller at gcc dot gnu dot
                   |                            |org


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


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

* [Bug c++/24561] no static definition at -O0
  2005-10-27 23:47 [Bug c++/24561] New: no static definition bkoz at gcc dot gnu dot org
                   ` (12 preceding siblings ...)
  2006-05-26 18:40 ` mueller at gcc dot gnu dot org
@ 2006-05-26 18:43 ` pinskia at gcc dot gnu dot org
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-05-26 18:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #14 from pinskia at gcc dot gnu dot org  2006-05-26 18:43 -------
(In reply to comment #13)
> It also causes bootstrap failures (see PR18058)

Can you try bootstrapping with a newer GCC as that problem should have been
fixed (though the orginally problem in that bug still remains as it still fails
with -fkeep-inline-functions and using Sun's CC).

Anyways this has been fixed for 4.2.0 so closing as fixed.


-- 

pinskia at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2006-05-26 18:43 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-27 23:47 [Bug c++/24561] New: no static definition bkoz at gcc dot gnu dot org
2005-10-27 23:56 ` [Bug c++/24561] " pinskia at gcc dot gnu dot org
2005-10-27 23:58 ` pinskia at gcc dot gnu dot org
2005-10-28  0:11 ` mmitchel at gcc dot gnu dot org
2005-10-28  0:24 ` pinskia at gcc dot gnu dot org
2005-10-28  0:50 ` mark at codesourcery dot com
2005-10-28  1:34 ` pinskia at gcc dot gnu dot org
2005-10-28  2:16 ` mark at codesourcery dot com
2006-02-01  1:59 ` [Bug c++/24561] no static definition at -O0 pinskia at gcc dot gnu dot org
2006-04-30 13:56 ` hubicka at gcc dot gnu dot org
2006-04-30 16:50 ` mark at codesourcery dot com
2006-05-09 19:19 ` hubicka at gcc dot gnu dot org
2006-05-10 22:54 ` sje at cup dot hp dot com
2006-05-26 18:40 ` mueller at gcc dot gnu dot org
2006-05-26 18:43 ` 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).