diff options
author | Marek Polacek <polacek@redhat.com> | 2015-07-23 13:54:06 +0000 |
---|---|---|
committer | Marek Polacek <mpolacek@gcc.gnu.org> | 2015-07-23 13:54:06 +0000 |
commit | dc891fe75e30646dea032b06ab484d814c7e05b6 (patch) | |
tree | a2fc3d77b00bbd4499e2b82dfff536de8c0727c1 /gcc/testsuite | |
parent | 62fb67d77a7a68c5cfa7d78d751817b68ea78a87 (diff) | |
download | gcc-dc891fe75e30646dea032b06ab484d814c7e05b6.zip gcc-dc891fe75e30646dea032b06ab484d814c7e05b6.tar.gz gcc-dc891fe75e30646dea032b06ab484d814c7e05b6.tar.bz2 |
re PR sanitizer/66908 (Uninitialized variable when compiled with UBsan)
PR sanitizer/66908
* c-ubsan.c: Include gimplify.h.
(ubsan_instrument_division): Unshare OP0 and OP1.
(ubsan_instrument_shift): Likewise.
* c-c++-common/ubsan/pr66908.c: New test.
From-SVN: r226110
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/ubsan/pr66908.c | 15 |
2 files changed, 20 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3a6374c..9743f94 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-07-23 Marek Polacek <polacek@redhat.com> + + PR sanitizer/66908 + * c-c++-common/ubsan/pr66908.c: New test. + 2015-07-23 Tom de Vries <tom@codesourcery.com> * gcc.dg/autopar/outer-4.c: Add xfail. diff --git a/gcc/testsuite/c-c++-common/ubsan/pr66908.c b/gcc/testsuite/c-c++-common/ubsan/pr66908.c new file mode 100644 index 0000000..5f731f0 --- /dev/null +++ b/gcc/testsuite/c-c++-common/ubsan/pr66908.c @@ -0,0 +1,15 @@ +/* PR sanitizer/66908 */ +/* { dg-do compile } */ +/* { dg-options "-fsanitize=shift,bounds -O2 -Werror=maybe-uninitialized" } */ +/* { dg-additional-options "-std=gnu90" { target c } } */ + +struct S { int a[22]; }; +static int const e[22] = { }; + +void +foo (struct S const *s, unsigned int m, unsigned int *res) +{ + unsigned int i; + for (i = 0; i < 22; ++i) + res[i] = ((s->a[i] + e[i]) << m); +} |