This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/17200] New: Reading from a istrstream seg faults when using -malign-double flag


>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;"

-- 
           Summary: Reading from a istrstream seg faults when using -malign-
                    double flag
           Product: gcc
           Version: 2.95.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: peter dot hedinger at st dot com
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: Linux hicks 2.4.7-10custom #4 SMP Thu Nov 28 16:10:26
                    GMT 2002 i


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]