This is the mail archive of the gcc-help@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]

Error in fstream using -malign-double


Can you help me with this one! I have tried for a long time to understand
what is happening. I have tried to build the source with the -malign-double
flag, which did not help much. Plase help me on this one.

----- Forwarded by Oddvard Myrnes/SVG/SCS on 27.12.2001 09:57 -----
                                                                                                                 
                    Oddvard                                                                                      
                    Myrnes               To:     gnu@gnu.org                                                     
                                         cc:                                                                     
                    21.12.2001           Subject:     Error in fstream using -malign-double                      
                    16:23                                                                                        
                                                                                                                 
                                                                                                                 



Hi

I am sorry to write to you directly, but I can't figure out what happens
when this simple program crashes when I use the -malign-double compiler
flag:

// #includes
#include <stdio.h>
#include <iostream.h>
#include <fstream.h>

int main(int argc,char *argv[])
{
        fstream t;

        t.open("./test.log", ios::in|ios::out);
        //t.open("test.log", ios::in|ios::out);
        if(t.fail())
        {
                perror("open");
        }
        else
        {
                char *tt = {"Test record"};
                //t.write(tt, strlen(tt));
                t << tt << endl;
                if(t.fail())
                {
                        perror("write");
                }
        }

    return 0;
}

I am using the GCC dirtibution gcc-2.95.3-52 from Suse.

Can you plase point me in the right direction? Can't find patches for this
error in any of Suse, Redhat or Gnu pages.

This link will show the question I posted on the comp.gnu.hlp forum.

http://groups.google.com/groups?hl=no&group=gnu.gcc&selm=c908370a.0112200448.7e5387fd%40posting.google.com

Rgards
Oddvard Myrnes

Merry Xmas



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