re PR c++/77722 (-fsanitize=undefined doesn't give runtime error in function without...
authorJakub Jelinek <jakub@redhat.com>
Tue, 27 Sep 2016 18:15:21 +0000 (20:15 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 27 Sep 2016 18:15:21 +0000 (20:15 +0200)
commit459bcfb0bec5bb642685e0b54551995ab51fb156
tree08e55ef5b8d2b493e0bc44e07eef1794f49a4747
parentbbfac6da602bfe02c347edcb1639aa62ce63c2d4
re PR c++/77722 (-fsanitize=undefined doesn't give runtime error in function without return value, unless at least 2 instructions)

PR c++/77722
* cp-gimplify.c (cp_ubsan_maybe_instrument_return): Instrument also
functions that have just a STATEMENT_LIST instead of BIND_EXPR, or
BIND_EXPR with some statement rather than STATEMENT_LIST as body.

* g++.dg/ubsan/return-4.C: New test.
* g++.dg/ubsan/return-5.C: New test.
* g++.dg/ubsan/return-6.C: New test.

From-SVN: r240555
gcc/cp/ChangeLog
gcc/cp/cp-gimplify.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ubsan/return-4.C [new file with mode: 0644]
gcc/testsuite/g++.dg/ubsan/return-5.C [new file with mode: 0644]
gcc/testsuite/g++.dg/ubsan/return-6.C [new file with mode: 0644]