mirror of git://gcc.gnu.org/git/gcc.git
re PR middle-end/78901 (ICE: verify_gimple failed (error: statement marked for throw in middle of block))
PR middle-end/78901 * gimple-ssa-sprintf.c (try_substitute_return_value): Don't change possibly throwing calls. * g++.dg/opt/pr78901.C: New test. From-SVN: r244013
This commit is contained in:
parent
d003cf5ef6
commit
cd123354c5
|
|
@ -1,5 +1,9 @@
|
||||||
2017-01-03 Jakub Jelinek <jakub@redhat.com>
|
2017-01-03 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
|
PR middle-end/78901
|
||||||
|
* gimple-ssa-sprintf.c (try_substitute_return_value): Don't change
|
||||||
|
possibly throwing calls.
|
||||||
|
|
||||||
* genmatch.c (dt_node::gen_kids_1): If generic_exprs include SSA_NAME
|
* genmatch.c (dt_node::gen_kids_1): If generic_exprs include SSA_NAME
|
||||||
and exprs_len || fns_len, emit the code for SSA_NAME next to the exprs
|
and exprs_len || fns_len, emit the code for SSA_NAME next to the exprs
|
||||||
and fns handling, rather than in a separate case SSA_NAME.
|
and fns handling, rather than in a separate case SSA_NAME.
|
||||||
|
|
|
||||||
|
|
@ -2696,9 +2696,15 @@ try_substitute_return_value (gimple_stmt_iterator *gsi,
|
||||||
the output overflows the destination object (but leave it enabled
|
the output overflows the destination object (but leave it enabled
|
||||||
when the function is bounded because then the behavior is well-
|
when the function is bounded because then the behavior is well-
|
||||||
defined). */
|
defined). */
|
||||||
if (lhs && res.bounded && res.under4k
|
if (lhs
|
||||||
|
&& res.bounded
|
||||||
|
&& res.under4k
|
||||||
&& (info.bounded || res.number_chars <= info.objsize)
|
&& (info.bounded || res.number_chars <= info.objsize)
|
||||||
&& res.number_chars - 1 <= target_int_max ())
|
&& res.number_chars - 1 <= target_int_max ()
|
||||||
|
/* Not prepared to handle possibly throwing calls here; they shouldn't
|
||||||
|
appear in non-artificial testcases, except when the __*_chk routines
|
||||||
|
are badly declared. */
|
||||||
|
&& !stmt_ends_bb_p (info.callstmt))
|
||||||
{
|
{
|
||||||
tree cst = build_int_cst (integer_type_node, res.number_chars - 1);
|
tree cst = build_int_cst (integer_type_node, res.number_chars - 1);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,24 @@
|
||||||
|
2017-01-03 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
|
PR middle-end/78901
|
||||||
|
* g++.dg/opt/pr78901.C: New test.
|
||||||
|
|
||||||
2017-01-03 Janne Blomqvist <jb@gcc.gnu.org>
|
2017-01-03 Janne Blomqvist <jb@gcc.gnu.org>
|
||||||
|
|
||||||
PR fortran/78534
|
PR fortran/78534
|
||||||
PR fortran/66310
|
PR fortran/66310
|
||||||
* gfortran.dg/dependency_49.f90: Change scan-tree-dump-times
|
* gfortran.dg/dependency_49.f90: Change scan-tree-dump-times
|
||||||
due to gfc_trans_string_copy change to avoid
|
due to gfc_trans_string_copy change to avoid -Wstringop-overflow.
|
||||||
-Wstringop-overflow.
|
* gfortran.dg/repeat_4.f90: Use integers of kind C_SIZE_T.
|
||||||
* gfortran.dg/repeat_4.f90: Use integers of kind C_SIZE_T.
|
* gfortran.dg/repeat_7.f90: New test for PR 66310.
|
||||||
* gfortran.dg/repeat_7.f90: New test for PR 66310.
|
* gfortran.dg/scan_2.f90: Handle potential cast in assignment.
|
||||||
* gfortran.dg/scan_2.f90: Handle potential cast in assignment.
|
* gfortran.dg/string_1.f90: Limit to ilp32 targets.
|
||||||
* gfortran.dg/string_1.f90: Limit to ilp32 targets.
|
* gfortran.dg/string_1_lp64.f90: New test.
|
||||||
* gfortran.dg/string_1_lp64.f90: New test.
|
* gfortran.dg/string_3.f90: Limit to ilp32 targets.
|
||||||
* gfortran.dg/string_3.f90: Limit to ilp32 targets.
|
* gfortran.dg/string_3_lp64.f90: New test.
|
||||||
* gfortran.dg/string_3_lp64.f90: New test.
|
* gfortran.dg/transfer_intrinsic_1.f90: Change
|
||||||
* gfortran.dg/transfer_intrinsic_1.f90: Change
|
scan-tree-dump-times due to gfc_trans_string_copy change to
|
||||||
scan-tree-dump-times due to gfc_trans_string_copy change to
|
avoid -Wstringop-overflow.
|
||||||
avoid -Wstringop-overflow.
|
|
||||||
|
|
||||||
2017-01-02 Uros Bizjak <ubizjak@gmail.com>
|
2017-01-02 Uros Bizjak <ubizjak@gmail.com>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
// PR middle-end/78901
|
||||||
|
// { dg-do compile }
|
||||||
|
// { dg-options "-O2 -Wno-stringop-overflow" }
|
||||||
|
|
||||||
|
extern "C" int __snprintf_chk (char *, __SIZE_TYPE__, int, __SIZE_TYPE__, const char *, ...);
|
||||||
|
|
||||||
|
int
|
||||||
|
foo (char *c)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return __snprintf_chk (c, 64, 0, 32, "%s", "abcdefghijklmnopq");
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue