Bug 17200 - Reading from a istrstream seg faults when using -malign-double flag
Summary: Reading from a istrstream seg faults when using -malign-double flag
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libstdc++ (show other bugs)
Version: 2.95.2
: P2 normal
Target Milestone: 3.0.x
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-08-26 11:55 UTC by Peter Hedinger
Modified: 2005-07-23 22:49 UTC (History)
1 user (show)

See Also:
Host: i686-pc-linux-gnu
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Hedinger 2004-08-26 11:55:46 UTC
>g++ -v
Reading specs from /pd/gcc/2.95.2/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/specs
gcc version 2.95.2 19991024 (release)

--------------------------- test.cpp ------------------------
#include <iostream>
#include <strstream>
using namespace std;

int main( ) 
{
    char *tmp = "This is a test";
    char tag[100];
    tag[0] = '\0';
    
    istrstream inputStream((const char*)tmp);
    inputStream >> tag;
    cout << tag << endl;
}
-------------------------------- Works ------------------------
> g++ test.cpp
> ./a.out
This
-------------------------------- Crashes ----------------------
> g++ -malign-double test.cpp
> ./a.out
Segmentation fault
-------------------------------- Cause ------------------------
The bit that causes the seg fault is "inputStream >> tag;"
Comment 1 Paolo Carlini 2004-08-26 12:12:52 UTC
The problem cannot be reproduce with gcc3.3.x and gcc3.4.1. Gcc 2.95.2 is *very*
old and no longer maintained, please consider updating your tools.
Comment 2 Volker Reichelt 2004-08-26 12:41:16 UTC
Reopen ...
Comment 3 Volker Reichelt 2004-08-26 12:41:49 UTC
... to close as fixed.