https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117249
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> --- The definition is #if ENABLE_ASSERT_CHECKING #define gcc_assert(EXPR) \ ((void)(!(EXPR) ? fancy_abort (__FILE__, __LINE__, __FUNCTION__), 0 : 0)) #elif (GCC_VERSION >= 4005) #define gcc_assert(EXPR) \ ((void)(UNLIKELY (!(EXPR)) ? __builtin_unreachable (), 0 : 0)) #else /* Include EXPR, so that unused variable warnings do not occur. */ #define gcc_assert(EXPR) ((void)(0 && (EXPR))) #endif so I think you need --disable-checking and use a compiler other than GCC 4.5+ (and one that doesn't even pretend it is GCC 4.5), if you just use GCC 4.8* or later with disabled assert checking, I think the above just evaluates the side-effects in the condition and either optimizes based on it, or doesn't. Anyway, the put uses in gcc_assert are except.cc: gcc_assert (!data->eh_map->put (old_r, new_r)); except.cc: gcc_assert (!data->eh_map->put (old_lp, new_lp)); gimple-ssa-strength-reduction.cc: gcc_assert (!alt_base_map->put (base, base == expr ? NULL : expr)); gimple-ssa-strength-reduction.cc: gcc_assert (!stmt_cand_map->put (gs, c)); lto-cgraph.cc: gcc_assert (encoder->map->put (last_node.node, index + 1)); tree-eh.cc: gcc_assert (!get_eh_throw_stmt_table (ifun)->put (t, num)); tree-ssa-reassoc.cc: gcc_assert (!operand_rank->put (e, rank)); tree-ssa-structalias.cc: gcc_assert (!vi_for_tree->put (t, vi));