#303 std::fstream in struct/class -> crash

open
nobody
None
5
2012-06-03
2012-06-03
Pillum
No

Hello,

I don't know why, but this scenario crashes for me with gcc 4.7.0 rubenvb on Windows 8 x64:
"#include <fstream>
struct Testfile
{
std::fstream t;
}
int main()
{
Testfile t;
}"

backtrace:

#0 6FCB8F96 ?? () (??:??)
#1 004013ED __tmainCRTStartup() (/home/ruben/mingw-w64/toolchain/src/mingw-w64/tags/v2.0.3/mingw-w64-crt/crt/crtexe.c:307)
#2 75C0DE7D ?? () (??:??)
#3 77AE4B54 ?? () (??:??)
#4 77AE4B27 ?? () (??:??)
#5 ?? ?? () (??:??)

When using "Step Into" with GDB 7.4.1 till it crashes, it stops here:
<fstream>
basic_fstream()
: __iostream_type(), _M_filebuf()
{ this->init(&_M_filebuf); }

Discussion

  • Pillum

    Pillum - 2012-06-04

    also, it only happens in release mode, so with '-g' flag its not crashing

     
    • Christopher D

      Christopher D - 2016-08-15

      It's not -g flag that makes it not crash. It crashes with optimized for speed (-O/-O1/-O2/-O3) flag.

       

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks