diff options
author | Jakub Jelinek <jakub@redhat.com> | 2016-08-12 21:56:26 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2016-08-12 21:56:26 +0200 |
commit | b0cea284970de2f81be3a0564afa10a15f7802d6 (patch) | |
tree | 452ba5392a5f769e1c601d722988d77bf90bf45b /gcc/ubsan.c | |
parent | e86aefb8e955a9545ffd16c960ff70cbad5fc9ad (diff) | |
download | gcc-b0cea284970de2f81be3a0564afa10a15f7802d6.zip gcc-b0cea284970de2f81be3a0564afa10a15f7802d6.tar.gz gcc-b0cea284970de2f81be3a0564afa10a15f7802d6.tar.bz2 |
re PR c/71512 (ICE: verify_gimple failed with UBSAN)
PR c/71512
* ubsan.c (instrument_si_overflow): Pass true instead of false
to gsi_replace.
(pass_ubsan::execute): Call gimple_purge_dead_eh_edges at the end
of bbs. Return TODO_cleanup_cfg if any returned true.
* g++.dg/ubsan/pr71512.C: New test.
* c-c++-common/ubsan/pr71512-1.c: New test.
* c-c++-common/ubsan/pr71512-2.c: New test.
From-SVN: r239430
Diffstat (limited to 'gcc/ubsan.c')
-rw-r--r-- | gcc/ubsan.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/gcc/ubsan.c b/gcc/ubsan.c index 8ee57d5..a118af2 100644 --- a/gcc/ubsan.c +++ b/gcc/ubsan.c @@ -1292,7 +1292,7 @@ instrument_si_overflow (gimple_stmt_iterator gsi) ? IFN_UBSAN_CHECK_SUB : IFN_UBSAN_CHECK_MUL, 2, a, b); gimple_call_set_lhs (g, lhs); - gsi_replace (&gsi, g, false); + gsi_replace (&gsi, g, true); break; case NEGATE_EXPR: /* Represent i = -u; @@ -1302,7 +1302,7 @@ instrument_si_overflow (gimple_stmt_iterator gsi) b = gimple_assign_rhs1 (stmt); g = gimple_build_call_internal (IFN_UBSAN_CHECK_SUB, 2, a, b); gimple_call_set_lhs (g, lhs); - gsi_replace (&gsi, g, false); + gsi_replace (&gsi, g, true); break; case ABS_EXPR: /* Transform i = ABS_EXPR<u>; @@ -1955,6 +1955,7 @@ pass_ubsan::execute (function *fun) { basic_block bb; gimple_stmt_iterator gsi; + unsigned int ret = 0; initialize_sanitizer_builtins (); @@ -2013,8 +2014,10 @@ pass_ubsan::execute (function *fun) gsi_next (&gsi); } + if (gimple_purge_dead_eh_edges (bb)) + ret = TODO_cleanup_cfg; } - return 0; + return ret; } } // anon namespace |