[cfe-dev] fstream file I/O crash when accessing libstdc++-6 in clang compiled program

Anton Korobeynikov anton at korobeynikov.info
Mon Sep 9 11:40:28 PDT 2013


What is the version of gcc which libstdc++.dll you're using from?

On Mon, Sep 9, 2013 at 8:57 PM, Kim <soldoutseashell at gmail.com> wrote:
> Hey all,
>
> Here's my simple program to demonstrate the issue. This is being compiled
> using clang with the mingw headers in windows.
>
> #include <stdio.h>
> #include <fstream>
>
>     int main( void )
>     {
>         printf("Starting\n");
>
>         std::ofstream ofs("whatever.txt");
>         printf("Stream open\n");
>         ofs << "testing\n";
>         ofs.close();
>         printf("Stream closed\n");
>
>         return 0;
>     }
>
> C:\MinGW\bin>gdb script.exe
> GNU gdb (GDB) 7.5
> Copyright (C) 2012 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later
> <http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
> and "show warranty" for details.
> This GDB was configured as "i686-pc-mingw32".
> For bug reporting instructions, please see:
> <http://www.gnu.org/software/gdb/bugs/>...
> Reading symbols from C:\MinGW\bin\script.exe...done.
> (gdb)
>
> (gdb) run
> run
>
> Starting program: C:\MinGW\bin\script.exe
> [New Thread 9504.0x22a0]
> [New Thread 9504.0x2674]
> Starting
> Stream open
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x6fc87a63 in libstdc++-6!_ZNSo6sentryC1ERSo ()
>    from C:\MinGW\bin\libstdc++-6.dll
> (gdb)
>
> The result is the same compiling the program with clang built using visual
> studio or mingw. Of course, the program runs fine built with mingw g++.
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev



-- 
With best regards, Anton Korobeynikov
Faculty of Mathematics and Mechanics, Saint Petersburg State University



More information about the cfe-dev mailing list