[C PATCH] Disallow subtracting pointers to empty structs (PR c/58346)

Marek Polacek polacek@redhat.com
Thu Jan 16 11:58:00 GMT 2014


On Thu, Jan 16, 2014 at 12:50:10PM +0100, Eric Botcazou wrote:
> > +/* Return true if T is a pointer to a zero-sized struct/union.  */
> > +
> > +bool
> > +pointer_to_zero_sized_aggr_p (tree t)
> > +{
> > +  t = strip_pointer_operator (t);
> > +  return ((RECORD_OR_UNION_TYPE_P (t) || TREE_CODE (t) == ARRAY_TYPE)
> > +	  && TYPE_SIZE (t)
> > +	  && integer_zerop (TYPE_SIZE (t)));
> > +}
> 
> That's AGGREGATE_TYPE_P (and the comment seems to be out-of-sync).

Right.  However, I need to drop the check altogether anyway.  I'll
update the comment.  Thanks.

	Marek



More information about the Gcc-patches mailing list