https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66520
--- Comment #9 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Fisnik from comment #8) > To this end, the compiler should respect the code written by the developer. As far as the C++ standard is concerned the built-in && and & operators for type bool are equivalent if evaluating the operands has no side-effects. C++ is not a high-level assembly language. > I'm already having trouble with g++, as for the code with single &, it is > generating inefficient code. Or I have to remove completely the optimization > flag '-O3', but then I have a very slow code Have you tried just using -O3 -fno-xxx for the relevant pass?