* tree-cfg.c (mark_array_ref_addressable_1): New.
(mark_array_ref_addressable): New.
* tree-flow.h (mark_array_ref_addressable): Declare.
* tree-optimize.c (execute_cleanup_cfg_post_optimizing): Use it.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@105022
138bc75d-0d04-0410-961f-
82ee72b054a4
+2005-10-05 Richard Henderson <rth@redhat.com>
+
+ PR 23714
+ * tree-cfg.c (mark_array_ref_addressable_1): New.
+ (mark_array_ref_addressable): New.
+ * tree-flow.h (mark_array_ref_addressable): Declare.
+ * tree-optimize.c (execute_cleanup_cfg_post_optimizing): Use it.
+
2005-10-05 Andrew Pinski <pinskia@physics.uc.edu>
PR middle-end/20606
--- /dev/null
+// { dg-do compile }
+// { dg-options "-O2 -fnon-call-exceptions" }
+
+void run (void) {
+ float stack[1];
+ float *sp = stack;
+ try
+ {
+ float value2 = ((float) *(--sp));
+ float value1 = ((float) *(--sp));
+ *(sp++) = (value1 - value2);
+ }
+ catch (int *ex)
+ {
+ }
+}
}
}
+/* Mark the array of any remaining ARRAY_REFs as addressable. */
+
+static tree
+mark_array_ref_addressable_1 (tree *tp, int *walk_subtrees,
+ void *data ATTRIBUTE_UNUSED)
+{
+ tree t = *tp;
+
+ if (DECL_P (t) || TYPE_P (t))
+ *walk_subtrees = 0;
+ else if (TREE_CODE (t) == ARRAY_REF)
+ {
+ tree base = get_base_address (TREE_OPERAND (t, 0));
+ if (base && DECL_P (base))
+ TREE_ADDRESSABLE (base) = 1;
+ }
+
+ return NULL_TREE;
+}
+
+void
+mark_array_ref_addressable (void)
+{
+ basic_block bb;
+ block_stmt_iterator i;
+
+ FOR_EACH_BB (bb)
+ {
+ for (i = bsi_start (bb); !bsi_end_p(i); bsi_next(&i))
+ walk_tree (bsi_stmt_ptr (i), mark_array_ref_addressable_1, NULL, NULL);
+ }
+}
+
/* Join all the blocks in the flowgraph. */
static void
tree, tree, tree, tree);
extern void init_empty_tree_cfg (void);
extern void fold_cond_expr_cond (void);
+extern void mark_array_ref_addressable (void);
extern void replace_uses_by (tree, tree);
extern void start_recording_case_labels (void);
extern void end_recording_case_labels (void);
execute_cleanup_cfg_post_optimizing (void)
{
fold_cond_expr_cond ();
+ mark_array_ref_addressable ();
cleanup_tree_cfg ();
cleanup_dead_labels ();
group_case_labels ();