diff options
author | Qing Zhao <qing.zhao@oracle.com> | 2018-08-15 16:33:52 +0000 |
---|---|---|
committer | Qing Zhao <qinzhao@gcc.gnu.org> | 2018-08-15 16:33:52 +0000 |
commit | b99d7d976ba2475f038ea1406a1fb9a8fb6c4f5a (patch) | |
tree | 2bf0f327db2e0b2b64117f2d2b16c5e708530946 /gcc/builtins.c | |
parent | 0cd020ae59e1131b8d7e23424c319c493745f0f8 (diff) | |
download | gcc-b99d7d976ba2475f038ea1406a1fb9a8fb6c4f5a.zip gcc-b99d7d976ba2475f038ea1406a1fb9a8fb6c4f5a.tar.gz gcc-b99d7d976ba2475f038ea1406a1fb9a8fb6c4f5a.tar.bz2 |
Do not expand the call to memcmp at all when overflow is detected.
From-SVN: r263563
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r-- | gcc/builtins.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c index 867d153..6716aab 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -4481,11 +4481,16 @@ expand_builtin_memcmp (tree exp, rtx target, bool result_eq) /*objsize=*/NULL_TREE); } + /* If the specified length exceeds the size of either object, + call the function. */ + if (!no_overflow) + return NULL_RTX; + /* Due to the performance benefit, always inline the calls first when result_eq is false. */ rtx result = NULL_RTX; - if (!result_eq && fcode != BUILT_IN_BCMP && no_overflow) + if (!result_eq && fcode != BUILT_IN_BCMP) { result = inline_expand_builtin_string_cmp (exp, target); if (result) |