builtins.c (fold_builtin_strncpy): Make sure len is a constant before comparing it as such.
* builtins.c (fold_builtin_strncpy): Make sure len is a constant before comparing it as such. From-SVN: r84343
This commit is contained in:
parent
37369edcc9
commit
691e2db899
2 changed files with 10 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
|||
2004-07-09 Alexandre Oliva <aoliva@redhat.com>
|
||||
|
||||
* builtins.c (fold_builtin_strncpy): Make sure len is a constant
|
||||
before comparing it as such.
|
||||
|
||||
2004-07-08 Richard Henderson <rth@redhat.com>
|
||||
|
||||
* builtins.c (std_gimplify_va_arg_expr): Hoist valist into a
|
||||
|
|
|
@ -7385,6 +7385,11 @@ fold_builtin_strncpy (tree exp, tree slen)
|
|||
if (integer_zerop (len))
|
||||
return omit_one_operand (TREE_TYPE (exp), dest, src);
|
||||
|
||||
/* We can't compare slen with len as constants below if len is not a
|
||||
constant. */
|
||||
if (len == 0 || TREE_CODE (len) != INTEGER_CST)
|
||||
return 0;
|
||||
|
||||
if (!slen)
|
||||
slen = c_strlen (src, 1);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue