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] assert gimplifier assumption to prevent silent wrong code


On Thu, Jun 26, 2008 at 5:41 PM, Olivier Hainque <hainque@adacore.com> wrote:
> [Thanks for your super prompt feedback Richard, btw :)]
>
> Richard Guenther wrote:
>> WITH_SIZE_EXPR shouldn't be checked
>
>  ?
>
>> after all we could decide to gimplify to memset also for
>> constant-sized assignments.  I think the empty CONSTRUCTOR is
>> enough.
>
>  Ah, sure. My question was ambiguous: I meant something like
>
>  /* Assert our assumptions, to abort instead of producing wrong code
>     silently if they are not met.  Beware that the RHS CONSTRUCTOR might
>     not be immediately exposed.  */
>  from = GENERIC_TREE_OPERAND (*expr_p, 1);
>  if (TREE_CODE (from) == WITH_SIZE_EXPR)
>    from = TREE_OPERAND (from, 0);
>
>  gcc_assert (TREE_CODE (from) == CONSTRUCTOR
>              && VEC_empty (constructor_elt, CONSTRUCTOR_ELTS (from)));

Ah, indeed.  Yes, the above looks good.

>  Would you rather skip other things than a WITH_SIZE_EXPR ? (conversions
>  come to mind)

That wouldn't be valid gimple and so should not appear.

Richard.


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