aboutsummaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2022-10-21 12:48:02 +0200
committerMartin Liska <mliska@suse.cz>2022-10-21 12:48:02 +0200
commit5776a5ffab3b92d6ccac87ccf32c580ee2742d5a (patch)
treecbdbbff551198c5e4bba8d08d734ad74a1d0d684 /gcc/c
parent4465e2a047c3b175bf6c4ca500547eb6b12df52f (diff)
parentbf3b532b524ecacb3202ab2c8af419ffaaab7cff (diff)
downloadgcc-5776a5ffab3b92d6ccac87ccf32c580ee2742d5a.zip
gcc-5776a5ffab3b92d6ccac87ccf32c580ee2742d5a.tar.gz
gcc-5776a5ffab3b92d6ccac87ccf32c580ee2742d5a.tar.bz2
Merge branch 'master' into devel/sphinx
Diffstat (limited to 'gcc/c')
-rw-r--r--gcc/c/ChangeLog7
-rw-r--r--gcc/c/gimple-parser.cc10
2 files changed, 17 insertions, 0 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index 7cb2e9c..76fe5fe 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,3 +1,10 @@
+2022-10-20 Richard Biener <rguenther@suse.de>
+
+ PR c/107305
+ PR c/107306
+ * gimple-parser.cc (c_parser_parse_gimple_body): Verify
+ the parsed IL and zap the body on error.
+
2022-10-18 Joseph Myers <joseph@codesourcery.com>
PR c/107164
diff --git a/gcc/c/gimple-parser.cc b/gcc/c/gimple-parser.cc
index 5a2da2c..18ed4d4 100644
--- a/gcc/c/gimple-parser.cc
+++ b/gcc/c/gimple-parser.cc
@@ -364,6 +364,16 @@ c_parser_parse_gimple_body (c_parser *cparser, char *gimple_pass,
cgraph_node::get_create (cfun->decl);
cgraph_edge::rebuild_edges ();
}
+
+ /* Perform IL validation and if any error is found abort compilation
+ of this function by zapping its body. */
+ if ((cfun->curr_properties & PROP_cfg)
+ && verify_gimple_in_cfg (cfun, false, false))
+ init_empty_tree_cfg ();
+ else if (!(cfun->curr_properties & PROP_cfg)
+ && verify_gimple_in_seq (gimple_body (current_function_decl), false))
+ gimple_set_body (current_function_decl, NULL);
+
dump_function (TDI_gimple, current_function_decl);
}