[vorbis-dev] segfault cause found
Monty
xiphmont at xiph.org
Tue Apr 18 16:54:39 PDT 2000
> Problem solved! (Or rather, worked around...) The problem with the segfault
> appears to have indeed been with alloca. There is a function _alloca in
> libgcc.a that comes with the mingw32 distribution of gcc-2.95.2. After
> examining the generated assembly code from envelope.c (and others), I found
> that when I left the #define alloca(x) (_alloca(x)) in os.h, it would link
> to this function. If you #ifdef the define out, it would simply subtract
> the required number of bytes off of the stack pointer. I haven't had a
> chance to look at what the _alloca() function is doing in mingw32, but
> removing the #define does the trick.
Ah. MSVC requires _alloca() as a synonym for *NIX alloca(). This must be an
internal function in mingw32 that I shouldn't use.
The obvious fault is me using #ifdef _WIN32 in os.h. Is, perhaps, _MSVC_ or
somethign like that a better idea?
> #ifndef alloca
> #if defined(_WIN32) && !defined(__GNUC__)
> #define alloca(x) (_alloca(x))
> #endif
> #endif
Since we're trying to fix it right, it seems like that could trip us up
eventually too... what do other developers who code for both WIN32/GNU and
their unholy union do?
Monty
--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
More information about the Vorbis-dev
mailing list