------- Comment #5 from phil dot sidler at attachmate dot com 2006-11-06 20:18 ------- Recreated with the following
#include <stdint.h> main() { uint8_t area = 1; uint8_t oldval; uint8_t res; oldval = area; res = __sync_val_compare_and_swap(&area, oldval, 128); } Note that constant values less that 128 in the 3rd parameter work OK. Casting the 3rd parameter to be unsigned does not work. Using a temporary variable instead of a constant does work, but only with optimization turned off. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29714