Commit 691e2db8 by Alexandre Oliva Committed by Alexandre Oliva

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
parent 37369edc
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> 2004-07-08 Richard Henderson <rth@redhat.com>
* builtins.c (std_gimplify_va_arg_expr): Hoist valist into a * builtins.c (std_gimplify_va_arg_expr): Hoist valist into a
......
...@@ -7385,6 +7385,11 @@ fold_builtin_strncpy (tree exp, tree slen) ...@@ -7385,6 +7385,11 @@ fold_builtin_strncpy (tree exp, tree slen)
if (integer_zerop (len)) if (integer_zerop (len))
return omit_one_operand (TREE_TYPE (exp), dest, src); 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) if (!slen)
slen = c_strlen (src, 1); slen = c_strlen (src, 1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment