This seems to have been fixed in newer gcc (tested with gcc 7.2 on godbolt.org). It is difficult to be sure, since the bug is triggered by particular combinations of code and flags (I think you need just the right amount of register pressure in just the right place). But at least for this code and for a variety of flags I could not provoke this incorrect code generation.
This seems to have been fixed in newer gcc (tested with gcc 7.2 on godbolt.org). It is difficult to be sure, since the bug is triggered by particular combinations of code and flags (I think you need just the right amount of register pressure in just the right place). But at least for this code and for a variety of flags I could not provoke this incorrect code generation.