Hi,
the attached program segfaults when using a larger local variable.
Depending on used value I get segfaulst at different locations.
//#define BUFSIZE (9*1024*1024-16*1024) // only segfault
#define BUFSIZE (8*1024*1024-16*1024) // hello + segfault
//#define BUFSIZE (8*1024*1024-32*1024) // hello + 2nd line
When using last definition of BUFSIZE every thing is fine.
[EMAIL PROTECTED] /home/nfs/extra/src/video/DVB/xlist $ ./test
Speicherzugriffsfehler
[EMAIL PROTECTED] /home/nfs/extra/src/video/DVB/xlist $ vi test.cc
[EMAIL PROTECTED] /home/nfs/extra/src/video/DVB/xlist $ g++ -g test.cc -o
test
[EMAIL PROTECTED] /home/nfs/extra/src/video/DVB/xlist $ ./test
hello
./test: argc = 1
[EMAIL PROTECTED] /home/nfs/extra/src/video/DVB/xlist $ vi test.cc
[EMAIL PROTECTED] /home/nfs/extra/src/video/DVB/xlist $ g++ -g test.cc -o
test
[EMAIL PROTECTED] /home/nfs/extra/src/video/DVB/xlist $ ./test
hello
Speicherzugriffsfehler
[EMAIL PROTECTED] /home/nfs/extra/src/video/DVB/xlist $ ./test
[EMAIL PROTECTED] /home/nfs/extra/src/video/DVB/xlist $ ulimit
unlimited
[EMAIL PROTECTED] /home/nfs/extra/src/video/DVB/xlist $ gcc --version
gcc (GCC) 4.1.2 (Gentoo 4.1.2 p1.1)
Copyright (C) 2006 Free Software Foundation, Inc.
Dies ist freie Software; die Kopierbedingungen stehen in den Quellen. Es
gibt KEINE Garantie; auch nicht für MARKTGÄNGIGKEIT oder FÜR SPEZIELLE ZWECKE.
--
Stefan Lucke
#include
#include
#include
#include
#include
#include
#include
//XXX #define BUFSIZE 256*1024
//
//#define BUFSIZE 20*1024*1024
//#define BUFSIZE (9*1024*1024-16*1024) // only segfault
#define BUFSIZE (8*1024*1024-16*1024) // hello + segfault
//#define BUFSIZE (8*1024*1024-32*1024) // hello + 2nd line
#define DUMP 1
#ifdef DUMP
#define DBG(expr) expr;
#else
#define DBG(expr) {}
#endif
typedef unsigned long tPTS;
int main(int argc, char *argv[])
{
fprintf(stderr, "hello\n");
fprintf(stderr, "%s: argc = %d\n", argv[0], argc);
{
unsigned char a [BUFSIZE];
}
return 1;
}
___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr