aboutsummaryrefslogtreecommitdiff
path: root/test/Sema
diff options
context:
space:
mode:
authorErik Pilkington <erik.pilkington@gmail.com>2019-03-26 23:21:22 +0000
committerErik Pilkington <erik.pilkington@gmail.com>2019-03-26 23:21:22 +0000
commit92053fee4de8009646eeb55af50c8715be29c6bf (patch)
tree8c673734071f9083042834ba56534670027719a7 /test/Sema
parentbec53e9a3fc9d04855588abd1021c762d48ea866 (diff)
Emit -Wfortify-source using DiagRuntimeBehaviour
This fixes a false positive on the following, where st is configured to have different sizes based on some preprocessor logic: if (sizeof(buf) == sizeof(*st)) memcpy(&buf, st, sizeof(*st)); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@357041 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema')
-rw-r--r--test/Sema/warn-fortify-source.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/test/Sema/warn-fortify-source.c b/test/Sema/warn-fortify-source.c
index 208ff6909f..3cd939a2d9 100644
--- a/test/Sema/warn-fortify-source.c
+++ b/test/Sema/warn-fortify-source.c
@@ -20,6 +20,9 @@ void call_memcpy() {
char dst[10];
char src[20];
memcpy(dst, src, 20); // expected-warning {{memcpy' will always overflow; destination buffer has size 10, but size argument is 20}}
+
+ if (sizeof(dst) == sizeof(src))
+ memcpy(dst, src, 20); // no warning, unreachable
}
void call_memcpy_type() {