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

Subversion Repositories openrisc

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

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 694 jeremybenn
#define NUM_ELEMS 10
2
#define NUM_ROWS 2
3
#define NUM_COLS 3
4
 
5
void test_long_long_1d(int *array, int num_elems);
6
void test_long_long_2d(int *array, int num_rows, int num_cols);
7
void test_long_1d(int *array, int num_elems);
8
void test_int_1d(int *array, int num_elems);
9
void test_short_1d(int *array, int num_elems);
10
void test_mixed(int *array, int num_elems);
11
 
12
int main(int argc, char **argv)
13
{
14
  int my_array[NUM_ELEMS];
15
  int my_2d_array[NUM_ROWS][NUM_COLS];
16
  int i, j;
17
 
18
  for(i = 0; i < NUM_ELEMS; i++)
19
    my_array[i] = i;
20
 
21
  for(i = 0; i < NUM_ROWS; i++)
22
    for(j = 0; j < NUM_COLS; j++)
23
      my_2d_array[i][j] = (i*NUM_COLS) + j;
24
 
25
  /* Test c_f_pointer where SHAPE is of type integer, kind=c_long_long.  */
26
  test_long_long_1d(my_array, NUM_ELEMS);
27
 
28
  /* Test c_f_pointer where SHAPE is of type integer, kind=c_long_long.
29
     The indices are transposed for Fortran.  */
30
  test_long_long_2d(my_2d_array[0], NUM_COLS, NUM_ROWS);
31
 
32
  /* Test c_f_pointer where SHAPE is of type integer, kind=c_long.  */
33
  test_long_1d(my_array, NUM_ELEMS);
34
 
35
  /* Test c_f_pointer where SHAPE is of type integer, kind=c_int.  */
36
  test_int_1d(my_array, NUM_ELEMS);
37
 
38
  /* Test c_f_pointer where SHAPE is of type integer, kind=c_short.  */
39
  test_short_1d(my_array, NUM_ELEMS);
40
 
41
  /* Test c_f_pointer where SHAPE is of type integer, kind=c_int and
42
          kind=c_long_long.  */
43
  test_mixed(my_array, NUM_ELEMS);
44
 
45
  return 0;
46
}

powered by: WebSVN 2.1.0

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