kieler/semantics

Exit transformation creates infinite self-loop

eNBeWe opened this issue · 2 comments

Consider the following model

FinalStateExit_before

scchart FinalStateExit {

  extern "foo" foo

  output bool O

  initial state A {
    exit do foo()
    
    initial state S1
    go to S2
    
    final state S2 {
      entry do O = true
    } 
  }
}

When this model is translated, the exit transformation creates a new final state with an immediate self-transition.
FinalStateExit_after

That is obviously not a proper model anymore.

I think I traced the issue to

firstState = region.getOrCreateSimpleFinalState(GENERATED_PREFIX + "PriorFinal") //every region MUST have an initial state

The getOrCreateSimpleFinalState doesn't pick up the existing final state, because that isn't simple. Instead it finds the newly created "_Done" state and messes that up.

I think the issue could be resolved by switching lines L143 and L141 in the Exit Processor.

a-sr commented

Thanks for hunting it down so far. We will look into it.