Bug 11095 - [3.3 Regression] C++ iostream manipulator causes segfault when called iwth negative argument
Summary: [3.3 Regression] C++ iostream manipulator causes segfault when called iwth ne...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libstdc++ (show other bugs)
Version: 3.3
: P3 normal
Target Milestone: 3.3.1
Assignee: Paolo Carlini
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-06-04 20:39 UTC by Martin D. Weinberg
Modified: 2003-07-25 17:33 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2003-06-04 20:49:41


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin D. Weinberg 2003-06-04 20:39:54 UTC
OS: Debian/GNU Linux "testing" distribution with gcc 3.3 suite

Test code:

#include <iostream>
#include <iomanip>

using namespace std;

int main()
{
   cout << setw(-60) << "This is a test\n";

   return 0;
}


Compile with: g++ -o code code.cc

Segfaults in iostream call under g++-3.3, g++-3.2 but not g++-3.0 or
g++-2.95.


Comment: negative arguments in setw() changed the justification in earlier
versions of the gcc iostream library.  Perhaps a warning should be issued
with negative argument?
Comment 1 Andrew Pinski 2003-06-04 20:49:41 UTC
I cannot reproduce this on the mainline (20030604) and 3.0.4, but I can do on 3.3.1 (20030526) 
and 3.2.3.
Comment 2 Paolo Carlini 2003-06-09 07:03:10 UTC
Fixed for 3.3.1 and 3.4.
Comment 3 Paolo Carlini 2003-06-09 07:03:43 UTC
.