Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Overture 3.0.0 #127

Open
CThuleHansen opened this issue Sep 21, 2020 · 11 comments
Open

Update to Overture 3.0.0 #127

CThuleHansen opened this issue Sep 21, 2020 · 11 comments

Comments

@CThuleHansen
Copy link

CThuleHansen commented Sep 21, 2020

So the updating of VDM2C seems to have fallen behind - probably because @peterwvj just silently fixed everything beforehand 👍
Anyways, the challenge remains. I am tagging some people that I hope can help out with the task.
@nickbattle @idhugoid @peterwvj (as he might have some knowledge of the infrastructure) and @lausdahl .

I am experiencing the following:
Using overture 3.0.0 it still compiles, but the generated C does not.
I am pinpointed the issue to be related to classes somehow.
The water tank will serve as an example below.

With Overture 3.0.0 the valveactuator attempts to access fields of the controller:

CALL_FUNC(BoolPort, BoolPort, GET_FIELD_PTR_GC(Controller, Controller, this, port), CLASS_BoolPort__Z8setValueEB, value);

With Overture 3.6.4 it correctly uses ValveActuator class.

CALL_FUNC(BoolPort, BoolPort, GET_FIELD_PTR_GC(ValveActuator, ValveActuator, this, port), CLASS_BoolPort__Z8setValueEB, value);

So the challenge is to update vdm2c from using Overture 2.6.4 to Overture 3.0.0.

I have not had time to dig further into this yet.

@idhugoid and I will have a meeting later today (Monday 21st September, 2020) to update the overture procedure such that vdm2c is updated on Overture updates.

@CThuleHansen
Copy link
Author

@nickbattle do you have any idea of things that have changed since overture 2.6.4 that has to be reflected in vdm2c?

@nickbattle
Copy link

@CThuleHansen Phew... well, I can start by looking through the bug list, though most of the fixes are really "bugs" in the way VDMJ/Overture works, rather than fundamental changes that would change code generation. If you can give me an example of a piece of C that has changed (before/after compare?), I might be able to guess the area more easily?

@CThuleHansen
Copy link
Author

@nickbattle so one example is the one in the original issue, where it tries to find a variable in a wrong class.

@CThuleHansen
Copy link
Author

@idhugoid i investigating currently

@nickbattle
Copy link

@CThuleHansen Yes, I saw the one-liner in the issue above. But without more context, it's hard to know what created that. Is it possible to create a small example VDM++ spec that translates into two different C files? Perhaps based on the class in which this one-liner occurs? That would be easier to investigate.

@CThuleHansen
Copy link
Author

So this model does it:
https://github.com/INTO-CPS-Association/example-single_watertank/tree/master/Models/SingleWT
it is part of a test suite inside the vdm2c.

@idhugoid have you come any further?

@CThuleHansen
Copy link
Author

CThuleHansen commented Sep 22, 2020

