aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-ssa-sprintf.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@gcc.gnu.org>2017-01-03 08:20:04 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2017-01-03 08:20:04 +0100
commitcd123354c511316c020bf7ff7e4527989b440223 (patch)
tree4fa7ba8f61eb91be1857c52eae3cadc7f87666c4 /gcc/gimple-ssa-sprintf.c
parentd003cf5ef683191902c19cad6cd3d7ddf957dcde (diff)
downloadgcc-cd123354c511316c020bf7ff7e4527989b440223.zip
gcc-cd123354c511316c020bf7ff7e4527989b440223.tar.gz
gcc-cd123354c511316c020bf7ff7e4527989b440223.tar.bz2
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
Diffstat (limited to 'gcc/gimple-ssa-sprintf.c')
-rw-r--r--gcc/gimple-ssa-sprintf.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/gcc/gimple-ssa-sprintf.c b/gcc/gimple-ssa-sprintf.c
index 907a064..ecd2267 100644
--- a/gcc/gimple-ssa-sprintf.c
+++ b/gcc/gimple-ssa-sprintf.c
@@ -2696,9 +2696,15 @@ try_substitute_return_value (gimple_stmt_iterator *gsi,
the output overflows the destination object (but leave it enabled
when the function is bounded because then the behavior is well-
defined). */
- if (lhs && res.bounded && res.under4k
+ if (lhs
+ && res.bounded
+ && res.under4k
&& (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);