diff options
author | Erick Ochoa <erick.ochoa@theobroma-systems.com> | 2020-08-30 10:21:35 +0200 |
---|---|---|
committer | Erick Ochoa <erick.ochoa@theobroma-systems.com> | 2020-08-30 10:22:34 +0200 |
commit | 9048cc889bcfa93f91b7f417dd040be5162229dd (patch) | |
tree | fdf4fe53d99ec8b50afa5a10e30ead4300fcef6c | |
parent | 9bb2c0ae701e84e600c132d2813dbbdde455ec1b (diff) |
Abort if unknown syntax is encountereddfe-v1
-rw-r--r-- | gcc/ipa-field-reorder.c | 3 | ||||
-rw-r--r-- | gcc/ipa-type-escape-analysis.c | 27 | ||||
-rw-r--r-- | gcc/ipa-type-escape-analysis.h | 2 |
3 files changed, 29 insertions, 3 deletions
diff --git a/gcc/ipa-field-reorder.c b/gcc/ipa-field-reorder.c index f67928f012f0..2f4b79429668 100644 --- a/gcc/ipa-field-reorder.c +++ b/gcc/ipa-field-reorder.c @@ -587,6 +587,7 @@ lto_fr_execute () { log ("here in field reordering \n"); // Analysis. + detected_incompatible_syntax = false; tpartitions_t escaping_nonescaping_sets = partition_types_into_escaping_nonescaping (); record_field_map_t record_field_map = find_fields_accessed (); @@ -594,7 +595,7 @@ lto_fr_execute () = obtain_nonescaping_unaccessed_fields (escaping_nonescaping_sets, record_field_map, 0); - if (record_field_offset_map.empty ()) + if (detected_incompatible_syntax || record_field_offset_map.empty ()) return 0; // Prepare for transformation. diff --git a/gcc/ipa-type-escape-analysis.c b/gcc/ipa-type-escape-analysis.c index d5f03794fdd6..a23d1810929e 100644 --- a/gcc/ipa-type-escape-analysis.c +++ b/gcc/ipa-type-escape-analysis.c @@ -170,6 +170,10 @@ along with GCC; see the file COPYING3. If not see #include "ipa-type-escape-analysis.h" #include "ipa-dfe.h" +#define ABORT_IF_NOT_C true + +bool detected_incompatible_syntax = false; + // Main function that drives dfe. static unsigned int lto_dfe_execute (); @@ -256,13 +260,14 @@ static void lto_dead_field_elimination () { // Analysis. + detected_incompatible_syntax = false; tpartitions_t escaping_nonescaping_sets = partition_types_into_escaping_nonescaping (); record_field_map_t record_field_map = find_fields_accessed (); record_field_offset_map_t record_field_offset_map = obtain_nonescaping_unaccessed_fields (escaping_nonescaping_sets, record_field_map, OPT_Wdfa); - if (record_field_offset_map.empty ()) + if (detected_incompatible_syntax || record_field_offset_map.empty ()) return; // Prepare for transformation. @@ -669,7 +674,11 @@ TypeWalker::_walk (const_tree type) default: { log ("missing %s\n", get_tree_code_name (code)); +#ifdef ABORT_IF_NOT_C + detected_incompatible_syntax = true; +#else gcc_unreachable (); +#endif } break; } @@ -936,7 +945,11 @@ ExprWalker::_walk (const_tree e) default: { log ("missing %s\n", get_tree_code_name (code)); +#ifdef ABORT_IF_NOT_C + detected_incompatible_syntax = true; +#else gcc_unreachable (); +#endif } break; } @@ -1415,7 +1428,11 @@ GimpleWalker::_walk_gimple (gimple *stmt) // Break if something is unexpected. const char *name = gimple_code_name[code]; log ("gimple code name %s\n", name); +#ifdef ABORT_IF_NOT_C + detected_incompatible_syntax = true; +#else gcc_unreachable (); +#endif } void @@ -3216,7 +3233,12 @@ TypeStructuralEquality::_equal (const_tree l, const_tree r) TSE_CASE (FUNCTION_TYPE); TSE_CASE (METHOD_TYPE); default: - gcc_unreachable (); +#ifdef ABORT_IF_NOT_C + detected_incompatible_syntax = true; + return false; +#else + gcc_unreachable (); +#endif break; } @@ -3415,3 +3437,4 @@ make_pass_ipa_type_escape_analysis (gcc::context *ctx) { return new pass_ipa_type_escape_analysis (ctx); } + diff --git a/gcc/ipa-type-escape-analysis.h b/gcc/ipa-type-escape-analysis.h index 5faa723a6a67..8b9911ace1e5 100644 --- a/gcc/ipa-type-escape-analysis.h +++ b/gcc/ipa-type-escape-analysis.h @@ -1165,4 +1165,6 @@ obtain_nonescaping_unaccessed_fields (tpartitions_t casting, record_field_map_t record_field_map, int warning); +extern bool detected_incompatible_syntax; + #endif /* GCC_IPA_TYPE_ESCAPE_ANALYSIS_H */ |