diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2017-09-15 11:03:50 +0200 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2017-11-13 14:16:51 +0100 |
| commit | 49c9826c0fd56accf19fa3090a7ad4acaef95017 (patch) | |
| tree | a2cd389e0d4a27e15375ee1389e8bd01d63435bc /validation/linear | |
| parent | 1f6cd6fe94fc440a9bbd9c2f1070bd016e550be4 (diff) | |
| download | sparse-dev-49c9826c0fd56accf19fa3090a7ad4acaef95017.tar.gz | |
add testcase for __builtin_unreachable()
__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@gmail.com>
Diffstat (limited to 'validation/linear')
| -rw-r--r-- | validation/linear/builtin_unreachable.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/validation/linear/builtin_unreachable.c b/validation/linear/builtin_unreachable.c new file mode 100644 index 00000000..4f13b892 --- /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 + */ |
