This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH B2/2] Use builtin_unreachable in assert
- From: Roland McGrath <roland at hack dot frob dot com>
- To: Mike Frysinger <vapier at gentoo dot org>
- Cc: Richard Henderson <rth at twiddle dot net>, libc-alpha at sourceware dot org
- Date: Wed, 4 Mar 2015 11:25:46 -0800 (PST)
- Subject: Re: [PATCH B2/2] Use builtin_unreachable in assert
- Authentication-results: sourceware.org; auth=none
- References: <1420827419-18655-1-git-send-email-rth at twiddle dot net> <1420827419-18655-3-git-send-email-rth at twiddle dot net> <20150302074325 dot GB8519 at vapier> <20150302225637 dot 51F252C39DF at topped-with-meat dot com> <20150303021539 dot GP24238 at vapier>
> > "No side effects" at the C level certainly does not
> > preclude a different correct translation of the program to machine code.
>
> sure ... i wasn't saying otherwise. my point is that __builtin_unreachable
> doesn't do that -- it explicitly is documented by gcc as:
> If control flow reaches the point of the __builtin_unreachable, the program is
> undefined.
>
> if there was a solution as Richard alluded to that allows for expansion of the
> expression all the time w/out breaking things when the assert is actually hit,
> i'm all for that.
I don't understand what your concern is. A call to __assert_fail leads to
a call to abort and that is no more or less well-defined or recoverable
than __builtin_unreachable.