gcc/
        * gimple.h (gimple_eh_filter_set_types): Require a gimple_eh_filter.
        (gimple_eh_filter_set_failure): Likewise.
        * gimple.c (gimple_copy): Add checked casts to gimple_eh_filter
        within GIMPLE_EH_FILTER case.
---
 gcc/gimple.c | 13 +++++++++----
 gcc/gimple.h | 14 ++++++--------
 2 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/gcc/gimple.c b/gcc/gimple.c
index 5f75b6c..e02d24a 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -1664,10 +1664,15 @@ gimple_copy (gimple stmt)
          break;
 
        case GIMPLE_EH_FILTER:
-         new_seq = gimple_seq_copy (gimple_eh_filter_failure (stmt));
-         gimple_eh_filter_set_failure (copy, new_seq);
-         t = unshare_expr (gimple_eh_filter_types (stmt));
-         gimple_eh_filter_set_types (copy, t);
+         {
+           gimple_eh_filter eh_filter_stmt = stmt->as_a_gimple_eh_filter ();
+           gimple_eh_filter eh_filter_copy = copy->as_a_gimple_eh_filter ();
+           new_seq =
+             gimple_seq_copy (gimple_eh_filter_failure (eh_filter_stmt));
+           gimple_eh_filter_set_failure (eh_filter_copy, new_seq);
+           t = unshare_expr (gimple_eh_filter_types (eh_filter_stmt));
+           gimple_eh_filter_set_types (eh_filter_copy, t);
+         }
          break;
 
        case GIMPLE_EH_ELSE:
diff --git a/gcc/gimple.h b/gcc/gimple.h
index d54d011..fcc3bb7 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -3892,25 +3892,23 @@ gimple_eh_filter_failure (gimple gs)
 }
 
 
-/* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS.  */
+/* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER
+   EH_FILTER_STMT.  */
 
 static inline void
-gimple_eh_filter_set_types (gimple gs, tree types)
+gimple_eh_filter_set_types (gimple_eh_filter eh_filter_stmt, tree types)
 {
-  gimple_statement_eh_filter *eh_filter_stmt =
-    as_a <gimple_statement_eh_filter> (gs);
   eh_filter_stmt->types = types;
 }
 
 
 /* Set FAILURE to be the sequence of statements to execute on failure
-   for GIMPLE_EH_FILTER GS.  */
+   for GIMPLE_EH_FILTER EH_FILTER_STMT.  */
 
 static inline void
-gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
+gimple_eh_filter_set_failure (gimple_eh_filter eh_filter_stmt,
+                             gimple_seq failure)
 {
-  gimple_statement_eh_filter *eh_filter_stmt =
-    as_a <gimple_statement_eh_filter> (gs);
   eh_filter_stmt->failure = failure;
 }
 
-- 
1.8.5.3

Reply via email to