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
This commit is contained in:
parent
e86aefb8e9
commit
b0cea28497
|
@ -1,3 +1,11 @@
|
|||
2016-08-12 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
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.
|
||||
|
||||
2016-08-12 Michael Meissner <meissner@linux.vnet.ibm.com>
|
||||
|
||||
* config/rs6000/vsx.md (vsx_concat_<mode>): Add support for the
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
2016-08-12 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR c/71512
|
||||
* 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.
|
||||
|
||||
2016-08-12 Michael Meissner <meissner@linux.vnet.ibm.com>
|
||||
|
||||
* gcc.target/powerpc/vec-init-1.c: New tests to test various
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
/* PR c/71512 */
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O2 -fnon-call-exceptions -ftrapv -fexceptions -fsanitize=undefined" } */
|
||||
|
||||
#include "../../gcc.dg/pr44545.c"
|
|
@ -0,0 +1,5 @@
|
|||
/* PR c/71512 */
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O -fexceptions -fnon-call-exceptions -ftrapv -fsanitize=undefined" } */
|
||||
|
||||
#include "../../gcc.dg/pr47086.c"
|
|
@ -0,0 +1,20 @@
|
|||
/* PR c/71512 */
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O2 -ftrapv -fnon-call-exceptions -fsanitize=undefined" } */
|
||||
|
||||
bool
|
||||
foo (int *x, int *y, int *z)
|
||||
{
|
||||
try
|
||||
{
|
||||
x[0] = y[0] + z[0];
|
||||
x[1] = y[1] - z[1];
|
||||
x[2] = y[2] * z[2];
|
||||
x[3] = -y[3];
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue