﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
3242	Failure to compile generated code due to type mismatch	Gustaf Thorslund	Mahder Alemseged Gebremedhin	"When trying out the ocl* functions in ParModelica I ran into issues compiling the generated code. This might be related to bug #3214, but for ParModelica this time.

To start with the test code (that should probably be extended to cover more of the ocl* functions):
{{{#!mo
/// oclTest.mo
package oclTest
  
  constant Integer globalSizes = 10;
  constant Integer localSizes = 2;

  parkernel function Kernel
    parglobal output Integer groupId[globalSizes];
    parglobal output Integer localId[globalSizes];
  algorithm
    groupId[oclGetGlobalId(1)] := oclGetGroupId(1);
    localId[oclGetGlobalId(1)] := oclGetLocalId(1);
  end Kernel;
  
  function test
    output Integer groupId[globalSizes];
    output Integer localId[globalSizes];
  algorithm
    oclSetNumThreadsGlobalLocal1D({globalSizes}, {localSizes});
    (groupId, localId) := Kernel();
  end test;
end oclTest;
}}}

Then a little script:
{{{
/// oclTest.mos
loadFile(""oclTest.mo"");
getErrorString();

(x,y):=oclTest.test();
getErrorString();
}}}

Then try to build and run the test script:
{{{
$ omc -g=ParModelica oclTest.mos
true
""""
Error processing file: oclTest.mos
Error: Error building simulator. Build log: g++ -I""/home/gustaf/local/openmodelica/include/omc/c""   -fPIC -O0 -falign-functions -march=native   -c -o oclTest_test.o oclTest_test.c
oclTest_test.c: In function ‘integer_array omc_oclTest_test(threadData_t*, integer_array*)’:
oclTest_test.c:35:46: error: cannot convert ‘base_array_t* {aka base_array_s*}’ to ‘device_integer_array* {aka dev_arr*}’ for argument ‘2’ to ‘device_integer_array omc_oclTest_Kernel(threadData_t*, device_integer_array*)’
   tmp2 = omc_oclTest_Kernel(threadData, &tmp1);
                                              ^
oclTest_test.makefile:18: recipe for target 'oclTest_test' failed
make: *** [oclTest_test] Error 1

# Error encountered! Exiting...
# Please check the error message and the flags.

Execution failed!
}}}

$ omc --version
1.9.3+dev (r25196)
"	defect	reopened	high	Future	ParModelica	trunk		array, codegen	
