Un-optimizing a line so that the compiler doesn't skip it

Long story short, how can I get the compiler to NOT optimize line 3153 out?

  • There's almost certainly no need to, because that line is not being skipped, nor optimized out in the first place.  It's joined with the surrounding ones in a way that no machine instruction remains which belongs to line 3153, and only that line.  Part of the reason for that is the way you formed the overall expression by ORing into an explicit zero, instead of the more conventional spelling that starts directly with the first term:

    outvar |= 
       bit_term1
     | bit_term2
     | bit_term3
     ;

    or slightly more clumsy-looking, but equivalent

    outvar |= bit_term1;
    outvar |= bit_term2;
    outvar |= bit_term3;

    I understand why you prefer the way you showed, but this may be one of those situations where you have to re-assess the balance between having your cake and eating it. ;-)

More questions in this forum