[Bug sanitizer/83219] [8 regression] c-c++-common/ubsan/unreachable-2.c fails starting with r255201
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Nov 30 09:50:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83219
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Because new __builtin_unreachable calls are added everywhere in the
optimization pipeline. I'd rather disable the optimizations where we remove
conditionals or switches that branch to __builtin_unreachable if
(sanitize_flags_p (SANITIZE_UNREACHABLE)).
Not sure where exactly that is though. I see:
/* Discard cases that have an unreachable destination block. */
if (EDGE_COUNT (base_bb->succs) == 0
&& gimple_seq_unreachable_p (bb_seq (base_bb)))
{
edge base_edge = find_edge (gimple_bb (stmt), base_bb);
if (base_edge != NULL)
remove_edge_and_dominated_blocks (base_edge);
i = next_index;
continue;
}
but that is something for switches only, where do we do this for GIMPLE_COND?
BTW, on a related note, I had to skip in c-c++-common/tsan/pr81275.c the -O2 +
C++ testing, the problem there is that the -Wreturn-type warning for C++ needs
the __builtin_unreachable () call too, but that goes away already during cfg
pass right before it. Would it be possible to defer that until after the
pass_warn_function_return if it is the BUILTINS_LOCATION __builtin_unreachable
()?
More information about the Gcc-bugs
mailing list