On 18/03/2020 17:31, Luc Van Oostenryck wrote: > Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> > --- > validation/context-unreachable.c | 16 ++++++++++ > validation/linear/builtin_unreachable0.c | 30 +++++++++++++++++++ > ...n_unreachable.c => builtin_unreachable1.c} | 14 ++++----- > validation/linear/noreturn-unreachable0.c | 23 ++++++++++++++ > 4 files changed, 76 insertions(+), 7 deletions(-) > create mode 100644 validation/context-unreachable.c > create mode 100644 validation/linear/builtin_unreachable0.c > rename validation/linear/{builtin_unreachable.c => builtin_unreachable1.c} (65%) > create mode 100644 validation/linear/noreturn-unreachable0.c > > diff --git a/validation/context-unreachable.c b/validation/context-unreachable.c > new file mode 100644 > index 000000000000..3e330403ce01 > --- /dev/null > +++ b/validation/context-unreachable.c > @@ -0,0 +1,16 @@ > +int fun(void); > + > +static void foo(void) > +{ > + __context__(1); > + if (!fun()) { > + __builtin_unreachable(); > + return; > + } > + __context__(-1); > +} > + > +/* > + * check-name: context-unreachable > + * check-known-to-fail > + */ > diff --git a/validation/linear/builtin_unreachable0.c b/validation/linear/builtin_unreachable0.c > new file mode 100644 > index 000000000000..5da9d074ae5f > --- /dev/null > +++ b/validation/linear/builtin_unreachable0.c > @@ -0,0 +1,30 @@ > +extern void die(void) __attribute__((noreturn)); Hmm, is this declaration intended? ATB, Ramsay Jones > + > +int foo(int p) > +{ > + if (p == 3) > + __builtin_unreachable(); > + return p; > +} > + > +/* > + * check-name: builtin_unreachable0 > + * check-command: test-linearize -Wno-decl $file > + * check-known-to-fail > + * > + * check-output-start > +foo: > +.L0: > + <entry-point> > + seteq.32 %r2 <- %arg1, $3 > + cbr %r2, .L1, .L3 > + > +.L1: > + unreach > + > +.L3: > + ret.32 %arg1 > + > + > + * check-output-end > + */ > diff --git a/validation/linear/builtin_unreachable.c b/validation/linear/builtin_unreachable1.c > similarity index 65% > rename from validation/linear/builtin_unreachable.c > rename to validation/linear/builtin_unreachable1.c > index 4f13b892af54..280f853d8a07 100644 > --- a/validation/linear/builtin_unreachable.c > +++ b/validation/linear/builtin_unreachable1.c > @@ -1,15 +1,15 @@ > -void function_that_never_returns(void); > +extern void die(void); > > int foo(int c) > { > if (c) > return 1; > - function_that_never_returns(); > + die(); > __builtin_unreachable(); > } > > /* > - * check-name: __builtin_unreachable() > + * check-name: builtin_unreachable1 > * check-command: test-linearize -Wno-decl $file > * > * check-known-to-fail > @@ -19,13 +19,13 @@ foo: > <entry-point> > cbr %arg1, .L3, .L2 > > -.L2: > - call function_that_never_returns > - unreach > - > .L3: > ret.32 $1 > > +.L2: > + call die > + unreach > + > > * check-output-end > */ > diff --git a/validation/linear/noreturn-unreachable0.c b/validation/linear/noreturn-unreachable0.c > new file mode 100644 > index 000000000000..b76319458e96 > --- /dev/null > +++ b/validation/linear/noreturn-unreachable0.c > @@ -0,0 +1,23 @@ > +extern void die(void) __attribute__((noreturn)); > + > +int foo(void) > +{ > + die(); > + return 0; > +} > + > +/* > + * check-name: noreturn-unreachable0 > + * check-command: test-linearize -Wno-decl $file > + * check-known-to-fail > + * > + * check-output-start > +foo: > +.L0: > + <entry-point> > + call die > + unreach > + > + > + * check-output-end > + */ >