https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103184
--- Comment #2 from Hongtao.liu <crazylht at gmail dot com> --- When mask is integer_cst, it not safe to replace_uses_by (use_lhs, lhs); since integer_cst has type signed int, but lhs has type unsigned int, and will issue ICE for type mismatch _7 = _1 & 8; _1 is signed int, and 8 is unsigged int CST. The problem is exposed only on aarch64 since the backend doesn't have corresponding optab and failed, but the original gimple has been changed. switch (fn) { case IFN_ATOMIC_BIT_TEST_AND_SET: optab = atomic_bit_test_and_set_optab; break; case IFN_ATOMIC_BIT_TEST_AND_COMPLEMENT: optab = atomic_bit_test_and_complement_optab; break; case IFN_ATOMIC_BIT_TEST_AND_RESET: optab = atomic_bit_test_and_reset_optab; break; default: return; } if (optab_handler (optab, TYPE_MODE (TREE_TYPE (lhs))) == CODE_FOR_nothing)