[PATCH] Fix PR21082 for C++

Richard Guenther richard.guenther@gmail.com
Mon Apr 25 09:13:00 GMT 2005


On 4/24/05, Richard Henderson <rth@redhat.com> wrote:
> On Sun, Apr 24, 2005 at 07:57:35PM +0200, Richard Guenther wrote:
> > While this would be possible, I fail to see the advantage of doing this.
> > You will end up in (ptrdiff_t)((domain_t)i - (domain_t)j) instead of
> > (ptrdiff_t)i - (ptrdiff_t)j.  Are you concerned about correctness or about
> > more folding oportunities here?
> 
> Conceptual correctness.  I don't like the idea of multiplying pointers.

Well, I neither see pointers nor multiplication involved here ;)  The difference
&a[i] - &a[j] is of signed integer type ptrdiff_t (which should match ssize_t
which is the default TYPE_DOMAIN).  Roger pointed out to me that other
parts check TYPE_DOMAIN before accessing it (for being anal), is TYPE_DOMAIN
guaranteed to exist?  If so, I'll prepare a followup-patch to cast to
TYPE_DOMAIN
for applying the MINUS_EXPR and cast the result to the type of the original
expression.

Thanks,
Richard.



More information about the Gcc-patches mailing list