This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFA (fold): PATCH for c++/49290 (folding *(T*)(ar+10))


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]>

but I'm not sure how well front ends would deal with that. Maybe I'll try it and see.

Jason


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]