[vorbis-dev] segfault cause found

Andy Key scsiprog at hotmail.com
Mon Apr 17 06:04:50 PDT 2000



>Win95.  Unfortunately, the encoder_example segfaults.  I get the same
>results from Cygwin as well.

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.

After adding an additional #ifdef to os.h (plus typedefs for int64_t, 
u_int32_t, and int16_t), the library and examples build.  A quick test with 
the examples produced acceptable output.

If anyone is interested, I modified decoder_example.c to write to a WAV file 
instead of just a raw sample.

To get rid of the segfaults, in os.h I replaced

#ifndef alloca
#ifdef _WIN32
#define alloca(x) (_alloca(x))
#endif
#endif

with

#ifndef alloca
#if defined(_WIN32) && !defined(__GNUC__)
#define alloca(x) (_alloca(x))
#endif
#endif

regards,
Andy
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/



More information about the Vorbis-dev mailing list