The tests works with overture 2.6.4 on ubuntu with gcc (not on mac with clang). This is also tested via github actions.
The following tests fail with overture 3.0.0 (trace is included in bottom and available via github action

All 4 vdm-rt examples (pretty much with the same error) and 1 vdmPP (with different error):

To test overture 3.0.0 on ubuntu I set up a github actions for the branch update_overture30 (Action running as we speak.
(https://github.com/overturetool/vdm2c/runs/1149048049?check_suite_focus=true).

To test it locally I created a docker container. Scripts are below:
docker-compose.yml: Note that here I use the directory where I have checked out vdm2c.

version: '3'
services:
  ubuntu:
    build: .
    volumes:
      - /Users/au443759/source/overturetool/vdm2c:/Users/au443759/source/overturetool/vdm2c
    working_dir: /Users/au443759/source/overturetool/vdm2c
    tty: true
    command: bash -c "find . -type f -iname '*cmakecache*' -exec rm {} \;"

Dockerfile:

FROM ubuntu:18.04
RUN apt-get -y update
RUN apt-get -y install valgrind
RUN apt-get -y install maven
RUN apt-get -y install cmake
RUN apt-get -y install build-essential
RUN apt-get -y install openjdk-8-jdk-headless
RUN gcc --version
RUN apt-get -y install pkg-config
RUN apt-get -y install libglib2.0-dev
RUN update-java-alternatives --set /usr/lib/jvm/java-1.8.0-openjdk-amd64

Failure trace:

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running org.overture.codegen.vdm2c.ContractsGarbageCollectionTests
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 18.976 sec - in org.overture.codegen.vdm2c.ContractsGarbageCollectionTests
Running org.overture.codegen.vdm2c.IsExpTypeEncoderTest
Tests run: 23, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.039 sec - in org.overture.codegen.vdm2c.IsExpTypeEncoderTest
Running org.overture.codegen.vdm2c.NativeGarbageCollectionTest
Tests run: 24, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 395.13 sec - in org.overture.codegen.vdm2c.NativeGarbageCollectionTest
Running org.overture.codegen.vdm2c.ValueTypeGarbageCollectionTests
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 45.802 sec - in org.overture.codegen.vdm2c.ValueTypeGarbageCollectionTests
Running org.overture.codegen.vdm2c.NativeClassesGarbageCollectionTest
Tests run: 26, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 408.724 sec - in org.overture.codegen.vdm2c.NativeClassesGarbageCollectionTest
Running org.overture.codegen.vdm2c.FeatureAnalysisTest
Tests run: 17, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.002 sec - in org.overture.codegen.vdm2c.FeatureAnalysisTest
Running org.overture.codegen.vdm2c.DistSystemAnalysisTests
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.445 sec - in org.overture.codegen.vdm2c.DistSystemAnalysisTests
Running org.overture.codegen.vdm2c.ContractsTests
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 21.014 sec - in org.overture.codegen.vdm2c.ContractsTests
Running org.overture.codegen.vdm2c.NativeTests
Tests run: 24, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 392.109 sec - in org.overture.codegen.vdm2c.NativeTests
Running org.overture.codegen.vdm2c.ClassAssocAnalysisTest
Tests run: 6, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.047 sec - in org.overture.codegen.vdm2c.ClassAssocAnalysisTest
Running org.overture.codegen.vdm2c.IsExpUnionTypeFinderTest
Tests run: 6, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 sec - in org.overture.codegen.vdm2c.IsExpUnionTypeFinderTest
Running org.overture.codegen.vdm2c.NativeClassesTests
Tests run: 26, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 436.22 sec - in org.overture.codegen.vdm2c.NativeClassesTests
Running org.overture.codegen.vdm2c.ValueTypesTests
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 52.605 sec - in org.overture.codegen.vdm2c.ValueTypesTests
Running org.overture.codegen.vdm2c.CasesTest
Tests run: 4, Failures: 0, Errors: 4, Skipped: 0, Time elapsed: 60.396 sec <<< FAILURE! - in org.overture.codegen.vdm2c.CasesTest
threeTank(org.overture.codegen.vdm2c.CasesTest)  Time elapsed: 13.673 sec  <<< ERROR!
org.overture.codegen.vdm2c.CMakeUtil$CMakeGenerateException: 
In file included from /Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/Vdm.h:59:0,
                 from /Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/CasesTest/threeTank/ValveActuator.h:11,
                 from /Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/CasesTest/threeTank/ValveActuator.c:6:
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/CasesTest/threeTank/ValveActuator.c: In function '_Z8setValveEB':
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:172:97: error: invalid use of undefined type 'struct Controller'
 #define CLASS_CAST(ptr, from, to) ((struct to *)(((unsigned char*)ptr) + (SAME_ARGS(from,to)?0: offsetof(struct from, _##to##_pVTable))))
                                                                                                 ^
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:187:94: note: in definition of macro 'GET_STRUCT_FIELD'
 #define GET_STRUCT_FIELD(tname, ptr, fieldtype, fieldname) (*((fieldtype*)((((unsigned char*)ptr) + offsetof(struct tname, fieldname)))))
                                                                                              ^~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:209:128: note: in expansion of macro 'GET_VTABLE_FUNC'
 #define CALL_FUNC(thisTypeName,funcTname,classValue,id, ... )     (CREATE_CALL_VARG_CAST(struct thisTypeName*, ## __VA_ARGS__ )GET_VTABLE_FUNC( thisTypeName,funcTname,TO_CLASS_PTR(classValue,thisTypeName),id))(CLASS_CAST(TO_CLASS_PTR(classValue,thisTypeName),thisTypeName,funcTname), ##  __VA_ARGS__)
                                                                                                                                ^~~~~~~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:209:168: note: in expansion of macro 'TO_CLASS_PTR'
 #define CALL_FUNC(thisTypeName,funcTname,classValue,id, ... )     (CREATE_CALL_VARG_CAST(struct thisTypeName*, ## __VA_ARGS__ )GET_VTABLE_FUNC( thisTypeName,funcTname,TO_CLASS_PTR(classValue,thisTypeName),id))(CLASS_CAST(TO_CLASS_PTR(classValue,thisTypeName),thisTypeName,funcTname), ##  __VA_ARGS__)
                                                                                                                                                                        ^~~~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/CasesTest/threeTank/ValveActuator.c:53:1: note: in expansion of macro 'CALL_FUNC'
 CALL_FUNC(BoolPort, BoolPort, GET_FIELD_PTR_GC(Controller, Controller, this, port), CLASS_BoolPort__Z8setValueEB, value);
 ^~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:246:82: note: in expansion of macro 'GET_STRUCT_FIELD'
 #define GET_FIELD_PTR_GC(thisTypeName, fieldTypeName, ptr, fieldName) vdmCloneGC(GET_STRUCT_FIELD(fieldTypeName,CLASS_CAST(ptr,thisTypeName,fieldTypeName) ,TVP,m_##fieldTypeName##_##fieldName))
                                                                                  ^~~~~~~~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:246:113: note: in expansion of macro 'CLASS_CAST'
 #define GET_FIELD_PTR_GC(thisTypeName, fieldTypeName, ptr, fieldName) vdmCloneGC(GET_STRUCT_FIELD(fieldTypeName,CLASS_CAST(ptr,thisTypeName,fieldTypeName) ,TVP,m_##fieldTypeName##_##fieldName))
                                                                                                                 ^~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/CasesTest/threeTank/ValveActuator.c:53:31: note: in expansion of macro 'GET_FIELD_PTR_GC'
 CALL_FUNC(BoolPort, BoolPort, GET_FIELD_PTR_GC(Controller, Controller, this, port), CLASS_BoolPort__Z8setValueEB, value);
                               ^~~~~~~~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:187:101: error: invalid use of undefined type 'struct Controller'
 #define GET_STRUCT_FIELD(tname, ptr, fieldtype, fieldname) (*((fieldtype*)((((unsigned char*)ptr) + offsetof(struct tname, fieldname)))))
                                                                                                     ^
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:203:61: note: in expansion of macro 'GET_STRUCT_FIELD'
 #define GET_VTABLE_FUNC(thisTypeName, funcTname, ptr, id)   GET_STRUCT_FIELD(thisTypeName,ptr,struct VTable*,_##funcTname##_pVTable)[id].pFunc
                                                             ^~~~~~~~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:209:128: note: in expansion of macro 'GET_VTABLE_FUNC'
 #define CALL_FUNC(thisTypeName,funcTname,classValue,id, ... )     (CREATE_CALL_VARG_CAST(struct thisTypeName*, ## __VA_ARGS__ )GET_VTABLE_FUNC( thisTypeName,funcTname,TO_CLASS_PTR(classValue,thisTypeName),id))(CLASS_CAST(TO_CLASS_PTR(classValue,thisTypeName),thisTypeName,funcTname), ##  __VA_ARGS__)
                                                                                                                                ^~~~~~~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:209:168: note: in expansion of macro 'TO_CLASS_PTR'
 #define CALL_FUNC(thisTypeName,funcTname,classValue,id, ... )     (CREATE_CALL_VARG_CAST(struct thisTypeName*, ## __VA_ARGS__ )GET_VTABLE_FUNC( thisTypeName,funcTname,TO_CLASS_PTR(classValue,thisTypeName),id))(CLASS_CAST(TO_CLASS_PTR(classValue,thisTypeName),thisTypeName,funcTname), ##  __VA_ARGS__)
                                                                                                                                                                        ^~~~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/CasesTest/threeTank/ValveActuator.c:53:1: note: in expansion of macro 'CALL_FUNC'
 CALL_FUNC(BoolPort, BoolPort, GET_FIELD_PTR_GC(Controller, Controller, this, port), CLASS_BoolPort__Z8setValueEB, value);
 ^~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:246:82: note: in expansion of macro 'GET_STRUCT_FIELD'
 #define GET_FIELD_PTR_GC(thisTypeName, fieldTypeName, ptr, fieldName) vdmCloneGC(GET_STRUCT_FIELD(fieldTypeName,CLASS_CAST(ptr,thisTypeName,fieldTypeName) ,TVP,m_##fieldTypeName##_##fieldName))
                                                                                  ^~~~~~~~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/CasesTest/threeTank/ValveActuator.c:53:31: note: in expansion of macro 'GET_FIELD_PTR_GC'
 CALL_FUNC(BoolPort, BoolPort, GET_FIELD_PTR_GC(Controller, Controller, this, port), CLASS_BoolPort__Z8setValueEB, value);
                               ^~~~~~~~~~~~~~~~
In file included from /Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/Vdm.h:59:0,
                 from /Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/CasesTest/threeTank/ValveActuator.h:11,
                 from /Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/CasesTest/threeTank/ValveActuator.c:6:
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:172:97: error: invalid use of undefined type 'struct Controller'
 #define CLASS_CAST(ptr, from, to) ((struct to *)(((unsigned char*)ptr) + (SAME_ARGS(from,to)?0: offsetof(struct from, _##to##_pVTable))))
                                                                                                 ^
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:209:211: note: in expansion of macro 'CLASS_CAST'
 #define CALL_FUNC(thisTypeName,funcTname,classValue,id, ... )     (CREATE_CALL_VARG_CAST(struct thisTypeName*, ## __VA_ARGS__ )GET_VTABLE_FUNC( thisTypeName,funcTname,TO_CLASS_PTR(classValue,thisTypeName),id))(CLASS_CAST(TO_CLASS_PTR(classValue,thisTypeName),thisTypeName,funcTname), ##  __VA_ARGS__)
                                                                                                                                                                                                                   ^~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:209:222: note: in expansion of macro 'TO_CLASS_PTR'
 #define CALL_FUNC(thisTypeName,funcTname,classValue,id, ... )     (CREATE_CALL_VARG_CAST(struct thisTypeName*, ## __VA_ARGS__ )GET_VTABLE_FUNC( thisTypeName,funcTname,TO_CLASS_PTR(classValue,thisTypeName),id))(CLASS_CAST(TO_CLASS_PTR(classValue,thisTypeName),thisTypeName,funcTname), ##  __VA_ARGS__)
                                                                                                                                                                                                                              ^~~~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/CasesTest/threeTank/ValveActuator.c:53:1: note: in expansion of macro 'CALL_FUNC'
 CALL_FUNC(BoolPort, BoolPort, GET_FIELD_PTR_GC(Controller, Controller, this, port), CLASS_BoolPort__Z8setValueEB, value);
 ^~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:246:82: note: in expansion of macro 'GET_STRUCT_FIELD'
 #define GET_FIELD_PTR_GC(thisTypeName, fieldTypeName, ptr, fieldName) vdmCloneGC(GET_STRUCT_FIELD(fieldTypeName,CLASS_CAST(ptr,thisTypeName,fieldTypeName) ,TVP,m_##fieldTypeName##_##fieldName))
                                                                                  ^~~~~~~~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:246:113: note: in expansion of macro 'CLASS_CAST'
 #define GET_FIELD_PTR_GC(thisTypeName, fieldTypeName, ptr, fieldName) vdmCloneGC(GET_STRUCT_FIELD(fieldTypeName,CLASS_CAST(ptr,thisTypeName,fieldTypeName) ,TVP,m_##fieldTypeName##_##fieldName))
                                                                                                                 ^~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/CasesTest/threeTank/ValveActuator.c:53:31: note: in expansion of macro 'GET_FIELD_PTR_GC'
 CALL_FUNC(BoolPort, BoolPort, GET_FIELD_PTR_GC(Controller, Controller, this, port), CLASS_BoolPort__Z8setValueEB, value);
                               ^~~~~~~~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:187:101: error: invalid use of undefined type 'struct Controller'
 #define GET_STRUCT_FIELD(tname, ptr, fieldtype, fieldname) (*((fieldtype*)((((unsigned char*)ptr) + offsetof(struct tname, fieldname)))))
                                                                                                     ^
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:172:67: note: in definition of macro 'CLASS_CAST'
 #define CLASS_CAST(ptr, from, to) ((struct to *)(((unsigned char*)ptr) + (SAME_ARGS(from,to)?0: offsetof(struct from, _##to##_pVTable))))
                                                                   ^~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:209:222: note: in expansion of macro 'TO_CLASS_PTR'
 #define CALL_FUNC(thisTypeName,funcTname,classValue,id, ... )     (CREATE_CALL_VARG_CAST(struct thisTypeName*, ## __VA_ARGS__ )GET_VTABLE_FUNC( thisTypeName,funcTname,TO_CLASS_PTR(classValue,thisTypeName),id))(CLASS_CAST(TO_CLASS_PTR(classValue,thisTypeName),thisTypeName,funcTname), ##  __VA_ARGS__)
                                                                                                                                                                                                                              ^~~~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/CasesTest/threeTank/ValveActuator.c:53:1: note: in expansion of macro 'CALL_FUNC'
 CALL_FUNC(BoolPort, BoolPort, GET_FIELD_PTR_GC(Controller, Controller, this, port), CLASS_BoolPort__Z8setValueEB, value);
 ^~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:246:82: note: in expansion of macro 'GET_STRUCT_FIELD'
 #define GET_FIELD_PTR_GC(thisTypeName, fieldTypeName, ptr, fieldName) vdmCloneGC(GET_STRUCT_FIELD(fieldTypeName,CLASS_CAST(ptr,thisTypeName,fieldTypeName) ,TVP,m_##fieldTypeName##_##fieldName))
                                                                                  ^~~~~~~~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/CasesTest/threeTank/ValveActuator.c:53:31: note: in expansion of macro 'GET_FIELD_PTR_GC'
 CALL_FUNC(BoolPort, BoolPort, GET_FIELD_PTR_GC(Controller, Controller, this, port), CLASS_BoolPort__Z8setValueEB, value);
                               ^~~~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/threeTank.dir/ValveActuator.c.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/threeTank.dir/all] Error 2
make: *** [all] Error 2

	at org.overture.codegen.vdm2c.CasesTest.runCaseStudyTest(CasesTest.java:46)
	at org.overture.codegen.vdm2c.CasesTest.threeTank(CasesTest.java:33)

lineFollowerRobot(org.overture.codegen.vdm2c.CasesTest)  Time elapsed: 13.594 sec  <<< ERROR!
org.overture.codegen.vdm2c.CMakeUtil$CMakeGenerateException: 
In file included from /Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/Vdm.h:59:0,
                 from /Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/CasesTest/lineFollowerRobot/RobotServo.h:11,
                 from /Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/CasesTest/lineFollowerRobot/RobotServo.c:6:
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/CasesTest/lineFollowerRobot/RobotServo.c: In function '_Z8setServoER':
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:172:97: error: invalid use of undefined type 'struct Controller'
 #define CLASS_CAST(ptr, from, to) ((struct to *)(((unsigned char*)ptr) + (SAME_ARGS(from,to)?0: offsetof(struct from, _##to##_pVTable))))
                                                                                                 ^
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:187:94: note: in definition of macro 'GET_STRUCT_FIELD'
 #define GET_STRUCT_FIELD(tname, ptr, fieldtype, fieldname) (*((fieldtype*)((((unsigned char*)ptr) + offsetof(struct tname, fieldname)))))
                                                                                              ^~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:209:128: note: in expansion of macro 'GET_VTABLE_FUNC'
 #define CALL_FUNC(thisTypeName,funcTname,classValue,id, ... )     (CREATE_CALL_VARG_CAST(struct thisTypeName*, ## __VA_ARGS__ )GET_VTABLE_FUNC( thisTypeName,funcTname,TO_CLASS_PTR(classValue,thisTypeName),id))(CLASS_CAST(TO_CLASS_PTR(classValue,thisTypeName),thisTypeName,funcTname), ##  __VA_ARGS__)
                                                                                                                                ^~~~~~~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:209:168: note: in expansion of macro 'TO_CLASS_PTR'
 #define CALL_FUNC(thisTypeName,funcTname,classValue,id, ... )     (CREATE_CALL_VARG_CAST(struct thisTypeName*, ## __VA_ARGS__ )GET_VTABLE_FUNC( thisTypeName,funcTname,TO_CLASS_PTR(classValue,thisTypeName),id))(CLASS_CAST(TO_CLASS_PTR(classValue,thisTypeName),thisTypeName,funcTname), ##  __VA_ARGS__)
                                                                                                                                                                        ^~~~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/CasesTest/lineFollowerRobot/RobotServo.c:53:1: note: in expansion of macro 'CALL_FUNC'
 CALL_FUNC(RealPort, RealPort, GET_FIELD_PTR_GC(Controller, Controller, this, port), CLASS_RealPort__Z8setValueER, value);
 ^~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:246:82: note: in expansion of macro 'GET_STRUCT_FIELD'
 #define GET_FIELD_PTR_GC(thisTypeName, fieldTypeName, ptr, fieldName) vdmCloneGC(GET_STRUCT_FIELD(fieldTypeName,CLASS_CAST(ptr,thisTypeName,fieldTypeName) ,TVP,m_##fieldTypeName##_##fieldName))
                                                                                  ^~~~~~~~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:246:113: note: in expansion of macro 'CLASS_CAST'
 #define GET_FIELD_PTR_GC(thisTypeName, fieldTypeName, ptr, fieldName) vdmCloneGC(GET_STRUCT_FIELD(fieldTypeName,CLASS_CAST(ptr,thisTypeName,fieldTypeName) ,TVP,m_##fieldTypeName##_##fieldName))
                                                                                                                 ^~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/CasesTest/lineFollowerRobot/RobotServo.c:53:31: note: in expansion of macro 'GET_FIELD_PTR_GC'
 CALL_FUNC(RealPort, RealPort, GET_FIELD_PTR_GC(Controller, Controller, this, port), CLASS_RealPort__Z8setValueER, value);
                               ^~~~~~~~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:187:101: error: invalid use of undefined type 'struct Controller'
 #define GET_STRUCT_FIELD(tname, ptr, fieldtype, fieldname) (*((fieldtype*)((((unsigned char*)ptr) + offsetof(struct tname, fieldname)))))
                                                                                                     ^
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:203:61: note: in expansion of macro 'GET_STRUCT_FIELD'
 #define GET_VTABLE_FUNC(thisTypeName, funcTname, ptr, id)   GET_STRUCT_FIELD(thisTypeName,ptr,struct VTable*,_##funcTname##_pVTable)[id].pFunc
                                                             ^~~~~~~~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:209:128: note: in expansion of macro 'GET_VTABLE_FUNC'
 #define CALL_FUNC(thisTypeName,funcTname,classValue,id, ... )     (CREATE_CALL_VARG_CAST(struct thisTypeName*, ## __VA_ARGS__ )GET_VTABLE_FUNC( thisTypeName,funcTname,TO_CLASS_PTR(classValue,thisTypeName),id))(CLASS_CAST(TO_CLASS_PTR(classValue,thisTypeName),thisTypeName,funcTname), ##  __VA_ARGS__)
                                                                                                                                ^~~~~~~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:209:168: note: in expansion of macro 'TO_CLASS_PTR'
 #define CALL_FUNC(thisTypeName,funcTname,classValue,id, ... )     (CREATE_CALL_VARG_CAST(struct thisTypeName*, ## __VA_ARGS__ )GET_VTABLE_FUNC( thisTypeName,funcTname,TO_CLASS_PTR(classValue,thisTypeName),id))(CLASS_CAST(TO_CLASS_PTR(classValue,thisTypeName),thisTypeName,funcTname), ##  __VA_ARGS__)
                                                                                                                                                                        ^~~~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/CasesTest/lineFollowerRobot/RobotServo.c:53:1: note: in expansion of macro 'CALL_FUNC'
 CALL_FUNC(RealPort, RealPort, GET_FIELD_PTR_GC(Controller, Controller, this, port), CLASS_RealPort__Z8setValueER, value);
 ^~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:246:82: note: in expansion of macro 'GET_STRUCT_FIELD'
 #define GET_FIELD_PTR_GC(thisTypeName, fieldTypeName, ptr, fieldName) vdmCloneGC(GET_STRUCT_FIELD(fieldTypeName,CLASS_CAST(ptr,thisTypeName,fieldTypeName) ,TVP,m_##fieldTypeName##_##fieldName))
                                                                                  ^~~~~~~~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/CasesTest/lineFollowerRobot/RobotServo.c:53:31: note: in expansion of macro 'GET_FIELD_PTR_GC'
 CALL_FUNC(RealPort, RealPort, GET_FIELD_PTR_GC(Controller, Controller, this, port), CLASS_RealPort__Z8setValueER, value);
                               ^~~~~~~~~~~~~~~~
In file included from /Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/Vdm.h:59:0,
                 from /Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/CasesTest/lineFollowerRobot/RobotServo.h:11,
                 from /Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/CasesTest/lineFollowerRobot/RobotServo.c:6:
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:172:97: error: invalid use of undefined type 'struct Controller'
 #define CLASS_CAST(ptr, from, to) ((struct to *)(((unsigned char*)ptr) + (SAME_ARGS(from,to)?0: offsetof(struct from, _##to##_pVTable))))
                                                                                                 ^
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:209:211: note: in expansion of macro 'CLASS_CAST'
 #define CALL_FUNC(thisTypeName,funcTname,classValue,id, ... )     (CREATE_CALL_VARG_CAST(struct thisTypeName*, ## __VA_ARGS__ )GET_VTABLE_FUNC( thisTypeName,funcTname,TO_CLASS_PTR(classValue,thisTypeName),id))(CLASS_CAST(TO_CLASS_PTR(classValue,thisTypeName),thisTypeName,funcTname), ##  __VA_ARGS__)
                                                                                                                                                                                                                   ^~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:209:222: note: in expansion of macro 'TO_CLASS_PTR'
 #define CALL_FUNC(thisTypeName,funcTname,classValue,id, ... )     (CREATE_CALL_VARG_CAST(struct thisTypeName*, ## __VA_ARGS__ )GET_VTABLE_FUNC( thisTypeName,funcTname,TO_CLASS_PTR(classValue,thisTypeName),id))(CLASS_CAST(TO_CLASS_PTR(classValue,thisTypeName),thisTypeName,funcTname), ##  __VA_ARGS__)
                                                                                                                                                                                                                              ^~~~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/CasesTest/lineFollowerRobot/RobotServo.c:53:1: note: in expansion of macro 'CALL_FUNC'
 CALL_FUNC(RealPort, RealPort, GET_FIELD_PTR_GC(Controller, Controller, this, port), CLASS_RealPort__Z8setValueER, value);
 ^~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:246:82: note: in expansion of macro 'GET_STRUCT_FIELD'
 #define GET_FIELD_PTR_GC(thisTypeName, fieldTypeName, ptr, fieldName) vdmCloneGC(GET_STRUCT_FIELD(fieldTypeName,CLASS_CAST(ptr,thisTypeName,fieldTypeName) ,TVP,m_##fieldTypeName##_##fieldName))
                                                                                  ^~~~~~~~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:246:113: note: in expansion of macro 'CLASS_CAST'
 #define GET_FIELD_PTR_GC(thisTypeName, fieldTypeName, ptr, fieldName) vdmCloneGC(GET_STRUCT_FIELD(fieldTypeName,CLASS_CAST(ptr,thisTypeName,fieldTypeName) ,TVP,m_##fieldTypeName##_##fieldName))
                                                                                                                 ^~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/CasesTest/lineFollowerRobot/RobotServo.c:53:31: note: in expansion of macro 'GET_FIELD_PTR_GC'
 CALL_FUNC(RealPort, RealPort, GET_FIELD_PTR_GC(Controller, Controller, this, port), CLASS_RealPort__Z8setValueER, value);
                               ^~~~~~~~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:187:101: error: invalid use of undefined type 'struct Controller'
 #define GET_STRUCT_FIELD(tname, ptr, fieldtype, fieldname) (*((fieldtype*)((((unsigned char*)ptr) + offsetof(struct tname, fieldname)))))
                                                                                                     ^
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:172:67: note: in definition of macro 'CLASS_CAST'
 #define CLASS_CAST(ptr, from, to) ((struct to *)(((unsigned char*)ptr) + (SAME_ARGS(from,to)?0: offsetof(struct from, _##to##_pVTable))))
                                                                   ^~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:209:222: note: in expansion of macro 'TO_CLASS_PTR'
 #define CALL_FUNC(thisTypeName,funcTname,classValue,id, ... )     (CREATE_CALL_VARG_CAST(struct thisTypeName*, ## __VA_ARGS__ )GET_VTABLE_FUNC( thisTypeName,funcTname,TO_CLASS_PTR(classValue,thisTypeName),id))(CLASS_CAST(TO_CLASS_PTR(classValue,thisTypeName),thisTypeName,funcTname), ##  __VA_ARGS__)
                                                                                                                                                                                                                              ^~~~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/CasesTest/lineFollowerRobot/RobotServo.c:53:1: note: in expansion of macro 'CALL_FUNC'
 CALL_FUNC(RealPort, RealPort, GET_FIELD_PTR_GC(Controller, Controller, this, port), CLASS_RealPort__Z8setValueER, value);
 ^~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:246:82: note: in expansion of macro 'GET_STRUCT_FIELD'
 #define GET_FIELD_PTR_GC(thisTypeName, fieldTypeName, ptr, fieldName) vdmCloneGC(GET_STRUCT_FIELD(fieldTypeName,CLASS_CAST(ptr,thisTypeName,fieldTypeName) ,TVP,m_##fieldTypeName##_##fieldName))
                                                                                  ^~~~~~~~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/CasesTest/lineFollowerRobot/RobotServo.c:53:31: note: in expansion of macro 'GET_FIELD_PTR_GC'
 CALL_FUNC(RealPort, RealPort, GET_FIELD_PTR_GC(Controller, Controller, this, port), CLASS_RealPort__Z8setValueER, value);
                               ^~~~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/lineFollowerRobot.dir/RobotServo.c.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/lineFollowerRobot.dir/all] Error 2
make: *** [all] Error 2

	at org.overture.codegen.vdm2c.CasesTest.runCaseStudyTest(CasesTest.java:46)
	at org.overture.codegen.vdm2c.CasesTest.lineFollowerRobot(CasesTest.java:21)

fcu(org.overture.codegen.vdm2c.CasesTest)  Time elapsed: 17.047 sec  <<< ERROR!
org.overture.codegen.vdm2c.CMakeUtil$CMakeGenerateException: 
In file included from /Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/Vdm.h:59:0,
                 from /Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/CasesTest/fcu/Actuator.h:11,
                 from /Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/CasesTest/fcu/Actuator.c:6:
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/CasesTest/fcu/Actuator.c: In function '_Z8setStateER':
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:172:97: error: invalid use of undefined type 'struct MechanicalController'
 #define CLASS_CAST(ptr, from, to) ((struct to *)(((unsigned char*)ptr) + (SAME_ARGS(from,to)?0: offsetof(struct from, _##to##_pVTable))))
                                                                                                 ^
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:187:94: note: in definition of macro 'GET_STRUCT_FIELD'
 #define GET_STRUCT_FIELD(tname, ptr, fieldtype, fieldname) (*((fieldtype*)((((unsigned char*)ptr) + offsetof(struct tname, fieldname)))))
                                                                                              ^~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:209:128: note: in expansion of macro 'GET_VTABLE_FUNC'
 #define CALL_FUNC(thisTypeName,funcTname,classValue,id, ... )     (CREATE_CALL_VARG_CAST(struct thisTypeName*, ## __VA_ARGS__ )GET_VTABLE_FUNC( thisTypeName,funcTname,TO_CLASS_PTR(classValue,thisTypeName),id))(CLASS_CAST(TO_CLASS_PTR(classValue,thisTypeName),thisTypeName,funcTname), ##  __VA_ARGS__)
                                                                                                                                ^~~~~~~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:209:168: note: in expansion of macro 'TO_CLASS_PTR'
 #define CALL_FUNC(thisTypeName,funcTname,classValue,id, ... )     (CREATE_CALL_VARG_CAST(struct thisTypeName*, ## __VA_ARGS__ )GET_VTABLE_FUNC( thisTypeName,funcTname,TO_CLASS_PTR(classValue,thisTypeName),id))(CLASS_CAST(TO_CLASS_PTR(classValue,thisTypeName),thisTypeName,funcTname), ##  __VA_ARGS__)
                                                                                                                                                                        ^~~~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/CasesTest/fcu/Actuator.c:53:1: note: in expansion of macro 'CALL_FUNC'
 CALL_FUNC(RealPort, RealPort, GET_FIELD_PTR_GC(MechanicalController, MechanicalController, this, handle), CLASS_RealPort__Z8setValueER, value);
 ^~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:246:82: note: in expansion of macro 'GET_STRUCT_FIELD'
 #define GET_FIELD_PTR_GC(thisTypeName, fieldTypeName, ptr, fieldName) vdmCloneGC(GET_STRUCT_FIELD(fieldTypeName,CLASS_CAST(ptr,thisTypeName,fieldTypeName) ,TVP,m_##fieldTypeName##_##fieldName))
                                                                                  ^~~~~~~~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:246:113: note: in expansion of macro 'CLASS_CAST'
 #define GET_FIELD_PTR_GC(thisTypeName, fieldTypeName, ptr, fieldName) vdmCloneGC(GET_STRUCT_FIELD(fieldTypeName,CLASS_CAST(ptr,thisTypeName,fieldTypeName) ,TVP,m_##fieldTypeName##_##fieldName))
                                                                                                                 ^~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/CasesTest/fcu/Actuator.c:53:31: note: in expansion of macro 'GET_FIELD_PTR_GC'
 CALL_FUNC(RealPort, RealPort, GET_FIELD_PTR_GC(MechanicalController, MechanicalController, this, handle), CLASS_RealPort__Z8setValueER, value);
                               ^~~~~~~~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:187:101: error: invalid use of undefined type 'struct MechanicalController'
 #define GET_STRUCT_FIELD(tname, ptr, fieldtype, fieldname) (*((fieldtype*)((((unsigned char*)ptr) + offsetof(struct tname, fieldname)))))
                                                                                                     ^
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:203:61: note: in expansion of macro 'GET_STRUCT_FIELD'
 #define GET_VTABLE_FUNC(thisTypeName, funcTname, ptr, id)   GET_STRUCT_FIELD(thisTypeName,ptr,struct VTable*,_##funcTname##_pVTable)[id].pFunc
                                                             ^~~~~~~~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:209:128: note: in expansion of macro 'GET_VTABLE_FUNC'
 #define CALL_FUNC(thisTypeName,funcTname,classValue,id, ... )     (CREATE_CALL_VARG_CAST(struct thisTypeName*, ## __VA_ARGS__ )GET_VTABLE_FUNC( thisTypeName,funcTname,TO_CLASS_PTR(classValue,thisTypeName),id))(CLASS_CAST(TO_CLASS_PTR(classValue,thisTypeName),thisTypeName,funcTname), ##  __VA_ARGS__)
                                                                                                                                ^~~~~~~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:209:168: note: in expansion of macro 'TO_CLASS_PTR'
 #define CALL_FUNC(thisTypeName,funcTname,classValue,id, ... )     (CREATE_CALL_VARG_CAST(struct thisTypeName*, ## __VA_ARGS__ )GET_VTABLE_FUNC( thisTypeName,funcTname,TO_CLASS_PTR(classValue,thisTypeName),id))(CLASS_CAST(TO_CLASS_PTR(classValue,thisTypeName),thisTypeName,funcTname), ##  __VA_ARGS__)
                                                                                                                                                                        ^~~~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/CasesTest/fcu/Actuator.c:53:1: note: in expansion of macro 'CALL_FUNC'
 CALL_FUNC(RealPort, RealPort, GET_FIELD_PTR_GC(MechanicalController, MechanicalController, this, handle), CLASS_RealPort__Z8setValueER, value);
 ^~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:246:82: note: in expansion of macro 'GET_STRUCT_FIELD'
 #define GET_FIELD_PTR_GC(thisTypeName, fieldTypeName, ptr, fieldName) vdmCloneGC(GET_STRUCT_FIELD(fieldTypeName,CLASS_CAST(ptr,thisTypeName,fieldTypeName) ,TVP,m_##fieldTypeName##_##fieldName))
                                                                                  ^~~~~~~~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/CasesTest/fcu/Actuator.c:53:31: note: in expansion of macro 'GET_FIELD_PTR_GC'
 CALL_FUNC(RealPort, RealPort, GET_FIELD_PTR_GC(MechanicalController, MechanicalController, this, handle), CLASS_RealPort__Z8setValueER, value);
                               ^~~~~~~~~~~~~~~~
In file included from /Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/Vdm.h:59:0,
                 from /Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/CasesTest/fcu/Actuator.h:11,
                 from /Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/CasesTest/fcu/Actuator.c:6:
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:172:97: error: invalid use of undefined type 'struct MechanicalController'
 #define CLASS_CAST(ptr, from, to) ((struct to *)(((unsigned char*)ptr) + (SAME_ARGS(from,to)?0: offsetof(struct from, _##to##_pVTable))))
                                                                                                 ^
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:209:211: note: in expansion of macro 'CLASS_CAST'
 #define CALL_FUNC(thisTypeName,funcTname,classValue,id, ... )     (CREATE_CALL_VARG_CAST(struct thisTypeName*, ## __VA_ARGS__ )GET_VTABLE_FUNC( thisTypeName,funcTname,TO_CLASS_PTR(classValue,thisTypeName),id))(CLASS_CAST(TO_CLASS_PTR(classValue,thisTypeName),thisTypeName,funcTname), ##  __VA_ARGS__)
                                                                                                                                                                                                                   ^~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:209:222: note: in expansion of macro 'TO_CLASS_PTR'
 #define CALL_FUNC(thisTypeName,funcTname,classValue,id, ... )     (CREATE_CALL_VARG_CAST(struct thisTypeName*, ## __VA_ARGS__ )GET_VTABLE_FUNC( thisTypeName,funcTname,TO_CLASS_PTR(classValue,thisTypeName),id))(CLASS_CAST(TO_CLASS_PTR(classValue,thisTypeName),thisTypeName,funcTname), ##  __VA_ARGS__)
                                                                                                                                                                                                                              ^~~~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/CasesTest/fcu/Actuator.c:53:1: note: in expansion of macro 'CALL_FUNC'
 CALL_FUNC(RealPort, RealPort, GET_FIELD_PTR_GC(MechanicalController, MechanicalController, this, handle), CLASS_RealPort__Z8setValueER, value);
 ^~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:246:82: note: in expansion of macro 'GET_STRUCT_FIELD'
 #define GET_FIELD_PTR_GC(thisTypeName, fieldTypeName, ptr, fieldName) vdmCloneGC(GET_STRUCT_FIELD(fieldTypeName,CLASS_CAST(ptr,thisTypeName,fieldTypeName) ,TVP,m_##fieldTypeName##_##fieldName))
                                                                                  ^~~~~~~~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:246:113: note: in expansion of macro 'CLASS_CAST'
 #define GET_FIELD_PTR_GC(thisTypeName, fieldTypeName, ptr, fieldName) vdmCloneGC(GET_STRUCT_FIELD(fieldTypeName,CLASS_CAST(ptr,thisTypeName,fieldTypeName) ,TVP,m_##fieldTypeName##_##fieldName))
                                                                                                                 ^~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/CasesTest/fcu/Actuator.c:53:31: note: in expansion of macro 'GET_FIELD_PTR_GC'
 CALL_FUNC(RealPort, RealPort, GET_FIELD_PTR_GC(MechanicalController, MechanicalController, this, handle), CLASS_RealPort__Z8setValueER, value);
                               ^~~~~~~~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:187:101: error: invalid use of undefined type 'struct MechanicalController'
 #define GET_STRUCT_FIELD(tname, ptr, fieldtype, fieldname) (*((fieldtype*)((((unsigned char*)ptr) + offsetof(struct tname, fieldname)))))
                                                                                                     ^
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:172:67: note: in definition of macro 'CLASS_CAST'
 #define CLASS_CAST(ptr, from, to) ((struct to *)(((unsigned char*)ptr) + (SAME_ARGS(from,to)?0: offsetof(struct from, _##to##_pVTable))))
                                                                   ^~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:209:222: note: in expansion of macro 'TO_CLASS_PTR'
 #define CALL_FUNC(thisTypeName,funcTname,classValue,id, ... )     (CREATE_CALL_VARG_CAST(struct thisTypeName*, ## __VA_ARGS__ )GET_VTABLE_FUNC( thisTypeName,funcTname,TO_CLASS_PTR(classValue,thisTypeName),id))(CLASS_CAST(TO_CLASS_PTR(classValue,thisTypeName),thisTypeName,funcTname), ##  __VA_ARGS__)
                                                                                                                                                                                                                              ^~~~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/CasesTest/fcu/Actuator.c:53:1: note: in expansion of macro 'CALL_FUNC'
 CALL_FUNC(RealPort, RealPort, GET_FIELD_PTR_GC(MechanicalController, MechanicalController, this, handle), CLASS_RealPort__Z8setValueER, value);
 ^~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:246:82: note: in expansion of macro 'GET_STRUCT_FIELD'
 #define GET_FIELD_PTR_GC(thisTypeName, fieldTypeName, ptr, fieldName) vdmCloneGC(GET_STRUCT_FIELD(fieldTypeName,CLASS_CAST(ptr,thisTypeName,fieldTypeName) ,TVP,m_##fieldTypeName##_##fieldName))
                                                                                  ^~~~~~~~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/CasesTest/fcu/Actuator.c:53:31: note: in expansion of macro 'GET_FIELD_PTR_GC'
 CALL_FUNC(RealPort, RealPort, GET_FIELD_PTR_GC(MechanicalController, MechanicalController, this, handle), CLASS_RealPort__Z8setValueER, value);
                               ^~~~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/fcu.dir/Actuator.c.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/fcu.dir/all] Error 2
