[PATCH] x86: fix sigaddset() inline asm memory constraint
authorConstantine Gavrilov <constg@qlusters.com>
Thu, 17 Nov 2005 09:40:43 +0000 (11:40 +0200)
committerLinus Torvalds <torvalds@g5.osdl.org>
Thu, 17 Nov 2005 16:42:26 +0000 (08:42 -0800)
Due to incomplete memory constraints, gcc would miscompile code with
sigaddset on i386 if sig arg was const.

A quote form Jakub to make the issue clear:

 "You need either
__asm__("btsl %1,%0" : "+m"(*set) : "Ir"(_sig-1) : "cc");
  or
__asm__("btsl %1,%0" : "=m"(*set) : "Ir"(_sig-1), "m"(*set) : "cc");
  because the btsl instruction doesn't just set the memory to some
  value, but needs to read its previous content as well.  If you don't
  tell that fact to GCC, GCC is of course free to optimize as if the asm
  was just setting the value and not depended on the previous value."

Signed-off-by: Linus Torvalds <torvalds@osdl.org>

No differences found