Menu

#158 Fix for 3085434

None
closed-accepted
Ben Shi
None
5
2015-06-25
2010-11-10
RvS
No

label/jump optimization is influenced by the optimize.label[1..4] flags . --nolabelopt resets the label4 optimize flag. This disables the removal of non-reachable code. However, later on (in SDCCBBlock:iCodeFromeBBlock) this is flagged as an error or warning. In the case as reported in bug 3085434, the iffalse path is touched by jump-to-jump optimization, leaving the block with the original jump as dead-code, hence the waning. IMO --nolabelopt should not influence the removal of the unreached blocks but should not do the jump-to-jump optimization. This jum-to-jump optimization is switched on/off using the label3 optimzation flag. The same holds IMO for IFX label optimization ( influenced by the label2 optimize flag). Removal of non-reachable blocks should always be done, as it is a consequence of the other optimizations.

Discussion

  • RvS

    RvS - 2010-11-10
     
  • RvS

    RvS - 2010-11-10

    suppress unreachable-code warning solution

     
  • RvS

    RvS - 2010-11-10

    As the proposed fix changes --nolabelopt functionality and this might be unwanted another solution is to allow the check for dead-code only in case the label4 optimize flag is set. However, this suppresses all unreachable code warnings, also in case it is introduced by the user's own code.
    Example:

    int i = 10;

    int main(void)
    {
    while (1)
    {
    if (--i == 0)
    return(0);
    }

    return (1);

    }

    produces no unreachable-code warning.
    Attachment -2 contains the patch to remove the warning for this case

     
  • Ben Shi

    Ben Shi - 2015-06-25
    • status: open --> closed-accepted
    • assigned_to: Ben Shi
    • Group: -->
     
  • Ben Shi

    Ben Shi - 2015-06-25

    Applied in reversion #9262.

     

Log in to post a comment.