make: *** [all] Error 2

	at org.overture.codegen.vdm2c.CasesTest.runCaseStudyTest(CasesTest.java:46)
	at org.overture.codegen.vdm2c.CasesTest.fcu(CasesTest.java:15)

singleWaterTank(org.overture.codegen.vdm2c.CasesTest)  Time elapsed: 16.082 sec  <<< ERROR!
org.overture.codegen.vdm2c.CMakeUtil$CMakeGenerateException: 
In file included from /Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/Vdm.h:59:0,
                 from /Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/CasesTest/singleWaterTank/ValveActuator.h:11,
                 from /Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/CasesTest/singleWaterTank/ValveActuator.c:6:
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/CasesTest/singleWaterTank/ValveActuator.c: In function '_Z8setValveEB':
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:172:97: error: invalid use of undefined type 'struct Controller'
 #define CLASS_CAST(ptr, from, to) ((struct to *)(((unsigned char*)ptr) + (SAME_ARGS(from,to)?0: offsetof(struct from, _##to##_pVTable))))
                                                                                                 ^
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:187:94: note: in definition of macro 'GET_STRUCT_FIELD'
 #define GET_STRUCT_FIELD(tname, ptr, fieldtype, fieldname) (*((fieldtype*)((((unsigned char*)ptr) + offsetof(struct tname, fieldname)))))
                                                                                              ^~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:209:128: note: in expansion of macro 'GET_VTABLE_FUNC'
 #define CALL_FUNC(thisTypeName,funcTname,classValue,id, ... )     (CREATE_CALL_VARG_CAST(struct thisTypeName*, ## __VA_ARGS__ )GET_VTABLE_FUNC( thisTypeName,funcTname,TO_CLASS_PTR(classValue,thisTypeName),id))(CLASS_CAST(TO_CLASS_PTR(classValue,thisTypeName),thisTypeName,funcTname), ##  __VA_ARGS__)
                                                                                                                                ^~~~~~~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:209:168: note: in expansion of macro 'TO_CLASS_PTR'
 #define CALL_FUNC(thisTypeName,funcTname,classValue,id, ... )     (CREATE_CALL_VARG_CAST(struct thisTypeName*, ## __VA_ARGS__ )GET_VTABLE_FUNC( thisTypeName,funcTname,TO_CLASS_PTR(classValue,thisTypeName),id))(CLASS_CAST(TO_CLASS_PTR(classValue,thisTypeName),thisTypeName,funcTname), ##  __VA_ARGS__)
                                                                                                                                                                        ^~~~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/CasesTest/singleWaterTank/ValveActuator.c:53:1: note: in expansion of macro 'CALL_FUNC'
 CALL_FUNC(BoolPort, BoolPort, GET_FIELD_PTR_GC(Controller, Controller, this, port), CLASS_BoolPort__Z8setValueEB, value);
 ^~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:246:82: note: in expansion of macro 'GET_STRUCT_FIELD'
 #define GET_FIELD_PTR_GC(thisTypeName, fieldTypeName, ptr, fieldName) vdmCloneGC(GET_STRUCT_FIELD(fieldTypeName,CLASS_CAST(ptr,thisTypeName,fieldTypeName) ,TVP,m_##fieldTypeName##_##fieldName))
                                                                                  ^~~~~~~~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:246:113: note: in expansion of macro 'CLASS_CAST'
 #define GET_FIELD_PTR_GC(thisTypeName, fieldTypeName, ptr, fieldName) vdmCloneGC(GET_STRUCT_FIELD(fieldTypeName,CLASS_CAST(ptr,thisTypeName,fieldTypeName) ,TVP,m_##fieldTypeName##_##fieldName))
                                                                                                                 ^~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/CasesTest/singleWaterTank/ValveActuator.c:53:31: note: in expansion of macro 'GET_FIELD_PTR_GC'
 CALL_FUNC(BoolPort, BoolPort, GET_FIELD_PTR_GC(Controller, Controller, this, port), CLASS_BoolPort__Z8setValueEB, value);
                               ^~~~~~~~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:187:101: error: invalid use of undefined type 'struct Controller'
 #define GET_STRUCT_FIELD(tname, ptr, fieldtype, fieldname) (*((fieldtype*)((((unsigned char*)ptr) + offsetof(struct tname, fieldname)))))
                                                                                                     ^
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:203:61: note: in expansion of macro 'GET_STRUCT_FIELD'
 #define GET_VTABLE_FUNC(thisTypeName, funcTname, ptr, id)   GET_STRUCT_FIELD(thisTypeName,ptr,struct VTable*,_##funcTname##_pVTable)[id].pFunc
                                                             ^~~~~~~~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:209:128: note: in expansion of macro 'GET_VTABLE_FUNC'
 #define CALL_FUNC(thisTypeName,funcTname,classValue,id, ... )     (CREATE_CALL_VARG_CAST(struct thisTypeName*, ## __VA_ARGS__ )GET_VTABLE_FUNC( thisTypeName,funcTname,TO_CLASS_PTR(classValue,thisTypeName),id))(CLASS_CAST(TO_CLASS_PTR(classValue,thisTypeName),thisTypeName,funcTname), ##  __VA_ARGS__)
                                                                                                                                ^~~~~~~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:209:168: note: in expansion of macro 'TO_CLASS_PTR'
 #define CALL_FUNC(thisTypeName,funcTname,classValue,id, ... )     (CREATE_CALL_VARG_CAST(struct thisTypeName*, ## __VA_ARGS__ )GET_VTABLE_FUNC( thisTypeName,funcTname,TO_CLASS_PTR(classValue,thisTypeName),id))(CLASS_CAST(TO_CLASS_PTR(classValue,thisTypeName),thisTypeName,funcTname), ##  __VA_ARGS__)
                                                                                                                                                                        ^~~~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/CasesTest/singleWaterTank/ValveActuator.c:53:1: note: in expansion of macro 'CALL_FUNC'
 CALL_FUNC(BoolPort, BoolPort, GET_FIELD_PTR_GC(Controller, Controller, this, port), CLASS_BoolPort__Z8setValueEB, value);
 ^~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:246:82: note: in expansion of macro 'GET_STRUCT_FIELD'
 #define GET_FIELD_PTR_GC(thisTypeName, fieldTypeName, ptr, fieldName) vdmCloneGC(GET_STRUCT_FIELD(fieldTypeName,CLASS_CAST(ptr,thisTypeName,fieldTypeName) ,TVP,m_##fieldTypeName##_##fieldName))
                                                                                  ^~~~~~~~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/CasesTest/singleWaterTank/ValveActuator.c:53:31: note: in expansion of macro 'GET_FIELD_PTR_GC'
 CALL_FUNC(BoolPort, BoolPort, GET_FIELD_PTR_GC(Controller, Controller, this, port), CLASS_BoolPort__Z8setValueEB, value);
                               ^~~~~~~~~~~~~~~~
In file included from /Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/Vdm.h:59:0,
                 from /Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/CasesTest/singleWaterTank/ValveActuator.h:11,
                 from /Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/CasesTest/singleWaterTank/ValveActuator.c:6:
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:172:97: error: invalid use of undefined type 'struct Controller'
 #define CLASS_CAST(ptr, from, to) ((struct to *)(((unsigned char*)ptr) + (SAME_ARGS(from,to)?0: offsetof(struct from, _##to##_pVTable))))
                                                                                                 ^
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:209:211: note: in expansion of macro 'CLASS_CAST'
 #define CALL_FUNC(thisTypeName,funcTname,classValue,id, ... )     (CREATE_CALL_VARG_CAST(struct thisTypeName*, ## __VA_ARGS__ )GET_VTABLE_FUNC( thisTypeName,funcTname,TO_CLASS_PTR(classValue,thisTypeName),id))(CLASS_CAST(TO_CLASS_PTR(classValue,thisTypeName),thisTypeName,funcTname), ##  __VA_ARGS__)
                                                                                                                                                                                                                   ^~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:209:222: note: in expansion of macro 'TO_CLASS_PTR'
 #define CALL_FUNC(thisTypeName,funcTname,classValue,id, ... )     (CREATE_CALL_VARG_CAST(struct thisTypeName*, ## __VA_ARGS__ )GET_VTABLE_FUNC( thisTypeName,funcTname,TO_CLASS_PTR(classValue,thisTypeName),id))(CLASS_CAST(TO_CLASS_PTR(classValue,thisTypeName),thisTypeName,funcTname), ##  __VA_ARGS__)
                                                                                                                                                                                                                              ^~~~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/CasesTest/singleWaterTank/ValveActuator.c:53:1: note: in expansion of macro 'CALL_FUNC'
 CALL_FUNC(BoolPort, BoolPort, GET_FIELD_PTR_GC(Controller, Controller, this, port), CLASS_BoolPort__Z8setValueEB, value);
 ^~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:246:82: note: in expansion of macro 'GET_STRUCT_FIELD'
 #define GET_FIELD_PTR_GC(thisTypeName, fieldTypeName, ptr, fieldName) vdmCloneGC(GET_STRUCT_FIELD(fieldTypeName,CLASS_CAST(ptr,thisTypeName,fieldTypeName) ,TVP,m_##fieldTypeName##_##fieldName))
                                                                                  ^~~~~~~~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:246:113: note: in expansion of macro 'CLASS_CAST'
 #define GET_FIELD_PTR_GC(thisTypeName, fieldTypeName, ptr, fieldName) vdmCloneGC(GET_STRUCT_FIELD(fieldTypeName,CLASS_CAST(ptr,thisTypeName,fieldTypeName) ,TVP,m_##fieldTypeName##_##fieldName))
                                                                                                                 ^~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/CasesTest/singleWaterTank/ValveActuator.c:53:31: note: in expansion of macro 'GET_FIELD_PTR_GC'
 CALL_FUNC(BoolPort, BoolPort, GET_FIELD_PTR_GC(Controller, Controller, this, port), CLASS_BoolPort__Z8setValueEB, value);
                               ^~~~~~~~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:187:101: error: invalid use of undefined type 'struct Controller'
 #define GET_STRUCT_FIELD(tname, ptr, fieldtype, fieldname) (*((fieldtype*)((((unsigned char*)ptr) + offsetof(struct tname, fieldname)))))
                                                                                                     ^
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:172:67: note: in definition of macro 'CLASS_CAST'
 #define CLASS_CAST(ptr, from, to) ((struct to *)(((unsigned char*)ptr) + (SAME_ARGS(from,to)?0: offsetof(struct from, _##to##_pVTable))))
                                                                   ^~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:209:222: note: in expansion of macro 'TO_CLASS_PTR'
 #define CALL_FUNC(thisTypeName,funcTname,classValue,id, ... )     (CREATE_CALL_VARG_CAST(struct thisTypeName*, ## __VA_ARGS__ )GET_VTABLE_FUNC( thisTypeName,funcTname,TO_CLASS_PTR(classValue,thisTypeName),id))(CLASS_CAST(TO_CLASS_PTR(classValue,thisTypeName),thisTypeName,funcTname), ##  __VA_ARGS__)
                                                                                                                                                                                                                              ^~~~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/CasesTest/singleWaterTank/ValveActuator.c:53:1: note: in expansion of macro 'CALL_FUNC'
 CALL_FUNC(BoolPort, BoolPort, GET_FIELD_PTR_GC(Controller, Controller, this, port), CLASS_BoolPort__Z8setValueEB, value);
 ^~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/../../c/vdmclib/src/main/VdmClass.h:246:82: note: in expansion of macro 'GET_STRUCT_FIELD'
 #define GET_FIELD_PTR_GC(thisTypeName, fieldTypeName, ptr, fieldName) vdmCloneGC(GET_STRUCT_FIELD(fieldTypeName,CLASS_CAST(ptr,thisTypeName,fieldTypeName) ,TVP,m_##fieldTypeName##_##fieldName))
                                                                                  ^~~~~~~~~~~~~~~~
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/CasesTest/singleWaterTank/ValveActuator.c:53:31: note: in expansion of macro 'GET_FIELD_PTR_GC'
 CALL_FUNC(BoolPort, BoolPort, GET_FIELD_PTR_GC(Controller, Controller, this, port), CLASS_BoolPort__Z8setValueEB, value);
                               ^~~~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/singleWaterTank.dir/ValveActuator.c.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/singleWaterTank.dir/all] Error 2
