The following can be processed by bison with no conflicts of any kind:
statement : matchedstmt
| unmatchedstmt
;
matchedstmt : if '(' expression ')' matchedstmt else matchedstmt
| otherstmt
;
unmatchedstmt : if '(' expression ')' statement
| if '('expression ')' matchedstmt else unmatchedstmt
;
otherstmt : expressionstmt
| compoundstmt
| iterationstmt
| returnstmt
;
That's unsurprising since you are using a standard mechanism for disambiguating the if ... else
statement.
Presumably, the shift-reduce conflict is somewhere else in your grammar, possibly involving an interaction with this fragment. I suggest you add more statement types one at a time until you find the rule which causes the conflict. Unfortunately, LR grammars do not compose well: it is quite possible for two perfectly conflict-free fragments to produce a conflict when they are combined in a grammar.
On the whole, you will find that you will get better answers on StackOverflow if you follow the guidelines in How to ask. In particular, you should first attempt to find the smallest program which exhibits the problem you are expriencing, and then put all of that into your question. That is what we call a MCVE: Minimal, Complete, and Verifiable example, which has the advantage that someone attempting to answer your question can see exactly what you are doing.
An extract from your code which cannot be compiled or executed is not an MCVE. Creating an MCVE might seem like a lot of work, and sometimes it is. But aside from helping people to answer your question, it also helps you to answer your own question, because it helps you focus on the problem. So it's a very useful exercise.