On 11/27/2017 05:44 AM, Richard Biener wrote:
> 
> +
> +  if (const strinfo *chksi = olddsi ? olddsi : dsi)
> +    if (si
> +       && !check_bounds_or_overlap (stmt, chksi->ptr, si->ptr, NULL_TREE, 
> len))
> +      /* Avoid transforming strcpy when out-of-bounds offsets or
> +        overlapping access is detected.  */
> +      return;
> 
> as I said elsewhere diagnostics should not prevent optimization.  Your warning
> code isn't optimization-grade (that is, false positives are possible).
> 
> +       if (!check_bounds_or_overlap (stmt, dst, sptr, NULL_TREE, slen))
> +         /* Avoid transforming strcat when out-of-bounds offsets or
> +            overlapping access is detected.  */
> +         return;
> +      }
> 
> Likewise.
> 
> +      if (!check_bounds_or_overlap (stmt, dst, sptr, dstlen, srcsize))
> +         /* Avoid transforming strcat when out-of-bounds offsets or
> +            overlapping access is detected.  */
> +       return;
> 
> Likewise.
I'll note that if we separate diagnostics from optimization these become
a non-issue.  The diagnostic bits simply wouldn't change code, plain and
simple... :-)

> 
> I have no strong opinion against the "code duplication" Jeff mentions with
> regarding to builtin_access and friends.  The relation to ao_ref and friends
> could be documented a bit and how builtin_memref/builtin_access are
> not suitable for optimization.
At the least documentation around not using those classes driving any
code generation changes/decisions seems wise.  We have the same issue
around compute_objsize/check_memop_sizes for the stringop-overflow patch
if I understand those bits correctly (i've got messages to get back to
on that thread as well..)

JEff

Reply via email to