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][RFC] Fix PR61473, inline small memcpy/memmove during tree opts


On Fri, Jul 11, 2014 at 03:36:15PM +0200, Richard Biener wrote:
> *************** c_strlen (tree src, int only_value)
> *** 606,612 ****
>   
>     /* If the offset is known to be out of bounds, warn, and call strlen at
>        runtime.  */
> !   if (offset < 0 || offset > max)
>       {
>        /* Suppress multiple warnings for propagated constant strings.  */
>         if (! TREE_NO_WARNING (src))
> --- 610,617 ----
>   
>     /* If the offset is known to be out of bounds, warn, and call strlen at
>        runtime.  */
> !   if (only_value != 2
> !       && (offset < 0 || offset > max))
>       {
>        /* Suppress multiple warnings for propagated constant strings.  */
>         if (! TREE_NO_WARNING (src))

This looks wrong.  I'd say you only want to disable the warning for
only_value != 2, but still return NULL_TREE, otherwise the strlen call will
be out of bounds in the compiler.  So move only_value != 2 down to the
second if ?

	Jakub


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