On Fri, 11 Jul 2014, Jakub Jelinek wrote:

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

Hmm, yeah.  Probably doesn't matter for this use but I'm testing the
obvious fix.

Richard.

Reply via email to