From fe4e7c6527eb4452c33a8df24e7d76b82ce1a18a Mon Sep 17 00:00:00 2001 From: Andrew Haley Date: Mon, 19 Jun 2006 17:38:08 +0000 Subject: re PR java/1305 ([JSR133] GCJ ignores volatile modifier) 2006-06-19 Andrew Haley PR java/1305 PR java/27908 * expr.c (java_modify_addr_for_volatile): New function. (expand_java_field_op): Handle volatile fields. * java-gimplify.c (java_gimplify_component_ref): Call java_modify_addr_for_volatile to give the field_ref the correct volatile type. (java_gimplify_modify_expr): Likewise. * java-tree.h (java_modify_addr_for_volatile): New decl. From-SVN: r114778 --- gcc/java/java-gimplify.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'gcc/java/java-gimplify.c') diff --git a/gcc/java/java-gimplify.c b/gcc/java/java-gimplify.c index 21c0641..54900d3 100644 --- a/gcc/java/java-gimplify.c +++ b/gcc/java/java-gimplify.c @@ -223,7 +223,8 @@ java_gimplify_exit_block_expr (tree expr) static enum gimplify_status java_gimplify_component_ref (tree *expr_p, tree *pre_p, tree *post_p) { - if (TREE_THIS_VOLATILE (TREE_OPERAND (*expr_p, 1)) + if (CLASS_FROM_SOURCE_P (output_class) + && TREE_THIS_VOLATILE (TREE_OPERAND (*expr_p, 1)) && ! TREE_THIS_VOLATILE (*expr_p)) { enum gimplify_status stat; @@ -246,6 +247,7 @@ java_gimplify_component_ref (tree *expr_p, tree *pre_p, tree *post_p) */ TREE_THIS_VOLATILE (*expr_p) = 1; + *expr_p = java_modify_addr_for_volatile (*expr_p); stat = gimplify_expr (expr_p, pre_p, post_p, is_gimple_formal_tmp_var, fb_rvalue); if (stat == GS_ERROR) @@ -273,7 +275,8 @@ java_gimplify_modify_expr (tree *modify_expr_p, tree *pre_p, tree *post_p) tree rhs = TREE_OPERAND (modify_expr, 1); tree lhs_type = TREE_TYPE (lhs); - if (TREE_CODE (lhs) == COMPONENT_REF + if (CLASS_FROM_SOURCE_P (output_class) + && TREE_CODE (lhs) == COMPONENT_REF && TREE_THIS_VOLATILE (TREE_OPERAND (lhs, 1))) { /* Special handling for volatile fields. @@ -308,6 +311,7 @@ java_gimplify_modify_expr (tree *modify_expr_p, tree *pre_p, tree *post_p) sync_expr, rhs); TREE_SIDE_EFFECTS (rhs) = 1; TREE_THIS_VOLATILE (lhs) = 1; + lhs = java_modify_addr_for_volatile (lhs); TREE_OPERAND (modify_expr, 0) = lhs; TREE_OPERAND (modify_expr, 1) = rhs; } -- cgit v1.1