On Fri, 10 Jun 2011, Jason Merrill wrote:

> On 06/10/2011 04:35 AM, Richard Guenther wrote:
> > I'm out of good suggestions ;)  You can do the same-qualifier matching
> > and simply have a mismatched array element vs. array-ref type.
> 
> But I need to allow different qualifiers, too.
> 
> > We could also argue that whoever calls fold_indirect_ref_1 with TYPE
> > that doesn't even have TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (op0 (!)))
> > == TYPE_MAIN_VARIANT (type) is broken.
> 
> Right, I only want to fold if the main variants match.
> 
> > Thus we could argue that
> > even ignoring qualifiers is ok - but I'd be worried about folding
> > *((volatile int *)&a[0] + 1) to a[1] with lost volatile qualification.
> 
> Right.
> 
> It would be correct to fold it to
> 
> VIEW_CONVERT_EXPR<volatile int,a[1]>

No, it wouldn't be correct.  It isn't correct to fold it to an array-ref
that isn't volatile.

Richard.

Reply via email to