http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57264
--- Comment #10 from Uroš Bizjak <ubizjak at gmail dot com> --- (In reply to thutt from comment #9) > When the sample test program provided above was compiled with gcc 4.4, it > did not generate the stos instruction. However, each of 4.5, 4.6 and 4.7 > did generate the stos instruction. > > Given this, I'd like to clarify your answer. If I may summarize: > > 4.3.0 stopped using cld. Yes. > After cld was not used, an error existed in versions 4.4, 4.5, 4.6 and 4.7. This was not an error, x86 ABI specifies that direction flag has to be cleared. As a convenient feature, -mcld was introduced to "fix" non-conforming binaries that played tricks with x86 direction flag. > The error was fixed in 4.8. 4.8 "fixed" this issue as a secondary effect of some other bugfix. > You have backported the fix from 4.8 to 4.7. Yes. > You did not backport to 4.5 and 4.6 because they are closed. Yes. > You do not state, but I infer that 4.4 is also closed. Yes. > Do you have an idea why the test case does not demonstrate the error on 4.4? > Is there a test case that will demonstrate the error on 4.4? As you have found out, the test is very fragile and depends on exact code sequence of two consecutive instructions. This sequence is recognized in combine pass as STOSL instruction. However, the dependence of STOSL on direction flag is not modelled in the compiler, since it is not necessary for ABI conformant binaries. In 4.4, the generated sequence is probably slightly different, and for this reason not recognized as STOSL.