__builtin_unreachable()'s semantic has consequences on the CFG and this should be taken in account for: * checking for undefined variables * checking when control reaches end of non-void function * context checking * ... Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> --- validation/linear/builtin_unreachable.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 validation/linear/builtin_unreachable.c diff --git a/validation/linear/builtin_unreachable.c b/validation/linear/builtin_unreachable.c new file mode 100644 index 000000000..4f13b892a --- /dev/null +++ b/validation/linear/builtin_unreachable.c @@ -0,0 +1,31 @@ +void function_that_never_returns(void); + +int foo(int c) +{ + if (c) + return 1; + function_that_never_returns(); + __builtin_unreachable(); +} + +/* + * check-name: __builtin_unreachable() + * check-command: test-linearize -Wno-decl $file + * + * check-known-to-fail + * check-output-start +foo: +.L0: + <entry-point> + cbr %arg1, .L3, .L2 + +.L2: + call function_that_never_returns + unreach + +.L3: + ret.32 $1 + + + * check-output-end + */ -- 2.14.0 -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html