Bug in GCC

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux