Skip to content
This repository has been archived by the owner on Jan 5, 2021. It is now read-only.

C++, C and Java guard expression problem #355

Closed
terfloth opened this issue Feb 3, 2016 · 1 comment
Closed

C++, C and Java guard expression problem #355

terfloth opened this issue Feb 3, 2016 · 1 comment

Comments

@terfloth
Copy link
Contributor

terfloth commented Feb 3, 2016

From Daniel Buijnik's forum post: https://groups.google.com/forum/embed/?place=forum/yakindu-user#!topic/yakindu-user/1ijllodE5oo


To start with please have a look at the following:

2016-02-03 09_14_25-sc modeling - org yakindu sct examples trafficlight_testfsm sct - yakindu sct

Under simulator that FSM is behaving OK, however when running generated C++ code I discovered that for event E2 the transition taken is A-->B instead A-->C.
Quick look into generated code shows that the problem is with expression E1[c1 || c2].
It is translated to:

    return (iface.E1_raised) && iface.c1 || iface.c2;

while it should be rather

    return iface.E1_raised && (iface.c1 || iface.c2);

Quick fix for the above problem is to use additional brackets like this: E1[(c1 || c2)], however in longer run it would be great to see a fix for that as it is not unusual to have more than one variable in the guard.

I've been using Yakindu 2.5.0.201512141644.

@terfloth
Copy link
Contributor Author

terfloth commented Feb 8, 2016

This issue also applied to C and Java code generators.

@terfloth terfloth changed the title C++ Guard expression problem C++, C and Java guard expression problem Feb 8, 2016
@terfloth terfloth closed this as completed Feb 8, 2016
jdicks pushed a commit that referenced this issue Feb 9, 2016
jdicks pushed a commit that referenced this issue Feb 9, 2016
jdicks pushed a commit that referenced this issue Feb 9, 2016
jdicks pushed a commit that referenced this issue Feb 9, 2016
jdicks pushed a commit that referenced this issue Feb 9, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant