Bug in GCC
naveen yadav
yad.naveen@gmail.com
Mon May 31 10:47:00 GMT 2010
Hi all,
When I compiled below test program using gcc version 4.1.2 20070925 (Red Hat
4.1.2-33) chain it is giving segmentation fault .
*[naveen@localhost ~]$ ./test.out
Segmentation fault*
But the same program is compiled using -O3 flag it is not giving the
segmentation problem.
Plz can any one help to debug this problem??
//test.c
#include<stdio.h>
unsigned long FindCompoundSound(void* pPlayer, void* data, unsigned long
dataLen, unsigned long* formats, unsigned short numFormats,
void** csData, unsigned long* csDataLen)
{
unsigned long foundFormat = 1;
unsigned short bestMatch = 0xFFFF;
unsigned long FI_DeviceSound_CacheMask = 0xFFFF;
unsigned char sData;
unsigned long sFormat= 0xFF;
unsigned long sLength;
unsigned short i;
for (i=0;i<numFormats;i++)
{
if ((formats[i] & FI_DeviceSound_CacheMask) == sFormat)
{
if (i < bestMatch)
{
bestMatch = i;
foundFormat = formats[i];
if (csDataLen)
{
*csDataLen = sLength;
}
}
}
}
}
int main(void)
{
FindCompoundSound(NULL,NULL,1,
NULL,1,NULL,NULL);
return 0;
}
Regards,
Raju G
More information about the Gcc-help
mailing list