Message "Illegal Instruction".

Post Reply
Klausenner
Posts: 2
Joined: Thu Dec 24, 2009 12:09 pm

Message "Illegal Instruction".

Post by Klausenner » Wed Jan 27, 2010 6:05 pm

I made a program to generate prime numbers, but when I run the S3C2440 get "Illegal Instruction".
When I compile the same program to another platform it works perfectly. even in np ARM9.
Can anyone help me solve this?

Code: Select all

#include <stdio.h>
#include <stdlib.h>

unsigned char teste(int numero)
{
unsigned int metade=0;
unsigned int cont=2;
metade = (numero/2)+1;

for(cont=2;cont <= metade; cont++)
{
 if (numero%cont==0)
 {
	return 0;
	break;
 }

}
return 10;
}

 int main (int argc,char *argv[]){

unsigned  int cont1=5,numPri,inicio;

sscanf(argv[1],"%d",&numPri);

sscanf(argv[2],"%d",&inicio);
printf("calma");

 for(cont1=0;cont1 < numPri;) 
 {

if (teste(inicio))
	{
	printf("O numero %u\n",inicio);
	cont1++;
	}
inicio++;

}

}



Sak1s
Posts: 12
Joined: Thu Mar 26, 2009 3:06 am
Location: Greece

Re: Message "Illegal Instruction".

Post by Sak1s » Thu Jan 28, 2010 1:54 pm

post any details......your gcc -v toolchain output

and its for linux ? or directly to cpu ?

Klausenner
Posts: 2
Joined: Thu Dec 24, 2009 12:09 pm

Re: Message "Illegal Instruction".

Post by Klausenner » Sat Jan 30, 2010 2:24 pm

I solved the problem, I downloaded another compiler
Thank you.

http://www.andahammer.com/Downloads/Flo ... a02971f701

Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests