diff --git a/src/backends/lr.c b/src/backends/lr.c index 392d3f641e562d33931bce32804a23e5e7c3ac5e..4ab53bce60c5bd5148d96bcae51c2f1b6cfbf4b0 100644 --- a/src/backends/lr.c +++ b/src/backends/lr.c @@ -170,11 +170,19 @@ HLRAction *h_lr_conflict(HArena *arena, HLRAction *action, HLRAction *new) action->type = HLR_CONFLICT; action->branches = h_slist_new(arena); h_slist_push(action->branches, old); + h_slist_push(action->branches, new); + } else { + // check if 'new' is already among branches + HSlistNode *x; + for(x=action->branches->head; x; x=x->next) { + if(x->elem == new) + break; + } + // add 'new' if it is not already in list + if(x == NULL) + h_slist_push(action->branches, new); } - assert(action->type == HLR_CONFLICT); - h_slist_push(action->branches, new); - return action; }