diff options
Diffstat (limited to 'gcc/ada/gcc-interface/trans.cc')
-rw-r--r-- | gcc/ada/gcc-interface/trans.cc | 52 |
1 files changed, 34 insertions, 18 deletions
diff --git a/gcc/ada/gcc-interface/trans.cc b/gcc/ada/gcc-interface/trans.cc index e02804b..fd1d39c 100644 --- a/gcc/ada/gcc-interface/trans.cc +++ b/gcc/ada/gcc-interface/trans.cc @@ -1510,7 +1510,7 @@ Pragma_to_gnu (Node_Id gnat_node) const location_t location = input_location; struct cl_option_handlers handlers; unsigned int option_index; - diagnostic_t kind; + enum diagnostics::kind kind; bool imply; gnat_temp = First (Pragma_Argument_Associations (gnat_node)); @@ -1521,12 +1521,12 @@ Pragma_to_gnu (Node_Id gnat_node) switch (id) { case Pragma_Warning_As_Error: - kind = DK_ERROR; + kind = diagnostics::kind::error; imply = false; break; case Pragma_Warnings: - kind = DK_WARNING; + kind = diagnostics::kind::warning; imply = true; break; @@ -1543,11 +1543,11 @@ Pragma_to_gnu (Node_Id gnat_node) switch (Chars (Expression (gnat_temp))) { case Name_Off: - kind = DK_IGNORED; + kind = diagnostics::kind::ignored; break; case Name_On: - kind = DK_WARNING; + kind = diagnostics::kind::warning; break; default: @@ -1569,7 +1569,7 @@ Pragma_to_gnu (Node_Id gnat_node) gnat_expr = Empty; /* For pragma Warnings (Off), we save the current state... */ - if (kind == DK_IGNORED) + if (kind == diagnostics::kind::ignored) diagnostic_push_diagnostics (global_dc, location); /* ...so that, for pragma Warnings (On), we do not enable all @@ -4049,7 +4049,7 @@ Subprogram_Body_to_gnu (Node_Id gnat_node) tree gnu_decl; /* Skip any entries that have been already filled in; they must - correspond to In Out parameters. */ + correspond to In Out parameters or previous Out parameters. */ while (gnu_cico_entry && TREE_VALUE (gnu_cico_entry)) gnu_cico_entry = TREE_CHAIN (gnu_cico_entry); @@ -4059,11 +4059,22 @@ Subprogram_Body_to_gnu (Node_Id gnat_node) if (DECL_BY_REF_P (gnu_decl)) gnu_decl = build_unary_op (INDIRECT_REF, NULL_TREE, gnu_decl); - /* Do any needed references for padded types. */ - TREE_VALUE (gnu_cico_entry) - = convert (TREE_TYPE (TREE_PURPOSE (gnu_cico_entry)), gnu_decl); + TREE_VALUE (gnu_cico_entry) = gnu_decl; } + + /* Finally, ensure type consistency between TREE_PURPOSE and TREE_VALUE + so that the assignment of the latter to the former can be done. */ + tree gnu_cico_entry = gnu_cico_list; + while (gnu_cico_entry) + { + if (!VOID_TYPE_P (TREE_VALUE (gnu_cico_entry))) + TREE_VALUE (gnu_cico_entry) + = convert (TREE_TYPE (TREE_PURPOSE (gnu_cico_entry)), + TREE_VALUE (gnu_cico_entry)); + gnu_cico_entry = TREE_CHAIN (gnu_cico_entry); + } } + else vec_safe_push (gnu_return_label_stack, NULL_TREE); @@ -4161,9 +4172,13 @@ Subprogram_Body_to_gnu (Node_Id gnat_node) } } - /* Otherwise, if this is a procedure or a function which does not return - by invisible reference, we can do a direct block-copy out. */ - else + /* Otherwise, if this is a procedure or a function that does not return + by invisible reference, we can do a direct block-copy out, but we do + not need to do it for a null initialization procedure when the _Init + parameter is not passed in since we would copy uninitialized bits. */ + else if (!(Is_Null_Init_Proc (gnat_subprog) + && list_length (gnu_cico_list) == 1 + && TREE_CODE (TREE_VALUE (gnu_cico_list)) == VAR_DECL)) { tree gnu_retval; @@ -8461,7 +8476,8 @@ gnat_to_gnu (Node_Id gnat_node) oconstraints[i] = constraint; if (parse_output_constraint (&constraint, i, ninputs, noutputs, - &allows_mem, &allows_reg, &fake)) + &allows_mem, &allows_reg, &fake, + nullptr)) { /* If the operand is going to end up in memory, mark it addressable. Note that we don't test @@ -8489,9 +8505,9 @@ gnat_to_gnu (Node_Id gnat_node) constraint = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (tail))); - if (parse_input_constraint (&constraint, i, ninputs, noutputs, - 0, oconstraints, - &allows_mem, &allows_reg)) + if (parse_input_constraint (&constraint, i, ninputs, noutputs, 0, + oconstraints, &allows_mem, + &allows_reg, nullptr)) { /* If the operand is going to end up in memory, mark it addressable. */ @@ -8737,7 +8753,7 @@ gnat_to_gnu (Node_Id gnat_node) /* Set the location information on the result if it's not a simple name or something that contains a simple name, for example a tag, because - we don"t want all the references to get the location of the first use. + we don't want all the references to get the location of the first use. Note that we may have no result if we tried to build a CALL_EXPR node to a procedure with no side-effects and optimization is enabled. */ else if (kind != N_Identifier |