------- Additional Comments From dahowell at directv dot com  2005-06-23 23:48 
-------
Created an attachment (id=9138)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=9138&action=view)
Short test file which demonstrates optimization failuer

This is pretty much what was left of basic_string.h after I removed all the
code which was not needed to cause the bug to happen.  For the curious, S was
derived from the basic_string template, A was derived from the allocator
object, and p used to be the _M_rep pointer to the basic_string::_Rep
structure.  S::init was once basic_string::append.

The function do_nothing was once the allocator's dispose method, but as you can
see it now truly should do nothing.  But it doesn't quite do nothing, it causes
the optimizer to fail when optimizing for size.  The seemingly pointless
static_cast<A> also is needed to cause the bug.  Inlining either S::init or
do_nothing will also make the bug magically disappear.

-- 


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

Reply via email to