make: *** [all] Error 2

	at org.overture.codegen.vdm2c.CasesTest.runCaseStudyTest(CasesTest.java:46)
	at org.overture.codegen.vdm2c.CasesTest.singleWaterTank(CasesTest.java:27)

Running org.overture.codegen.vdm2c.ExplicitMemoryManagementTests
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 18.669 sec - in org.overture.codegen.vdm2c.ExplicitMemoryManagementTests
Running org.overture.codegen.vdm2c.PaperExampleTests
IsLegalCard at [line, pos] = [57, 8] in src/test/resources/vdmrt/paper-examples/cash-dispenser/CentralResource.vdmpp. Reason: Template could not be found.
IsLegalCard at [line, pos] = [64, 8] in src/test/resources/vdmrt/paper-examples/cash-dispenser/CentralResource.vdmpp. Reason: Template could not be found.
IsLegalCard at [line, pos] = [50, 21] in src/test/resources/vdmrt/paper-examples/cash-dispenser/Till.vdmpp. Reason: Template could not be found.
Tests run: 4, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 69.157 sec <<< FAILURE! - in org.overture.codegen.vdm2c.PaperExampleTests
cashDispenser(org.overture.codegen.vdm2c.PaperExampleTests)  Time elapsed: 13.601 sec  <<< ERROR!
org.overture.codegen.vdm2c.CMakeUtil$CMakeGenerateException: 
In file included from /Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/PaperExampleTests/cashDispenser/Event.h:15:0,
                 from /Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/PaperExampleTests/cashDispenser/VdmClassHierarchy.h:5,
                 from /Users/au443759/source/overturetool/vdm2c/c/vdmclib/src/main/VdmBasicTypes.c:38:
/Users/au443759/source/overturetool/vdm2c/core/vdm2c/target/test-cgen/PaperExampleTests/cashDispenser/System.h:15:10: fatal error: Till.h: No such file or directory
 #include "Till.h"
          ^~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/cashDispenser.dir/Users/au443759/source/overturetool/vdm2c/c/vdmclib/src/main/VdmBasicTypes.c.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/cashDispenser.dir/all] Error 2
make: *** [all] Error 2

	at org.overture.codegen.vdm2c.PaperExampleTests.cashDispenser(PaperExampleTests.java:49)

Running org.overture.codegen.vdm2c.ExternalTests
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec - in org.overture.codegen.vdm2c.ExternalTests
Running org.overture.codegen.vdm2c.NameManglerTests
Tests run: 20, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.003 sec - in org.overture.codegen.vdm2c.NameManglerTests
Running org.overture.codegen.vdm2c.DistributionTests
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 35.64 sec - in org.overture.codegen.vdm2c.DistributionTests
Running org.overture.codegen.vdm2c.TimeFinderTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 sec - in org.overture.codegen.vdm2c.TimeFinderTest

Results :

Tests in error: 
  CasesTest.fcu:15->runCaseStudyTest:46->MultiFileModelTestBase.runTest:20->MultiFileModelTestBase.runTest:37->NativeTestBase.compileAndTest:185->NativeTestBase.runTests:193 ? CMakeGenerate
  CasesTest.lineFollowerRobot:21->runCaseStudyTest:46->MultiFileModelTestBase.runTest:20->MultiFileModelTestBase.runTest:37->NativeTestBase.compileAndTest:185->NativeTestBase.runTests:193 ? CMakeGenerate
  CasesTest.singleWaterTank:27->runCaseStudyTest:46->MultiFileModelTestBase.runTest:20->MultiFileModelTestBase.runTest:37->NativeTestBase.compileAndTest:185->NativeTestBase.runTests:193 ? CMakeGenerate
  CasesTest.threeTank:33->runCaseStudyTest:46->MultiFileModelTestBase.runTest:20->MultiFileModelTestBase.runTest:37->NativeTestBase.compileAndTest:185->NativeTestBase.runTests:193 ? CMakeGenerate
  PaperExampleTests.cashDispenser:49->MultiFileModelTestBase.runTest:37->NativeTestBase.compileAndTest:185->NativeTestBase.runTests:193 ? CMakeGenerate

@CThuleHansen
Copy link
Author

CThuleHansen commented Sep 22, 2020

@nickbattle I seem to have pinpointed it to here (note, the code snippet below is scrollable):

public void caseAIdentifierVarExpIR(AIdentifierVarExpIR node)
throws AnalysisException
{
super.caseAIdentifierVarExpIR(node);
if(node.getIsLocal())
{
//This identifier is not a field.
return;
}
if(node.parent() instanceof AAssignToExpStmIR &&
((AAssignToExpStmIR)node.parent()).getTarget() == node)
{
//Current field is being assigned to, handled elsewhere.
return;
}
String thisClassName = null;
String fieldClassName = null;
INode vdmNode = node.getSourceNode().getVdmNode();
AMapSeqStateDesignator mapSeq = vdmNode.getAncestor(AMapSeqStateDesignator.class);
if (vdmNode instanceof AVariableExp)
{
AVariableExp varExp = (AVariableExp) vdmNode;
if (varExp.getType() instanceof AFunctionType
|| varExp.getType() instanceof AOperationType)
{
return;
}
// the enclosing class
thisClassName = varExp.getAncestor(SClassDefinition.class).getName().getName();
// default to same class
fieldClassName = thisClassName;
if (varExp.getVardef() instanceof AInheritedDefinition)
{
AInheritedDefinition idef = (AInheritedDefinition) varExp.getVardef();
fieldClassName = idef.getClassDefinition().getName().getName();
}
PDefinition vardef = CTransUtil.unwrapInheritedDef(varExp.getVardef());
if (vardef instanceof AInstanceVariableDefinition)
{
if (vardef.getAccess().getStatic() != null)
{
fieldUtil.replaceWithStaticReference(vardef.getClassDefinition(), node);
return;
}
} else if (vardef instanceof ALocalDefinition
&& (((ALocalDefinition) vardef).getValueDefinition()) != null)
{
if (vardef.getAccess().getStatic() != null)
{
fieldUtil.replaceWithStaticReference(vardef.getClassDefinition(), node);
return;
}
return;
}
} else if (vdmNode instanceof AIdentifierStateDesignator)
{
AIdentifierStateDesignator designator = (AIdentifierStateDesignator) vdmNode;
// why is the definition not kept here? we dont know what this points to
SClassDefinitionBase thisClass = designator.getAncestor(AClassClassDefinition.class);
if(thisClass == null)
{
//Must be a system class.
thisClass = designator.getAncestor(ASystemClassDefinition.class);
}
// the containing class
thisClassName = thisClass.getName().getName();
// while (thisClass != null && fieldClassName == null)
{
List<PDefinition> definitons = new Vector<PDefinition>();
definitons.addAll(thisClass.getDefinitions());
definitons.addAll(thisClass.getAllInheritedDefinitions());
for (PDefinition def : definitons)
{
if (def instanceof AInheritedDefinition)
{
def = ((AInheritedDefinition) def).getSuperdef();
}
if (def instanceof AInstanceVariableDefinition)
{
if (def.getName().getName().equals(designator.getName().getName()))
{
fieldClassName = def.getClassDefinition().getName().getName();
break;
}
}
}
}
if (fieldClassName == null)
{
logger.warn("Field class name not found: {}", node);
}
}
if (thisClassName != null && fieldClassName != null)
{
AMacroApplyExpIR apply = newMacroApply(findMacroName(mapSeq));
assist.replaceNodeWith(node, apply);
// add this type
apply.getArgs().add(createIdentifier(thisClassName, node.getSourceNode()));
// add field owner type
apply.getArgs().add(createIdentifier(fieldClassName, node.getSourceNode()));
// add this
apply.getArgs().add(createIdentifier(THIS_ARG, node.getSourceNode()));
// add field name
apply.getArgs().add(node);
apply.setType(node.getType());
}
}

In particular line 191: thisClassName = varExp.getAncestor(SClassDefinition.class).getName().getName(); which evaluates to Controller, but should be ValveActuator.

Related vdmrt position: (https://github.com/INTO-CPS-Association/example-single_watertank/blob/master/Models/SingleWT/ValveActuator.vdmrt#L14)

If you run the test singleWaterTank in core/vdm2c/src/test/java/org/overture/codegen/vdm2c/CasesTest.java then you should be able to see it.

I am not familiar with how the codegeneration works or the overture AST, so it is quite time consuming to figure this out :D

Using thisClassName = varExp.getVardef().getClassDefinition().getName().getName(); instead of thisClassName = varExp.getAncestor(SClassDefinition.class).getName().getName(); seems to work - but it is valid?

Does it help in any way?

@nickbattle
Copy link

@CThuleHansen This is great detective work, but I'm not familiar with the code generator either. Are we still able to contact @peterwvj at all? It sounds as though something has happened to the ancestry structure in the codegen "IR" tree, but I can't imagine what change(s) in Overture might have caused that.

@CThuleHansen
Copy link
Author

CThuleHansen commented Sep 23, 2020

@nickbattle I am unsure whether he can be contacted in this regard or not.
I am following the ancestry of line 14 (model).
(Kenneth:) Looked at this it seems like the definition of valveactuator.setValve(open) was set on the call, essentially relocating it to that class instead of making a reference. Kenneths guess is that the change is in the type checker / type resolution area.

The ancestry is as follows

  • ValveActuator`port in 'ValveActuator' (../../cases/single-watertank/Models/SingleWT/ValveActuator.vdmrt) at line 14:19
  • parent: port in 'ValveActuator' (../../cases/single-watertank/Models/SingleWT/ValveActuator.vdmrt) at line 14:19
  • parent: port.setValue(value) in 'ValveActuator' (../../cases/single-watertank/Models/SingleWT/ValveActuator.vdmrt) at line 14:19
  • parent: setValve(bool) (bool ==> ())
    setValve(bool)(value) ==
    port.setValue(value) in in 'ValveActuator' (../../cases/single-watertank/Models/SingleWT/ValveActuator.vdmrt) at line 13:8
  • parent: valveActuator.setValve(close) in 'Controller' (../../cases/single-watertank/Models/SingleWT/Controller.vdmrt) at line 40:10
  • parent: if (level <= (HardwareInterface`minlevel.getValue)())
    then
    valveActuator.setValve(close) in 'Controller' (../../cases/single-watertank/Models/SingleWT/Controller.vdmrt) at line 39:5

@nickbattle
Copy link

@CThuleHansen OK, this is very strange. I started by assuming that the parent/child relationship was to do with the class hierarchy (eg. that ValveActuator was a subclass of Controller), but it is not; rather, ValveActuator is an instance variable within Controller. So it's lost track of which class it is generating, by the look of it.

I assume the operation of this model in Overture is still correct? I mean, it does call the setValve method of the ValveActuator correctly?

If you translate a simple two-class model with a Controller with an instance variable of a ValveActuator, does that translate correctly?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants