http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58346

--- Comment #6 from rguenther at suse dot de <rguenther at suse dot de> ---
On Mon, 9 Sep 2013, joseph at codesourcery dot com wrote:

> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58346
> 
> --- Comment #5 from joseph at codesourcery dot com <joseph at codesourcery 
> dot com> ---
> I think some of the uses of the zero-size-objects extension are ones for 
> which making an array of such objects is reasonable, but it makes sense to 
> give an error for trying to subtract pointers to such objects.

A similar (runtime) error can be provoked by subtracting pointers
to array elements of variable size that happen to have zero size
at runtime.

This all seems to be a can of worms which I'd rather shield the
middle-end from.  For example we assume that a[0] and a[1] never
alias.

Can we at least make arrays of zero-sized elements trigger undefined
behavior in our extension documentation?  We probably can paper
over the ICEs as they occur (testing coverage is very weak of course).

Reply via email to