From a10623fb71eb10046cbd3d7ad7dc3b9cef781666 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Sun, 19 Sep 2010 13:18:26 +0000 Subject: decl.c (gnat_to_gnu_entity): Explicitly test _LEVEL variables against zero in all cases. * gcc-interface/decl.c (gnat_to_gnu_entity): Explicitly test _LEVEL variables against zero in all cases. (rest_of_type_decl_compilation): Likewise. * gcc-interface/trans.c (gigi): Pass properly typed constants to create_var_decl. (call_to_gnu): Fix formatting. (Handled_Sequence_Of_Statements_to_gnu): Likewise. (Exception_Handler_to_gnu_zcx): Likewise. (gnat_to_gnu) : Short-circuit handling of constant expressions in presence of a freeze node. From-SVN: r164415 --- gcc/ada/ChangeLog | 14 ++++++++++++++ gcc/ada/gcc-interface/decl.c | 9 +++++---- gcc/ada/gcc-interface/trans.c | 42 +++++++++++++++++++++++------------------- 3 files changed, 42 insertions(+), 23 deletions(-) (limited to 'gcc') diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index ade0440..713edf4 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,5 +1,19 @@ 2010-09-19 Eric Botcazou + * gcc-interface/decl.c (gnat_to_gnu_entity): Explicitly test _LEVEL + variables against zero in all cases. + (rest_of_type_decl_compilation): Likewise. + * gcc-interface/trans.c (gigi): Pass properly typed constants to + create_var_decl. + (call_to_gnu): Fix formatting. + (Handled_Sequence_Of_Statements_to_gnu): Likewise. + (Exception_Handler_to_gnu_zcx): Likewise. + (gnat_to_gnu) : Short-circuit handling of + constant + expressions in presence of a freeze node. + +2010-09-19 Eric Botcazou + * gcc-interface/decl.c (gnat_to_gnu_entity) : Look into expressions for external constants that are aggregates. * gcc-interface/utils2.c (build_simple_component_ref): If the field diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index 6d77ffb..850777d 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -3510,7 +3510,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) && TYPE_IS_DUMMY_P (TREE_TYPE (get_gnu_tree (gnat_desig_equiv)))) || (!in_main_unit - && defer_incomplete_level + && defer_incomplete_level != 0 && !present_gnu_tree (gnat_desig_equiv)) || (in_main_unit && is_from_limited_with @@ -3594,7 +3594,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) access type may be the full view of a private type. Note that the unconstrained array case is handled above. */ || ((!in_main_unit || imported_p) - && defer_incomplete_level + && defer_incomplete_level != 0 && !present_gnu_tree (gnat_desig_equiv) && (Is_Record_Type (gnat_desig_rep) || Is_Array_Type (gnat_desig_rep))) @@ -3728,7 +3728,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) Besides, variants of this non-dummy type might have been created along the way. update_pointer_to is expected to properly take care of those situations. */ - if (!defer_incomplete_level && !is_from_limited_with_in_main_unit) + if (defer_incomplete_level == 0 + && !is_from_limited_with_in_main_unit) update_pointer_to (TYPE_MAIN_VARIANT (gnu_old_desig_type), gnat_to_gnu_type (gnat_desig_equiv)); else @@ -5045,7 +5046,7 @@ rest_of_type_decl_compilation (tree decl) { /* We need to defer finalizing the type if incomplete types are being deferred or if they are being processed. */ - if (defer_incomplete_level || defer_finalize_level) + if (defer_incomplete_level != 0 || defer_finalize_level != 0) VEC_safe_push (tree, heap, defer_finalize_list, decl); else rest_of_type_decl_compilation_no_defer (decl); diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index b403189..028419b 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -593,12 +593,14 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED, others_decl = create_var_decl (get_identifier ("OTHERS"), get_identifier ("__gnat_others_value"), - integer_type_node, 0, 1, 0, 1, 1, 0, Empty); + integer_type_node, NULL_TREE, true, false, true, false, + NULL, Empty); all_others_decl = create_var_decl (get_identifier ("ALL_OTHERS"), get_identifier ("__gnat_all_others_value"), - integer_type_node, 0, 1, 0, 1, 1, 0, Empty); + integer_type_node, NULL_TREE, true, false, true, false, + NULL, Empty); main_identifier_node = get_identifier ("main"); @@ -2788,8 +2790,8 @@ call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target) /* Create an explicit temporary holding the copy. This ensures that its lifetime is as narrow as possible around a statement. */ gnu_temp = create_var_decl (create_tmp_var_name ("A"), NULL_TREE, - TREE_TYPE (gnu_name), NULL_TREE, false, - false, false, false, NULL, Empty); + TREE_TYPE (gnu_name), NULL_TREE, + false, false, false, false, NULL, Empty); DECL_ARTIFICIAL (gnu_temp) = 1; DECL_IGNORED_P (gnu_temp) = 1; @@ -3210,8 +3212,8 @@ Handled_Sequence_Of_Statements_to_gnu (Node_Id gnat_node) gnu_jmpsave_decl = create_var_decl (get_identifier ("JMPBUF_SAVE"), NULL_TREE, jmpbuf_ptr_type, build_call_0_expr (get_jmpbuf_decl), - false, false, false, false, NULL, - gnat_node); + false, false, false, false, + NULL, gnat_node); DECL_ARTIFICIAL (gnu_jmpsave_decl) = 1; /* The __builtin_setjmp receivers will immediately reinstall it. Now @@ -3220,8 +3222,8 @@ Handled_Sequence_Of_Statements_to_gnu (Node_Id gnat_node) it is uninitialized, although they will never be actually taken. */ TREE_NO_WARNING (gnu_jmpsave_decl) = 1; gnu_jmpbuf_decl = create_var_decl (get_identifier ("JMP_BUF"), - NULL_TREE, jmpbuf_type, - NULL_TREE, false, false, false, false, + NULL_TREE, jmpbuf_type, NULL_TREE, + false, false, false, false, NULL, gnat_node); DECL_ARTIFICIAL (gnu_jmpbuf_decl) = 1; @@ -3273,12 +3275,11 @@ Handled_Sequence_Of_Statements_to_gnu (Node_Id gnat_node) gnat_pushlevel (); VEC_safe_push (tree, gc, gnu_except_ptr_stack, - create_var_decl (get_identifier ("EXCEPT_PTR"), - NULL_TREE, + create_var_decl (get_identifier ("EXCEPT_PTR"), NULL_TREE, build_pointer_type (except_type_node), build_call_0_expr (get_excptr_decl), - false, - false, false, false, NULL, gnat_node)); + false, false, false, false, + NULL, gnat_node)); /* Generate code for each handler. The N_Exception_Handler case does the real work and returns a COND_EXPR for each handler, which we chain @@ -3537,8 +3538,8 @@ Exception_Handler_to_gnu_zcx (Node_Id gnat_node) 1, integer_zero_node); gnu_incoming_exc_ptr = create_var_decl (get_identifier ("EXPTR"), NULL_TREE, ptr_type_node, gnu_current_exc_ptr, - false, false, false, false, NULL, - gnat_node); + false, false, false, false, + NULL, gnat_node); add_stmt_with_node (build_call_1_expr (begin_handler_decl, gnu_incoming_exc_ptr), @@ -3997,13 +3998,16 @@ gnat_to_gnu (Node_Id gnat_node) is frozen. */ if (Present (Freeze_Node (gnat_temp))) { - if ((Is_Public (gnat_temp) || global_bindings_p ()) - && !TREE_CONSTANT (gnu_expr)) + bool public_flag = Is_Public (gnat_temp); + + if (TREE_CONSTANT (gnu_expr)) + ; + else if (public_flag || global_bindings_p ()) gnu_expr = create_var_decl (create_concat_name (gnat_temp, "init"), - NULL_TREE, TREE_TYPE (gnu_expr), - gnu_expr, false, Is_Public (gnat_temp), - false, false, NULL, gnat_temp); + NULL_TREE, TREE_TYPE (gnu_expr), gnu_expr, + false, public_flag, false, false, + NULL, gnat_temp); else gnu_expr = gnat_save_expr (gnu_expr); -- cgit v1.1