[Bug target/58490] __sync_bool_compare_and_swap sign bit failure
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58490 --- Comment #3 from Erik van der Werf erikvanderwerf at gmail dot com --- I'm sorry, that patch definitely looks relevant, and I'd like to try it, but somehow I did not manage to rebuild the arm-linux-gnueabi-gcc-4.7 package. I'm not a gcc expert, and trying to figure out how to configure the build for cross compilation turns out to be rather time consuming, so for now I'll just stay with gcc-4.6. BTW I also tried the new atomic built-ins (__atomic_compare_exchange) and those show the exact same problem.
[Bug c/58490] New: __sync_bool_compare_and_swap sign bit failure
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58490 Bug ID: 58490 Summary: __sync_bool_compare_and_swap sign bit failure Product: gcc Version: 4.7.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: erikvanderwerf at gmail dot com The following lines cause an assertion failure on my arm device: unsigned short int x=0x8000; unsigned short int y=1; // or any other number char success = __sync_bool_compare_and_swap(x, x, y); assert( success ); // ok assert( (x==y) ); // this fails when the highest bit in x is set Using signed short int with negative numbers produces the same error. Using older versions of gcc (e.g., 4.6) or when compiling for x86 it runs without problems. I compiled using 'arm-linux-gnueabi-gcc-4.7 -Wall -static'. Here are some details: arm-linux-gnueabi-gcc-4.7 --version arm-linux-gnueabi-gcc-4.7 (Debian 4.7.2-4) 4.7.2