On Tue, Jan 8, 2013 at 12:32 PM, Richard Biener wrote:
> Does it handle side-effects on the builtin-unreachable path correctly?
>
> int b;
> int a;
> extern void foo ();
> int main()
> {
>   if (!a)
>    {
>      if (!b)
>        foo ();
>      __builtin_unreachable ();
>    }
> }
>
> ---
>
> void foo () { puts("Hello"); exit(0); }
>
> ?  Users are not _required_ to annotate noreturn functions.  The BB with
> __builtin_unreachable () is still empty otherwise.

Not sure what you're expecting in this case, so guessing...

There is a warning for "reaching end of non-void" blah, but that's
correct on the a!=0 path.
With that if(!a) commented out, I don't have that warning of course.

The code is identical with and without patch. It's another example of
how __builtin_unreachable() helps hide unnecessary warnings.

Ciao!
Steven

Reply via email to