This is the mail archive of the gcc@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: PR 6212


> Well, it's not "merely being read", but not being dereferenced either.

Yes; I should have said "used" perhaps.

> The relevant part of the testcase is:
>
> void
> fde_split (fde **probe, struct fde_vector *linear, struct fde_vector
> *erratic) {
>   erratic->array[probe - linear->array] = 0;
> }
>
> To do this index computation, we do the subtraction, divide by the size
> of the object being pointed to (POINTER_SIZE), then multiply by the size
> of the element of ARRAY, also POINTER_SIZE.

Seems like it would be nice if "fold" would just give us back the original
thing, there, but that's hardly a general solution.

> Well, what I tested was the following, plus the change to make that
> function unsigned:

Good, I like this patch.  Please run the complete set of tests and then
check it in.

> *** expr.c	16 Apr 2002 06:03:36 -0000	1.423.2.18
> --- expr.c	6 May 2002 10:43:38 -0000
> *************** highest_pow2_factor (exp)
> *** 5903,5906 ****
> --- 5903,5912 ----
>         c1 = highest_pow2_factor (TREE_OPERAND (exp, 2));
>         return MIN (c0, c1);
> +
> +     case PARM_DECL:  case VAR_DECL:  case RESULT_DECL:
> +       /* If this is an object that is a pointer type, assume it is
> + 	 properly aligned.  */
> +       if (POINTER_TYPE_P (TREE_TYPE (exp)))
> + 	return TYPE_ALIGN (TREE_TYPE (TREE_TYPE (exp)));
>
>       default:
>
>     You should, in any case, fix this on the mainline quickly.  There, you
>     can of course use a more invasive technique if you like.
>
> Right, but the new tree node will be a lot of work to add, so I don't want
> to rush into it.  The above should work there too.

Sure.  I think you should definitely check the patch in on the mainline
if you've tested it.

-- 
Mark Mitchell                mark@codesourcery.com
CodeSourcery, LLC            http://www.codesourcery.com


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