[PATCH] Reject boolean/enum types in last arg of __builtin_*_overflow_p

Marek Polacek polacek@redhat.com
Tue Jun 14 14:10:00 GMT 2016


On Tue, Jun 14, 2016 at 02:05:12PM +0000, Joseph Myers wrote:
> On Tue, 14 Jun 2016, Jakub Jelinek wrote:
> 
> > But, unlike normal signed or unsigned integral types or char, cast to
> > bool/_Bool is special, it is actually a comparison != 0.
> > So, I'd say if we want to support arith overflow to bool/_Bool, it should be
> > above with:
> > signed_intNNN_t t = (signed_intNNN_t) x + (signed_intNNN_t) y;
> > z = t != 0;
> > ovf = (signed_intNNN_t) z != t;
> 
> And, I really don't see this as useful.  Rejecting boolean types there 
> makes more sense to me.

I also don't think supporting booleans is worth all the hassle.

	Marek



More information about the Gcc-patches mailing list