----- Original Message -----
From: "Mr Matthias Von" <mvondavier@...>
Sent: Thursday, December 09, 2004 12:31 AM
Subject: [Mingw-users] C code without error under linux and mingw(gdb)
crashes under mingw only
> I have written some C code that produces an access
> violation error strangely only when compiled under
> mingw and run without gdb.
That is not really strange, as we have seen on this mailing list before.
Many bugs can randomly appear in certain cases, and especially on operating
systems that have different ways of allocating memory.
> The code does some initial set of dynamic allocations
> using malloc() within function calls, assigning the
> returned pointer to global variables of the correct
> type. It works fine under gcc 3.3.x and gcc 3.4.x in
> linux, it works fine when I try the executable under
> mingw within gdb, but it crashes very soon after the
> first malloc in a function when starting the code
> under mingw alone (i.e. outside gdb). Under mingw in
> gdb, it runs fine, but gdb reports an error message
> after everything is done, calculated, and printed out
> when the final free() calls are finished. This error
> does not occur under any other gcc-targets / OS
Errors after freeing are often caused by overflowing a block of dynamically
allocated memory (writing past the end). How large is the source code? If it
is fairly small then perhaps you could post it here, because often people
can see the bug right away.
> In addition, it also works without errors when
> compiled under cygwin, but it does crash exactly as
> under mingw when compiled using cygwin's gcc with the
> option -mno-cygwin.
> Any ideas?