This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH, i386]: Insert "cld" via optimize mode switching
- From: Paolo Bonzini <paolo dot bonzini at lu dot unisi dot ch>
- To: Richard Guenther <richard dot guenther at gmail dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Uros Bizjak <ubizjak at gmail dot com>
- Date: Mon, 04 Dec 2006 14:53:28 +0100
- Subject: Re: [PATCH, i386]: Insert "cld" via optimize mode switching
- References: <email@example.com> <firstname.lastname@example.org>
Hmm, do we or the ABI guarantee to save/restore the necessary state
on entry/exit of signal handlers? So, is this optimization safe for
synchronous signals and/or exceptions?
If you have
this is not an atomic pair anyway. If the ABI does not require that DF
be cleared on exit from a subroutine, then there is no guarantee that a
signal handler occurring between the cld and "rep movsb" doesn't set the
In principle, Uros' patch may make the circumstance more likely, since
for example something like
memcpy (b, a, 10000); /* and a signal may occur here */
will be compiled with a single cld instruction. But the code is not
safe to begin with.
I think it would have been good that the ABI mandated that the flag be