This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

large array, ia64, "segmentation fault"


I compile a source , when N=100, everything is good;
but 
when i modify N=1000, i got the info: segmentation
fault. i am using icc 8.1.

My sys info:
RHEL3-64bit update 2.
2.4.21-4.EL kernel
4-way Iatnium2 .
8G RAM.

So, does any one meet the same thing as me? What cause
the error info? And how cuold i do to resolve it?

Thanks !
============================
#include <stdio.h>
#include <sys/time.h>
#include <stdlib.h>

#define  N 1000
void Input(double A[N][N], double B[N][N]);
void MultiplyS(double A[][N], double B[][N], double
C[][N]);

int main()
{
    int i,j,k;
    double A[N][N],B[N][N],C[N][N];
    struct timeval start_time,end_time;
    double  elapsed_time;

    gettimeofday(&start_time,NULL);
    Input(A,B);
    MultiplyS(A,B,C);
    gettimeofday(&end_time,NULL);
   
elapsed_time=1000000*(end_time.tv_sec-start_time.tv_sec)+
end_time.tv_usec-start_time.tv_usec;
    elapsed_time/=1000000;

    printf("Used Time:%f seconds\n",elapsed_time);

    return 0;
}


void Input(double A[N][N],double B[N][N])
{
   int i,j;
   for( i=0; i<N; i++)
     for( j=0; j<N; j++)
     {
       A[i][j] = 1;
       B[i][j] = 0.8;
     }
  }

void MultiplyS(double A[][N], double B[][N], double
C[][N])
{
   int i,j,k;
   for(i=0; i<N; i++)
      for( j=0; j<N; j++)
      {
        C[i][j] = 0;
        for( k=0; k<N; k++)
           C[i][j]+= (A[i][k]* B[k][j]);
      }
}
============================

_________________________________________________________
Do You Yahoo!?
注册世界一流品质的雅虎免费电邮
http://cn.rd.yahoo.com/mail_cn/tag/1g/*http://cn.mail.yahoo.com/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]