OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gfortran.dg/] [c_f_tests_driver.c] - Blame information for rev 694

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 694 jeremybenn
extern void abort(void);
2
 
3
typedef struct myCDerived
4
{
5
   int cInt;
6
   double cDouble;
7
   float cFloat;
8
   short cShort;
9
   void *ptr;
10
}myCDerived_t;
11
 
12
#define DERIVED_ARRAY_LEN 10
13
#define ARRAY_LEN_2 3
14
#define DIM1 2
15
#define DIM2 3
16
 
17
void testDerivedPtrs(myCDerived_t *cDerivedPtr,
18
                     myCDerived_t *derivedArray, int arrayLen,
19
                     myCDerived_t *derived2d, int dim1, int dim2);
20
 
21
int main(int argc, char **argv)
22
{
23
   myCDerived_t cDerived;
24
   myCDerived_t derivedArray[DERIVED_ARRAY_LEN];
25
   myCDerived_t derived2DArray[DIM1][DIM2];
26
   int i = 0;
27
   int j = 0;
28
 
29
   cDerived.cInt = 1;
30
   cDerived.cDouble = 2.0;
31
   cDerived.cFloat = 3.0;
32
   cDerived.cShort = 4;
33
/*    cDerived.ptr = NULL; */
34
   /* nullify the ptr */
35
   cDerived.ptr = 0;
36
 
37
   for(i = 0; i < DERIVED_ARRAY_LEN; i++)
38
   {
39
      derivedArray[i].cInt = (i+1) * 1;
40
      derivedArray[i].cDouble = (i+1) * 1.0; /* 2.0; */
41
      derivedArray[i].cFloat = (i+1) * 1.0; /* 3.0; */
42
      derivedArray[i].cShort = (i+1) * 1; /* 4; */
43
/*       derivedArray[i].ptr = NULL; */
44
      derivedArray[i].ptr = 0;
45
   }
46
 
47
   for(i = 0; i < DIM1; i++)
48
   {
49
      for(j = 0; j < DIM2; j++)
50
      {
51
         derived2DArray[i][j].cInt = ((i*DIM1) * 1) + j;
52
         derived2DArray[i][j].cDouble = ((i*DIM1) * 1.0) + j;
53
         derived2DArray[i][j].cFloat = ((i*DIM1) * 1.0) + j;
54
         derived2DArray[i][j].cShort = ((i*DIM1) * 1) + j;
55
/*          derived2DArray[i][j].ptr = NULL; */
56
         derived2DArray[i][j].ptr = 0;
57
      }
58
   }
59
 
60
   /* send in the transpose size (dim2 is dim1, dim1 is dim2) */
61
   testDerivedPtrs(&cDerived, derivedArray, DERIVED_ARRAY_LEN,
62
                   derived2DArray[0], DIM2, DIM1);
63
 
64
   return 0;
65
}/* end main() */
66
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.