I think we discussed this earlier, but I don't recall the conclusion, if any. Would it make sense to use ASSERT to guide the compiler, and define it like
#define ASSERT(expr) do { if (!(expr)) __builtin_unreachable(); } while (0) (unless building with --enable-assert)? The idea is to tell the compiler to assume that the asserted expression is true, and not care what the behavior of the generated code is in case it nevertheless happens to be false at run time. As far as I understand, this should aid optimization in some (rare?) cases. Drawbacks are small: we'd need a configure test for __builtin_unreachable, and there are a few places with code like ASSERT_CODE (char *bp_orig = bp - bytes); ... ASSERT (bp > bp_orig); that needs the current definition of ASSERT and have to be updated in one way or the other. Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677. Internet email is subject to wholesale government surveillance. _______________________________________________ gmp-devel mailing list gmp-devel@gmplib.org https://gmplib.org/mailman/listinfo/gmp-devel