Re: [arm-gnu] Fwd: Segmentation fault with arm-2009q3-67 version tool chain
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [arm-gnu] Fwd: Segmentation fault with arm-2009q3-67 version tool chain
- To: raju goruganti <raju.goruganti@xxxxxxxxx>
- Subject: Re: [arm-gnu] Fwd: Segmentation fault with arm-2009q3-67 version tool chain
- From: Norbert Unterberg <nunterberg@xxxxxxxxx>
- Date: Mon, 31 May 2010 13:34:32 +0200
Raju,
your application is faulty, you are dereferencing the NULL pointer.
Fix your code, call the FindCompoundSound() function with valid arguments.
Norbert
2010/5/31 raju goruganti <raju.goruganti@xxxxxxxxx>:
>
> Hi all,
>
>
> When I compiled below test program using arm-2009q3-67 version arm tool
> chain it is giving segmentation fault on Target.
>
> $arm-none-linux-gnueabi-gcc -o test test.c
>
> 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
>
>
>