libstdc++/2970: complex inserter with extraneous 'ends'

theonetruekenny@yahoo.com theonetruekenny@yahoo.com
Sat May 26 22:36:00 GMT 2001


>Number:         2970
>Category:       libstdc++
>Synopsis:       complex inserter with extraneous 'ends'
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat May 26 22:36:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     theonetruekenny@yahoo.com
>Release:        cvs gcc 5-26-2001
>Organization:
>Environment:
Looking at source code...
>Description:
In the implementation of operator<< for complex<>, there appears to be an extraneous 'ends'.

In line 86 of complex_io.cc is this line:
__s << '(' << __x.real() << "," << __x.imag() << ')' << ends;

This will actually write "(x,y)\0" to the stringbuffer, then the same to the output stream.  This bug was most likely being hidden by bug #2830.

Also note that this 'ends' does not appear in the Standard (or at least the last public draft) in 26.2.6.
>How-To-Repeat:
Observe line 86 of complex_io.cc
>Fix:
remove " << ends" from the line of code.
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list