diff options
author | mpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-06-30 13:15:20 +0000 |
---|---|---|
committer | mpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-06-30 13:15:20 +0000 |
commit | 7057506456ba18f080679b2fe55ec56ee90fd81c (patch) | |
tree | d9fbba8c55ca2e01e66ea39234d507306dac9bed /gcc/testsuite/g++.dg/ubsan | |
parent | 31dca860933170b72971877a25943d799ccdfc5c (diff) | |
download | gcc-7057506456ba18f080679b2fe55ec56ee90fd81c.tar.gz |
* convert.c (convert_to_integer): Don't instrument conversions if the
function has no_sanitize_undefined attribute.
* ubsan.c: Don't run the ubsan pass if the function has
no_sanitize_undefined attribute.
c/
* c-decl.c (grokdeclarator): Don't instrument VLAs if the function
has no_sanitize_undefined attribute.
cp/
* cp-gimplify.c (cp_genericize): Don't instrument returns if the
function has no_sanitize_undefined attribute.
* decl.c (compute_array_index_type): Don't instrument VLAs if the
function has no_sanitize_undefined attribute.
testsuite/
* c-c++-common/ubsan/attrib-2.c: New test.
* g++.dg/ubsan/return-3.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@212148 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/g++.dg/ubsan')
-rw-r--r-- | gcc/testsuite/g++.dg/ubsan/return-3.C | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/ubsan/return-3.C b/gcc/testsuite/g++.dg/ubsan/return-3.C new file mode 100644 index 00000000000..95f345deb32 --- /dev/null +++ b/gcc/testsuite/g++.dg/ubsan/return-3.C @@ -0,0 +1,27 @@ +// { dg-do compile } +// { dg-options "-fsanitize=return" } + +struct S { S (); ~S (); }; + +S::S () {} +S::~S () {} + +__attribute__((no_sanitize_undefined)) +int +foo (int x) +{ + S a; + { + S b; + if (x) + return 1; + } +} + +int +main () +{ + foo (0); +} + +// { dg-final { scan-assembler-not "__ubsan_handle" } } |