public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/15485] New: [tree-ssa] The C++ front-end generates a lot of (void) casts for statements
@ 2004-05-17 19:29 dann at godzilla dot ics dot uci dot edu
  2004-05-17 19:29 ` [Bug c++/15485] " pinskia at gcc dot gnu dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: dann at godzilla dot ics dot uci dot edu @ 2004-05-17 19:29 UTC (permalink / raw)
  To: gcc-bugs

The .original dump for C++ files contains a lot of (void) casts, that are
probably  not needed, they increase the memory footprint. 

For example: 

;; Function std::_Refcount_Base::_Refcount_Base(size_t)  
{
   (void)((this)->_M_ref_count = __n);
   {
      struct pthread_mutex* __tmp = 0u
      (void)((this)->_M_ref_count_lock = __tmp);
   }
}

For the testcase in PR8361, the .generic dump has ~15000 statements, and ~3000
of them start with (void)

-- 
           Summary: [tree-ssa] The C++ front-end generates a lot of (void)
                    casts for statements
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dann at godzilla dot ics dot uci dot edu
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c++/15485] [tree-ssa] The C++ front-end generates a lot of (void) casts for statements
  2004-05-17 19:29 [Bug c++/15485] New: [tree-ssa] The C++ front-end generates a lot of (void) casts for statements dann at godzilla dot ics dot uci dot edu
@ 2004-05-17 19:29 ` pinskia at gcc dot gnu dot org
  2004-05-17 19:30 ` pinskia at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-17 19:29 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-05-17 04:47 -------
Confirmed, here is a small example:
  struct _Refcount_Base
{
  volatile int _M_ref_count;
  void *_M_ref_count_lock;
  _Refcount_Base(int);
};
_Refcount_Base::_Refcount_Base (int __n): _M_ref_count(__n)
{
void *__tmp = 0;
_M_ref_count_lock = __tmp;
}

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |memory-hog
   Last reconfirmed|0000-00-00 00:00:00         |2004-05-17 04:47:28
               date|                            |


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


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

* [Bug c++/15485] [tree-ssa] The C++ front-end generates a lot of (void) casts for statements
  2004-05-17 19:29 [Bug c++/15485] New: [tree-ssa] The C++ front-end generates a lot of (void) casts for statements dann at godzilla dot ics dot uci dot edu
  2004-05-17 19:29 ` [Bug c++/15485] " pinskia at gcc dot gnu dot org
@ 2004-05-17 19:30 ` pinskia at gcc dot gnu dot org
  2004-08-11 22:07 ` pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-17 19:30 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-05-17 04:49 -------
Here is another example:
  struct _Refcount_Base
{
  volatile int _M_ref_count;
  void *_M_ref_count_lock;
  void _Refcount_Base1(int);
};
void _Refcount_Base::_Refcount_Base1 (int __n)
{
_M_ref_count = __n;
void *__tmp = 0;
_M_ref_count_lock = __tmp;
}

-- 


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


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

* [Bug c++/15485] [tree-ssa] The C++ front-end generates a lot of (void) casts for statements
  2004-05-17 19:29 [Bug c++/15485] New: [tree-ssa] The C++ front-end generates a lot of (void) casts for statements dann at godzilla dot ics dot uci dot edu
  2004-05-17 19:29 ` [Bug c++/15485] " pinskia at gcc dot gnu dot org
  2004-05-17 19:30 ` pinskia at gcc dot gnu dot org
@ 2004-08-11 22:07 ` pinskia at gcc dot gnu dot org
  2004-08-11 22:23 ` dann at godzilla dot ics dot uci dot edu
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-11 22:07 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-11 22:07 -------
This has been fixed, for how long I do not know.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |3.5.0


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


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

* [Bug c++/15485] [tree-ssa] The C++ front-end generates a lot of (void) casts for statements
  2004-05-17 19:29 [Bug c++/15485] New: [tree-ssa] The C++ front-end generates a lot of (void) casts for statements dann at godzilla dot ics dot uci dot edu
                   ` (2 preceding siblings ...)
  2004-08-11 22:07 ` pinskia at gcc dot gnu dot org
@ 2004-08-11 22:23 ` dann at godzilla dot ics dot uci dot edu
  2004-08-11 22:26 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: dann at godzilla dot ics dot uci dot edu @ 2004-08-11 22:23 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dann at godzilla dot ics dot uci dot edu  2004-08-11 22:23 -------
Are you sure? 

I still see a lot of void casts in .original for the testcase in PR8361 




-- 


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


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

* [Bug c++/15485] [tree-ssa] The C++ front-end generates a lot of (void) casts for statements
  2004-05-17 19:29 [Bug c++/15485] New: [tree-ssa] The C++ front-end generates a lot of (void) casts for statements dann at godzilla dot ics dot uci dot edu
                   ` (3 preceding siblings ...)
  2004-08-11 22:23 ` dann at godzilla dot ics dot uci dot edu
@ 2004-08-11 22:26 ` pinskia at gcc dot gnu dot org
  2004-08-23  6:07 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-11 22:26 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-11 22:26 -------
Maybe I have to relook at that then.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |


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


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

* [Bug c++/15485] [tree-ssa] The C++ front-end generates a lot of (void) casts for statements
  2004-05-17 19:29 [Bug c++/15485] New: [tree-ssa] The C++ front-end generates a lot of (void) casts for statements dann at godzilla dot ics dot uci dot edu
                   ` (4 preceding siblings ...)
  2004-08-11 22:26 ` pinskia at gcc dot gnu dot org
