This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH B2/2] Use builtin_unreachable in assert


On 04 Mar 2015 11:25, Roland McGrath wrote:
> > > "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.

yes, when NDEBUG is not defined.  but that's not what we're discussing here.

if your intention is for assert statements to crash the program even when NDEBUG 
is defined, then what exactly is the point of it ?  why don't we just delete it 
instead ?
-mike

Attachment: signature.asc
Description: Digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]