diff options
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r-- | gcc/builtins.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c index 19d2028..16dfc05 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -10208,10 +10208,11 @@ fold_builtin_memory_chk (tree fndecl, tree arglist, tree maxlen, bool ignore, } return 0; } - len = maxlen; } + else + maxlen = len; - if (tree_int_cst_lt (size, len)) + if (tree_int_cst_lt (size, maxlen)) return 0; } @@ -10313,10 +10314,11 @@ fold_builtin_stxcpy_chk (tree fndecl, tree arglist, tree maxlen, bool ignore, return fold_convert (TREE_TYPE (TREE_TYPE (fndecl)), build_function_call_expr (fn, arglist)); } - len = maxlen; } - - if (! tree_int_cst_lt (len, size)) + else + maxlen = len; + + if (! tree_int_cst_lt (maxlen, size)) return 0; } @@ -10361,10 +10363,11 @@ fold_builtin_strncpy_chk (tree arglist, tree maxlen) if SIZE is >= MAXLEN, never convert to __ocs_fail (). */ if (maxlen == NULL_TREE || ! host_integerp (maxlen, 1)) return 0; - len = maxlen; } + else + maxlen = len; - if (tree_int_cst_lt (size, len)) + if (tree_int_cst_lt (size, maxlen)) return 0; } @@ -10630,10 +10633,11 @@ fold_builtin_snprintf_chk (tree arglist, tree maxlen, if SIZE is >= MAXLEN, never convert to __ocs_fail (). */ if (maxlen == NULL_TREE || ! host_integerp (maxlen, 1)) return 0; - len = maxlen; } + else + maxlen = len; - if (tree_int_cst_lt (size, len)) + if (tree_int_cst_lt (size, maxlen)) return 0; } |