diff options
author | Denis Khalikov <d.khalikov@partner.samsung.com> | 2017-04-13 14:52:23 +0000 |
---|---|---|
committer | Maxim Ostapenko <chefmax@gcc.gnu.org> | 2017-04-13 17:52:23 +0300 |
commit | abac4c3400842a20e3f09714134377ae8133ee95 (patch) | |
tree | 5b7d0a266ba8621da1826fad0f8009fa4d0b9fc4 /gcc/testsuite/c-c++-common | |
parent | 3535a0fb6f43d4d985f3bbf9699bc3eea4fb64b0 (diff) | |
download | gcc-abac4c3400842a20e3f09714134377ae8133ee95.zip gcc-abac4c3400842a20e3f09714134377ae8133ee95.tar.gz gcc-abac4c3400842a20e3f09714134377ae8133ee95.tar.bz2 |
re PR sanitizer/80414 ([UBSAN] segfault with -fsanitize=undefined)
PR sanitizer/80414
* ubsan.c (ubsan_expand_bounds_ifn): Pass original index
to ubsan_encode_value.
* c-c++-common/ubsan/bounds-15.c: New test.
From-SVN: r246909
Diffstat (limited to 'gcc/testsuite/c-c++-common')
-rw-r--r-- | gcc/testsuite/c-c++-common/ubsan/bounds-15.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/testsuite/c-c++-common/ubsan/bounds-15.c b/gcc/testsuite/c-c++-common/ubsan/bounds-15.c new file mode 100644 index 0000000..5fa8eee --- /dev/null +++ b/gcc/testsuite/c-c++-common/ubsan/bounds-15.c @@ -0,0 +1,13 @@ +/* { dg-do run } */ +/* { dg-options "-fsanitize=bounds" } */ +/* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */ + +int main() +{ + long long offset = 10; + char array[10]; + char c = array[offset]; + return 0; +} + +/* { dg-output "index 10 out of bounds for type 'char \\\[10\\\]'" } */ |