abetts155/OP2_ROSE_Fortran — Issue #4: Generation of kernel subroutines strips compound initialisers
Author: wence-
Created: 2012-02-27 17:32:23+00:00
State: open

If the user-provided kernel has an array initialiser in it, the generated device kernel is invalid.

For example:

```c
void test(double *x)
{
double w[1] = {1};
}
```

comes out the other end as:

```c
void test_modified(double *x)
{
double w[1UL] = ;
}
```

note lack of initialiser.

Here's a complete test case:

test.cpp

```c
#include
#include
#include "op_lib_cpp.h"
#include "test.h"
int main(int argc, char **argv)
{
double *p_xn;
op_init(argc, argv, 5);
int nnode = 4;
op_set nodes = op_decl_set(nnode, "nodes");
op_dat xn = op_decl_dat(nodes, 2, "double", p_xn, "xn");

op_par_loop(test, "test", nodes,
op_arg_dat(xn, 0, OP_ID, 2, "double", OP_READ));

op_exit();
return 0;
}
```
test.h

```c
void test(double *x)
{
double w[1] = {1};
}
```
Then try and build with:
python scripts/Makefile.py --cuda -C