@ 2004-08-23  6:07 ` pinskia at gcc dot gnu dot org
  2004-08-23  6:09 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-23  6:07 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-23 06:07 -------
Most have been fixed it looks like, but there is still at least one left:
std::_Bit_iterator std::_Bit_iterator::operator++(int) (this, <D28444>)
{       
  struct _Bit_iterator_base * T.776;
        
  {       
    struct _Bit_iterator __tmp;
          
    (void)0;
    <retval> = *this;
    T.776 = &this-><D28479>;
    _M_bump_up (T.776);
    return <retval>;
  }   
}   

I will see if I can get a short testcase soon.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |NEW


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


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

* [Bug c++/15485] [tree-ssa] The C++ front-end generates a lot of (void) casts for statements
  2004-05-17 19:29 [Bug c++/15485] New: [tree-ssa] The C++ front-end generates a lot of (void) casts for statements dann at godzilla dot ics dot uci dot edu
                   ` (5 preceding siblings ...)
  2004-08-23  6:07 ` pinskia at gcc dot gnu dot org
@ 2004-08-23  6:09 ` pinskia at gcc dot gnu dot org
  2004-08-23  6:14 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-23  6:09 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|3.5.0                       |---


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


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

* [Bug c++/15485] [tree-ssa] The C++ front-end generates a lot of (void) casts for statements
  2004-05-17 19:29 [Bug c++/15485] New: [tree-ssa] The C++ front-end generates a lot of (void) casts for statements dann at godzilla dot ics dot uci dot edu
                   ` (6 preceding siblings ...)
  2004-08-23  6:09 ` pinskia at gcc dot gnu dot org
@ 2004-08-23  6:14 ` pinskia at gcc dot gnu dot org
  2004-11-22  2:37 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-23  6:14 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-23 06:14 -------
And here is reduced testcase for the newest one I see:
struct iterator {
  int i;
  iterator operator++(int) {
    iterator __tmp = *this;
    _M_bump_up();
    return __tmp;
  }
  void _M_bump_up();
};
iterator t, t1;
void g(){t1 = t++;}

-- 


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


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

* [Bug c++/15485] [tree-ssa] The C++ front-end generates a lot of (void) casts for statements
  2004-05-17 19:29 [Bug c++/15485] New: [tree-ssa] The C++ front-end generates a lot of (void) casts for statements dann at godzilla dot ics dot uci dot edu
                   ` (7 preceding siblings ...)
  2004-08-23  6:14 ` pinskia at gcc dot gnu dot org
@ 2004-11-22  2:37 ` pinskia at gcc dot gnu dot org
  2005-01-10  5:42 ` pinskia at gcc dot gnu dot org
  2005-01-10  5:45 ` pinskia at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-22  2:37 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-11-22 02:36 -------
A more reduced testcase:
struct iterator {
  int i;
  iterator operator++(int);
  void _M_bump_up();
};
iterator iterator::operator++(int) {
  iterator __tmp = *this;
  _M_bump_up();
  return __tmp;
}

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2004-05-17 04:47:28         |2004-11-22 02:36:57
               date|                            |


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


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

* [Bug c++/15485] [tree-ssa] The C++ front-end generates a lot of (void) casts for statements
  2004-05-17 19:29 [Bug c++/15485] New: [tree-ssa] The C++ front-end generates a lot of (void) casts for statements dann at godzilla dot ics dot uci dot edu
                   ` (8 preceding siblings ...)
  2004-11-22  2:37 ` pinskia at gcc dot gnu dot org
@ 2005-01-10  5:42 ` pinskia at gcc dot gnu dot org
  2005-01-10  5:45 ` pinskia at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-10  5:42 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-01-10 05:42 -------
(In reply to comment #8)
> A more reduced testcase:
This comes from finalize_nrv_r.  There might be a better way of doing that.
      else
        init = build_empty_stmt ();
      SET_EXPR_LOCUS (init, EXPR_LOCUS (*tp));
      *tp = init;

Maybe a better walker which then is able to remove statements in a STATEMENT_LIST.

-- 


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


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

* [Bug c++/15485] [tree-ssa] The C++ front-end generates a lot of (void) casts for statements
  2004-05-17 19:29 [Bug c++/15485] New: [tree-ssa] The C++ front-end generates a lot of (void) casts for statements dann at godzilla dot ics dot uci dot edu
                   ` (9 preceding siblings ...)
  2005-01-10  5:42 ` pinskia at gcc dot gnu dot org
@ 2005-01-10  5:45 ` pinskia at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-10  5:45 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-01-10 05:45 -------
(In reply to comment #9)
> Maybe a better walker which then is able to remove statements in a STATEMENT_LIST.

In fact doing this will reduce the memory usage for the most common C++ code as it shows up even in 
the STL headers as shown by my reduced testcase.

-- 


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


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

end of thread, other threads:[~2005-01-10  5:45 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-17 19:29 [Bug c++/15485] New: [tree-ssa] The C++ front-end generates a lot of (void) casts for statements dann at godzilla dot ics dot uci dot edu
2004-05-17 19:29 ` [Bug c++/15485] " pinskia at gcc dot gnu dot org
2004-05-17 19:30 ` pinskia at gcc dot gnu dot org
2004-08-11 22:07 ` pinskia at gcc dot gnu dot org
2004-08-11 22:23 ` dann at godzilla dot ics dot uci dot edu
2004-08-11 22:26 ` pinskia at gcc dot gnu dot org
2004-08-23  6:07 ` pinskia at gcc dot gnu dot org
2004-08-23  6:09 ` pinskia at gcc dot gnu dot org
2004-08-23  6:14 ` pinskia at gcc dot gnu dot org
2004-11-22  2:37 ` pinskia at gcc dot gnu dot org
2005-01-10  5:42 ` pinskia at gcc dot gnu dot org
2005-01-10  5:45 ` 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).