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: [PATCH] Fix PR46745



On Wed, 1 Dec 2010, Richard Guenther wrote:

> 
> This teaches the C pretty printer about MEM_REF.  I'm not sure how
> to best present the case with a non-constant offset to the user

"non-zero offset"?

> though (the patch prints *(p+byte offset)), printing a byte offset
> isn't equivalent to C semantics when the pointed to type of p isn't
> of size 1.  I thought of printing an ellipsis in the non-constant
> offset case, *(...).  Or going the full way and printing a cast,
> *(TREE_TYPE(mem) *)((char *)p + byte offset).  But I'm not sure
> how fancy we should try to be for the late diagnostic cases.

I'd suggest ((type *) p)[k] when offset is divisible by type size and
((type *) (p + m))[k] otherwise (where k is offset / size, and p is implicitly
assumed to be 'char*').

Actually, I'm more concerned about the similar issue in the tree dumps than in
diagnostics.  I would prefer something like the above in the dumps because
some day I (or someone else) might forget that MEM_REF gives a byte offset and
misinterpret the dump.  If that's OK for you I can prepare a patch for
tree-pretty-print.c

My 2c.

Alexander


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