aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
AgeCommit message (Collapse)AuthorFilesLines
2024-09-10Daily bump.GCC Administrator1-0/+6
2024-09-09diagnostics: rename dc.printer to m_printer [PR116613]David Malcolm1-3/+3
Rename diagnostic_context's "printer" field to "m_printer", for consistency with other fields, and to highlight places where we currently use this, to help assess feasibility of supporting multiple output sinks (PR other/116613). No functional change intended. gcc/ChangeLog: PR other/116613 * attribs.cc (decls_mismatched_attributes): Rename diagnostic_context's "printer" field to "m_printer". (attr_access::array_as_string): Likewise. * diagnostic-format-json.cc (json_output_format::on_report_diagnostic): Likewise. (diagnostic_output_format_init_json): Likewise. * diagnostic-format-sarif.cc (sarif_result::on_nested_diagnostic): Likewise. (sarif_ice_notification): Likewise. (sarif_builder::on_report_diagnostic): Likewise. (sarif_builder::make_result_object): Likewise. (sarif_builder::make_location_object): Likewise. (sarif_builder::make_message_object_for_diagram): Likewise. (diagnostic_output_format_init_sarif): Likewise. * diagnostic-format-text.cc (diagnostic_text_output_format::~diagnostic_text_output_format): Likewise. (diagnostic_text_output_format::on_report_diagnostic): Likewise. (diagnostic_text_output_format::on_diagram): Likewise. (diagnostic_text_output_format::print_any_cwe): Likewise. (diagnostic_text_output_format::print_any_rules): Likewise. (diagnostic_text_output_format::print_option_information): Likewise. * diagnostic-format.h (diagnostic_output_format::get_printer): New. * diagnostic-global-context.cc (verbatim): Rename diagnostic_context's "printer" field to "m_printer". * diagnostic-path.cc (path_label::get_text): Likewise. (print_path_summary_as_text): Likewise. (diagnostic_context::print_path): Likewise. (selftest::test_empty_path): Likewise. (selftest::test_intraprocedural_path): Likewise. (selftest::test_interprocedural_path_1): Likewise. (selftest::test_interprocedural_path_2): Likewise. (selftest::test_recursion): Likewise. (selftest::test_control_flow_1): Likewise. (selftest::test_control_flow_2): Likewise. (selftest::test_control_flow_3): Likewise. (assert_cfg_edge_path_streq): Likewise. (selftest::test_control_flow_5): Likewise. (selftest::test_control_flow_6): Likewise. * diagnostic-show-locus.cc (layout::layout): Likewise. (selftest::test_layout_x_offset_display_utf8): Likewise. (selftest::test_layout_x_offset_display_tab): Likewise. (selftest::test_diagnostic_show_locus_unknown_location): Likewise. (selftest::test_one_liner_simple_caret): Likewise. (selftest::test_one_liner_no_column): Likewise. (selftest::test_one_liner_caret_and_range): Likewise. (selftest::test_one_liner_multiple_carets_and_ranges): Likewise. (selftest::test_one_liner_fixit_insert_before): Likewise. (selftest::test_one_liner_fixit_insert_after): Likewise. (selftest::test_one_liner_fixit_remove): Likewise. (selftest::test_one_liner_fixit_replace): Likewise. (selftest::test_one_liner_fixit_replace_non_equal_range): Likewise. (selftest::test_one_liner_fixit_replace_equal_secondary_range): Likewise. (selftest::test_one_liner_fixit_validation_adhoc_locations): Likewise. (selftest::test_one_liner_many_fixits_1): Likewise. (selftest::test_one_liner_many_fixits_2): Likewise. (selftest::test_one_liner_labels): Likewise. (selftest::test_one_liner_simple_caret_utf8): Likewise. (selftest::test_one_liner_caret_and_range_utf8): Likewise. (selftest::test_one_liner_multiple_carets_and_ranges_utf8): Likewise. (selftest::test_one_liner_fixit_insert_before_utf8): Likewise. (selftest::test_one_liner_fixit_insert_after_utf8): Likewise. (selftest::test_one_liner_fixit_remove_utf8): Likewise. (selftest::test_one_liner_fixit_replace_utf8): Likewise. (selftest::test_one_liner_fixit_replace_non_equal_range_utf8): Likewise. (selftest::test_one_liner_fixit_replace_equal_secondary_range_utf8): Likewise. (selftest::test_one_liner_fixit_validation_adhoc_locations_utf8): Likewise. (selftest::test_one_liner_many_fixits_1_utf8): Likewise. (selftest::test_one_liner_many_fixits_2_utf8): Likewise. (selftest::test_one_liner_labels_utf8): Likewise. (selftest::test_one_liner_colorized_utf8): Likewise. (selftest::test_add_location_if_nearby): Likewise. (selftest::test_diagnostic_show_locus_fixit_lines): Likewise. (selftest::test_overlapped_fixit_printing): Likewise. (selftest::test_overlapped_fixit_printing_utf8): Likewise. (selftest::test_overlapped_fixit_printing_2): Likewise. (selftest::test_fixit_insert_containing_newline): Likewise. (selftest::test_fixit_insert_containing_newline_2): Likewise. (selftest::test_fixit_replace_containing_newline): Likewise. (selftest::test_fixit_deletion_affecting_newline): Likewise. (selftest::test_tab_expansion): Likewise. (selftest::test_escaping_bytes_1): Likewise. (selftest::test_escaping_bytes_2): Likewise. (selftest::test_line_numbers_multiline_range): Likewise. * diagnostic.cc (file_name_as_prefix): Likewise. (diagnostic_set_caret_max_width): Likewise. (diagnostic_context::initialize): Likewise. (diagnostic_context::color_init): Likewise. (diagnostic_context::urls_init): Likewise. (diagnostic_context::finish): Likewise. (diagnostic_context::get_location_text): Likewise. (diagnostic_build_prefix): Likewise. (diagnostic_context::report_current_module): Likewise. (default_diagnostic_starter): Likewise. (default_diagnostic_start_span_fn): Likewise. (default_diagnostic_finalizer): Likewise. (diagnostic_context::report_diagnostic): Likewise. (diagnostic_append_note): Likewise. (diagnostic_context::error_recursion): Likewise. (fancy_abort): Likewise. * diagnostic.h (diagnostic_context::set_show_highlight_colors): Likewise. (diagnostic_context::printer): Rename to... (diagnostic_context::m_printer): ...this. (diagnostic_format_decoder): Rename diagnostic_context's "printer" field to "m_printer". (diagnostic_prefixing_rule): Likewise. (diagnostic_ready_p): Likewise. * gimple-ssa-warn-access.cc (pass_waccess::maybe_warn_memmodel): Likewise. * langhooks.cc (lhd_print_error_function): Likewise. * lto-wrapper.cc (print_lto_docs_link): Likewise. * opts-global.cc (init_options_once): Likewise. * opts.cc (common_handle_option): Likewise. * simple-diagnostic-path.cc (simple_diagnostic_path_cc_tests): Likewise. * text-art/dump.h (dump_to_file<T>): Likewise. * toplev.cc (announce_function): Likewise. (toplev::main): Likewise. * tree-diagnostic.cc (default_tree_diagnostic_starter): Likewise. * tree.cc (escaped_string::escape): Likewise. (selftest::test_escaped_strings): Likewise. gcc/ada/ChangeLog: PR other/116613 * gcc-interface/misc.cc (internal_error_function): Rename diagnostic_context's "printer" field to "m_printer". gcc/analyzer/ChangeLog: PR other/116613 * access-diagram.cc (access_range::dump): Rename diagnostic_context's "printer" field to "m_printer". * analyzer-language.cc (on_finish_translation_unit): Likewise. * analyzer.cc (make_label_text): Likewise. (make_label_text_n): Likewise. * call-details.cc (call_details::dump): Likewise. * call-summary.cc (call_summary::dump): Likewise. (call_summary_replay::dump): Likewise. * checker-event.cc (checker_event::debug): Likewise. * constraint-manager.cc (range::dump): Likewise. (bounded_range::dump): Likewise. (bounded_ranges::dump): Likewise. (constraint_manager::dump): Likewise. * diagnostic-manager.cc (diagnostic_manager::emit_saved_diagnostic): Likewise. * engine.cc (exploded_node::dump): Likewise. (exploded_path::dump): Likewise. (run_checkers): Likewise. * kf-analyzer.cc (kf_analyzer_dump_escaped::impl_call_pre): Likewise. * pending-diagnostic.cc (evdesc::event_desc::formatted_print): Likewise. * program-point.cc (function_point::print_source_line): Likewise. (program_point::dump): Likewise. * program-state.cc (extrinsic_state::dump_to_file): Likewise. (sm_state_map::dump): Likewise. (program_state::dump_to_file): Likewise. * ranges.cc (symbolic_byte_offset::dump): Likewise. (symbolic_byte_range::dump): Likewise. * region-model-reachability.cc (reachable_regions::dump): Likewise. * region-model.cc (region_to_value_map::dump): Likewise. (region_model::dump): Likewise. (model_merger::dump): Likewise. * region.cc (region_offset::dump): Likewise. (region::dump): Likewise. * sm-malloc.cc (deallocator_set::dump): Likewise. (sufficiently_similar_p): Likewise. * store.cc (uncertainty_t::dump): Likewise. (binding_key::dump): Likewise. (binding_map::dump): Likewise. (binding_cluster::dump): Likewise. (store::dump): Likewise. * supergraph.cc (supergraph::dump_dot_to_file): Likewise. (superedge::dump): Likewise. * svalue.cc (svalue::dump): Likewise. gcc/c-family/ChangeLog: PR other/116613 * c-format.cc (selftest::test_type_mismatch_range_labels): Rename diagnostic_context's "printer" field to "m_printer". (selftest::test_type_mismatch_range_labels): Likewise. * c-opts.cc (c_diagnostic_finalizer): Likewise. gcc/c/ChangeLog: PR other/116613 * c-objc-common.cc (c_initialize_diagnostics): Rename diagnostic_context's "printer" field to "m_printer". gcc/cp/ChangeLog: PR other/116613 * error.cc (cxx_initialize_diagnostics): Rename diagnostic_context's "printer" field to "m_printer". (cxx_print_error_function): Likewise. (cp_diagnostic_starter): Likewise. (cp_print_error_function): Likewise. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context_line): Likewise. (maybe_print_constexpr_context): Likewise. (print_location): Likewise. (print_constrained_decl_info): Likewise. (print_concept_check_info): Likewise. (print_constraint_context_head): Likewise. (print_requires_expression_info): Likewise. * module.cc (noisy_p): Likewise. gcc/d/ChangeLog: PR other/116613 * d-diagnostic.cc (d_diagnostic_report_diagnostic): Rename diagnostic_context's "printer" field to "m_printer". gcc/fortran/ChangeLog: PR other/116613 * error.cc (gfc_clear_pp_buffer): Rename diagnostic_context's "printer" field to "m_printer". (gfc_warning): Likewise. (gfc_diagnostic_build_kind_prefix): Likewise. (gfc_diagnostic_build_locus_prefix): Likewise. (gfc_diagnostic_starter): Likewise. (gfc_diagnostic_starter): Likewise. (gfc_diagnostic_start_span): Likewise. (gfc_diagnostic_finalizer): Likewise. (gfc_warning_check): Likewise. (gfc_error_opt): Likewise. (gfc_error_check): Likewise. gcc/jit/ChangeLog: PR other/116613 * jit-playback.cc (add_diagnostic): Rename diagnostic_context's "printer" field to "m_printer". gcc/testsuite/ChangeLog: PR other/116613 * gcc.dg/plugin/analyzer_cpython_plugin.c (dump_refcnt_info): Update for renaming of field "printer" to "m_printer". * gcc.dg/plugin/diagnostic_group_plugin.c (test_diagnostic_starter): Likewise. (test_diagnostic_start_span_fn): Likewise. (test_output_format::on_begin_group): Likewise. (test_output_format::on_end_group): Likewise. * gcc.dg/plugin/diagnostic_plugin_test_paths.c: Likewise. * gcc.dg/plugin/diagnostic_plugin_test_show_locus.c (custom_diagnostic_finalizer): Likewise. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2024-09-06Daily bump.GCC Administrator1-0/+90
2024-09-05ada: Add bypass for internal fields on strict-alignment platformsEric Botcazou1-3/+8
This is required to support misalignment of tagged types in legacy code. gcc/ada/ * gcc-interface/trans.cc (addressable_p) <COMPONENT_REF>: Add bypass for internal fields on strict-alignment platforms.
2024-09-05ada: Streamline handling of low-level peculiarities of record field layoutEric Botcazou4-18/+33
This factors out the interface to the low-level field layout machinery. gcc/ada/ * gcc-interface/gigi.h (default_field_alignment): New function. * gcc-interface/misc.cc: Include tm_p header file. (default_field_alignment): New function. * gcc-interface/trans.cc (addressable_p) <COMPONENT_REF>: Replace previous alignment klduge with call to default_field_alignment. * gcc-interface/utils.cc (finish_record_type): Likewise for the alignment based on which DECL_BIT_FIELD should be cleared.
2024-09-05ada: Remove unused parameters in validity checking routinePiotr Trojanek2-25/+9
Code cleanup; semantics is unaffected. gcc/ada/ * exp_util.ads, exp_util.adb (Duplicate_Subexpr_No_Checks): Remove parameters, which are no longer used.
2024-09-05ada: Integrate new diagnostics in the frontendViljar Indus33-158/+6460
Integrate diagnostic messages using the new implementation to the codebase. New diagnostic implementation uses GNAT.Lists as a building block. Tampering checks that were initially implemented for those lists are not critical for this implementation and they lead to overly complex code. Add a generic parameter Tampering_Checks to control whether the tempering checks should be applied for the lists. Make tampering checks conditional for GNAT.Lists gcc/ada/ * par-endh.adb: add call to new diagnostic for end loop errors. * sem_ch13.adb: add call to new diagnostic for default iterator error and record representation being too late. * sem_ch4.adb: Add new diagnostic for wrong operands. * sem_ch9.adb: Add new diagnostic for a Lock_Free warning. * libgnat/g-lists.adb (Ensure_Unlocked): Make checks for tampering conditional. * libgnat/g-lists.ads: Add parameter Tampering_Checks to control whether tampering checks should be executed. * backend_utils.adb: Add new gcc switches '-fdiagnostics-format=sarif-file' and '-fdiagnostics-format=sarif-stderr'. * debug.adb: document -gnatd_D switch. * diagnostics-brief_emitter.adb: New package for displaying diagnostic messages in a compact manner. * diagnostics-brief_emitter.ads: Same as above. * diagnostics-constructors.adb: New pacakge for providing simpler constructor methods for new diagnostic objects. * diagnostics-constructors.ads: Same as above. * diagnostics-converter.adb: New package for converting old Error_Msg_Object-s to Diagnostic_Types. * diagnostics-converter.ads: Same as above. * diagnostics-json_utils.adb: Package for utility methods related to emitting JSON. * diagnostics-json_utils.ads: Same as above. * diagnostics-pretty_emitter.adb: New package for displaying diagnostic messages in a more elaborate manner. * diagnostics-pretty_emitter.ads: Same as above. * diagnostics-repository.adb: New package for collecting all created error messages. * diagnostics-repository.ads: Same as above. * diagnostics-sarif_emitter.adb: New pacakge for converting all of the diagnostics into a report in the SARIF format. * diagnostics-sarif_emitter.ads: Same as above. * diagnostics-switch_repository.adb: New package containing the definitions for all of the warninging switches. * diagnostics-switch_repository.ads: Same as above. * diagnostics-utils.adb: Contains various utility methods for the diagnostic pacakges. * diagnostics-utils.ads: Same as above. * diagnostics.adb: Contains the definitions and common functions for all the new diagnostics objects. * diagnostics.ads: Same as above. * errout.adb: Relocate the old implementations for brief and pretty printing the diagnostic messages and the entrypoint to the new implementation if a debug switch is used. * errout.ads: Improve documentation. Make Set_Msg_Text publicly available. * opt.ads: Add the flag SARIF_File which controls whether the diagnostic messages should be printed to a file in the SARIF format. Add the flag SARIF_Output to control whether the diagnostic messages should be printed to std-err in the SARIF format. * gcc-interface/Make-lang.in: Add new pacakages to the object list. * gcc-interface/Makefile.in: Add new pacakages to the object list.
2024-09-05ada: Binder respects Ada version for checksum of runtime filesJose Ruiz1-2/+20
The parsing to compute the checksums of runtime files (within the binder) was done using the default Ada version (Ada 2012 currently), while the creation of the checksum, when the runtime files are compiled, is performed in a more recent Ada version (Ada 2022 currently). This change forces the checksum computation for runtime files to be done with the same Ada version as when they were created. gcc/ada/ * ali-util.adb (Get_File_Checksum): Force the parsing for the checksum computation of runtime files to be done in the corresponding recent Ada version.
2024-09-05ada: Tweak assertions in Inline.Cannot_InlineRonan Desplanques2-3/+4
The purpose of this patch is to silence a GNATSAS report. gcc/ada/ * inline.adb (Cannot_Inline): Remove assertion. * inline.ads (Cannot_Inline): Add precondition.
2024-09-05Daily bump.GCC Administrator1-0/+64
2024-09-03ada: Add kludge for quirk of ancient 32-bit ABIs to previous changeEric Botcazou1-2/+14
Some ancient 32-bit ABIs, most notably that of x86/Linux, misalign double scalars in record types, so comparing DECL_ALIGN with TYPE_ALIGN directly may give the wrong answer for them. gcc/ada/ * gcc-interface/trans.cc (addressable_p) <COMPONENT_REF>: Add kludge to cope with ancient 32-bit ABIs.
2024-09-03ada: Plug loophole exposed by previous changeEric Botcazou1-0/+3
The change causes more temporaries to be created at call sites for unaligned actual parameters, thus revealing that the machinery does not properly deal with unconstrained nominal subtypes for them. gcc/ada/ * gcc-interface/trans.cc (create_temporary): Deal with types whose size is self-referential by allocating the maximum size.
2024-09-03ada: Fix internal error with Atomic Volatile_Full_Access objectEric Botcazou1-4/+6
The initial implementation of the GNAT aspect/pragma Volatile_Full_Access made it incompatible with Atomic, because it was not decided whether the read-modify-write sequences generated by Volatile_Full_Access would need to be implemented atomically when Atomic was also specified, which would have required a compare-and-swap primitive from the target architecture. But Ada 2022 introduced Full_Access_Only and retrofitted it into Atomic in the process, answering the above question by the negative, so the incompatibility between Volatile_Full_Access and Atomic was lifted in Ada 2012 as well, unfortunately without adjusting the implementation. gcc/ada/ * gcc-interface/trans.cc (get_atomic_access): Deal specifically with nodes that are both Atomic and Volatile_Full_Access in Ada 2012.
2024-09-03ada: Pass unaligned record components by copy in calls on all platformsEric Botcazou1-3/+2
This has historically been done only on platforms requiring the strict alignment of memory references, but this can arguably be considered as being mandated by the language on all of them. gcc/ada/ * gcc-interface/trans.cc (addressable_p) <COMPONENT_REF>: Take into account the alignment of the field on all platforms.
2024-09-03ada: Fix internal error on pragma pack with discriminated record componentEric Botcazou1-0/+2
When updating the size after making a packable type in gnat_to_gnu_field, we fail to clear it again when it is not constant. gcc/ada/ * gcc-interface/decl.cc (gnat_to_gnu_field): Clear again gnu_size after updating it if it is not constant.
2024-09-03ada: Simplify Note_Uplevel_Bound procedureMarc Poulhiès1-103/+66
The procedure Note_Uplevel_Bound was implemented as a custom expression tree walk. This change replaces this custom tree traversal by a more idiomatic use of Traverse_Proc. gcc/ada/ * exp_unst.adb (Check_Static_Type::Note_Uplevel_Bound): Refactor to use the generic Traverse_Proc. (Check_Static_Type): Adjust calls to Note_Uplevel_Bound as the previous second parameter was unused, so removed.
2024-09-03ada: Transform Length attribute references for non-Strict overflow mode.Steve Baird1-1/+68
The non-strict overflow checking code does a better job of eliminating overflow checks if given an expression consisting only of predefined operators (including relationals), literals, identifiers, and conditional expressions. If it is both feasible and useful, rewrite a Length attribute reference as such an expression. "Feasible" means "index type is same type as attribute reference type, so we can rewrite without using type conversions". "Useful" means "Overflow_Mode is something other than Strict, so there is value in making overflow check elimination easier". gcc/ada/ * exp_attr.adb (Expand_N_Attribute_Reference): If it makes sense to do so, then rewrite a Length attribute reference as an equivalent conditional expression.
2024-09-03ada: Do not warn for partial access to Atomic Volatile_Full_Access objectsEric Botcazou1-16/+30
The initial implementation of the GNAT aspect/pragma Volatile_Full_Access made it incompatible with Atomic, because it was not decided whether the read-modify-write sequences generated by Volatile_Full_Access would need to be implemented atomically when Atomic was also specified, which would have required a compare-and-swap primitive from the target architecture. But Ada 2022 introduced Full_Access_Only and retrofitted it into Atomic in the process, answering the above question by the negative, so the incompatibility between Volatile_Full_Access and Atomic was lifted in Ada 2012 as well, but the implementation was not entirely adjusted. In Ada 2012, it does not make sense to warn for the partial access to an Atomic object if the object is also declared Volatile_Full_Access, since the object will be accessed as a whole in this case (like in Ada 2022). gcc/ada/ * sem_res.adb (Is_Atomic_Ref_With_Address): Rename into... (Is_Atomic_Non_VFA_Ref_With_Address): ...this and adjust the implementation to exclude Volatile_Full_Access objects. (Resolve_Indexed_Component): Adjust to above renaming. (Resolve_Selected_Component): Likewise.
2024-09-03ada: Reject illegal array aggregates as per AI22-0106.Steve Baird1-17/+97
Implement the new legality rules of AI22-0106 which (as discussed in the AI) are needed to disallow constructs whose semantics would otherwise be poorly defined. gcc/ada/ * sem_aggr.adb (Resolve_Array_Aggregate): Implement the two new legality rules of AI11-0106. Add code to avoid cascading error messages.
2024-09-03ada: Fix Finalize_Storage_Only bug in b-i-p callsBob Duff1-9/+5
Do not pass null for the Collection parameter when Finalize_Storage_Only is in effect. If the collection is null in that case, we will blow up later when we deallocate the object. gcc/ada/ * exp_ch6.adb (Add_Collection_Actual_To_Build_In_Place_Call): Remove Finalize_Storage_Only from the code that checks whether to pass null to the Collection parameter. Having done that, we don't need to check for Is_Library_Level_Entity, because No_Heap_Finalization requires that. And if we ever change No_Heap_Finalization to allow nested access types, we will still want to pass null. Note that the comment "Such a type lacks a collection." is incorrect in the case of Finalize_Storage_Only; such types have a collection.
2024-09-03Daily bump.GCC Administrator1-0/+58
2024-09-02ada: Diagnose too large size clause on floating-point typeEric Botcazou1-0/+4
The problem is that the size clause changes the floating-point format used for the type, but it must not when this format is the widest format that is supported in hardware on the target. Instead a padding type must be built and the associated warning given. gcc/ada/ * gcc-interface/decl.cc (gnat_to_gnu_entity): Cap the Esize of a floating-point type to the size of the widest format supported in hardware if it is explicity defined.
2024-09-02ada: Create usage entry for -gnatw_lViljar Indus3-7/+9
gcc/ada/ * doc/gnat_ugn/building_executable_programs_with_gnat.rst: update documentation for the -gnatw_l switch. * usage.adb: Add -gnatw_l entry. * gnat_ugn.texi: Regenerate.
2024-09-02ada: Fix standard output stream for gnatcmd outputRonan Desplanques1-1/+4
Before this patch, the gnat command sent to standard error pieces of information that are a better match for standard output. This patch makes this information go to standard output. gcc/ada/ * gnatcmd.adb (GNATCmd): Fix standard output stream.
2024-09-02ada: Fix minor issues in -gnaty0's documentationRonan Desplanques2-7/+7
Before this patch, the documentation of -gnaty0 used 0-based indexing for column numbers while 1-based indexing is used everywhere else. This patch makes this documentation use 1-based indexing, and also adds a missing parenthesis. gcc/ada/ * doc/gnat_ugn/building_executable_programs_with_gnat.rst: Fix minor issues. * gnat_ugn.texi: Regenerate.
2024-09-02ada: Documentation for generic type inferenceBob Duff2-35/+202
...plus minor improvements to existing documentation. gcc/ada/ * doc/gnat_rm/gnat_language_extensions.rst: I assume "extended set of extensions" was a typo for "experimental set of extensions", because "extended extensions" is repetitive and redundant. "in addition" clarifies that the one subsumes the other. Add a reminder at the start of each subsection about what switch/pragma enables what extensions. Add new section about "Inference of Dependent Types in Generic Instantiations". * gnat_rm.texi: Regenerate.
2024-09-02ada: Small fixes for FreeBSDPatrick Bernardi2-5/+9
Size of pthread data types now need to be defined for FreeBSD ports. Traceback support for AArch64 FreeBSD is now defined. gcc/ada/ * s-oscons-tmplt.c: Define sizes of pthread data types on FreeBSD. * tracebak.c: Use GCC unwinder and adjust PC appropriately on aarch64-freebsd.
2024-09-02ada: Also reset scope for some nested declarationMarc Poulhiès1-1/+24
When changing the scope for entities found in the entry body that is mutated into a procedure, the compiler needs to look deeper than only the top level entities as expansion may produce object declarations which scopes are also the entry. For example, the tree after expansion may look like: procedure This_Is_An_Entry_Proc is ... O1 : Typ := do TMP1 : OTyp := ...; ... in TMP1; O1's scope needs to be reset to This_Is_An_Entry_Proc, but so does TMP1's scope. This change also fix a small oversight where N_Implicit_Label_Declaration scope must be reset and its content skipped. gcc/ada/ * exp_ch9.adb (Reset_Scopes_To): Adjust comment. (Reset_Scopes_To.Reset_Scope): Adjust the scope reset for object declaration. In particular, visit the children nodes if any. Also extend the handling of other declarations to N_Implicit_Label_Declaration.
2024-09-02ada: Cleanup expansion of object declarationsPiotr Trojanek1-7/+3
Replace repeated calls to Sloc with uses of local constant Loc. Code cleanup; behavior is unaffected. gcc/ada/ * exp_ch3.adb (Expand_N_Object_Declaration): Replace calls to Sloc with uses of Loc; turn variable Prag into constant.
2024-09-02ada: Remove repeated guards in validity checksPiotr Trojanek1-6/+2
Routine Insert_Valid_Check only applies checks when Expr_Known_Valid query returns False; there is no need to call this query before inserting checks. Code cleanup; behavior is unaffected. gcc/ada/ * exp_imgv.adb (Expand_User_Defined_Enumeration_Image) (Expand_Image_Attribute): Remove redundant guards.
2024-08-30Daily bump.GCC Administrator1-0/+120
2024-08-29ada: Fix assertion failure on private limited with clauseEric Botcazou1-0/+1
This checks that the name is of an entity before accessing its Entity field. gcc/ada/ * sem_ch8.adb (Has_Private_With): Add test on Is_Entity_Name.
2024-08-29ada: Fix internal error on concatenation of discriminant-dependent componentEric Botcazou1-1/+9
This only occurs with optimization enabled, but the expanded code is always wrong because it reuses the formal parameter of an initialization procedure associated with a discriminant (a discriminal in GNAT parlance) outside of the initialization procedure. gcc/ada/ * checks.adb (Selected_Length_Checks.Get_E_Length): For a component of a record with discriminants and if the expression is a selected component, try to build an actual subtype from its prefix instead of from the discriminal.
2024-08-29ada: Missing legality check when type completedSteve Baird2-4/+30
Refine previous fix to better handle tagged cases. gcc/ada/ * sem_ch6.adb (Check_Discriminant_Conformance): Immediately after calling Is_Immutably_Limited_Type, perform an additional test that one might reasonably imagine would instead have been part of Is_Immutably_Limited_Type. The new test is a call to a new function Has_Tagged_Limited_Partial_View whose implementation includes a call to Incomplete_Or_Partial_View, which cannot be easily be called from Is_Immutably_Limited_Type (because sem_aux, which is in the closure of the binder, cannot easily "with" sem_util). * sem_aux.adb (Is_Immutably_Limited): Include N_Derived_Type_Definition case when testing Limited_Present flag.
2024-08-29ada: Fix missing finalization for call to function returning limited viewEric Botcazou1-3/+5
The call is legal because it is made from the body, which has visibility on the nonlimited view, so this changes the code in Expand_Call_Helper to look at the Etype of the call node instead of the Etype of the function. gcc/ada/ * exp_ch6.adb (Expand_Call_Helper): In the case of a function call, look at the Etype of the call node to determine whether finalization actions need to be performed.
2024-08-29ada: Print Insertion_Sloc in dmsgViljar Indus1-0/+5
gcc/ada/ * erroutc.adb (dmsg): Print Insertion_Sloc.
2024-08-29ada: Use the same warning character in continuation messagesViljar Indus4-6/+6
For consitency sake the main and continuation messages should use the same warning characters. gcc/ada/ * exp_aggr.adb (Expand_Range_Component): Remove extra warning character. Use same conditional warning char. * freeze.adb (Warn_Overlay): Use named warning character. * restrict.adb (Id_Case): Use named warning character. * sem_prag.adb (Rewrite_Assertion_Kind): Use default warning character.
2024-08-29ada: Restructure continuation message for pretty printingViljar Indus1-1/+6
Continuation messages should have the same location as the main message. If the goal is to point to a different location then Error_Msg_Sloc should be used to change the location of the continuation message. gcc/ada/ * par-ch4.adb (P_Name): Use Error_Msg_Sloc for the location of the continuation message.
2024-08-29ada: Improve Inspection_Point warningViljar Indus1-9/+10
Ensure that the primary and sub message point to the same location in order to assure that the submessages get pretty printed in the correct order. gcc/ada/ * exp_prag.adb (Expand_Pragma_Inspection_Point): Improve sub diagnostic generation.
2024-08-29ada: Avoid creating continuation messages without an intended parentViljar Indus3-5/+11
The messages modified in this patch do not have a clear intended parent. This causes a lot of issues when grouping continuation messages together with their parent. This can be confusing as it is not obvious what was the parent message that caused this problem or in worst case scenarios the message not being printed alltogether. These modified messages do not seem to be related to any concrete error message and thus should be treated as independent messages. gcc/ada/ * sem_ch12.adb (Abandon_Instantiation): Remove continuation characters from the error message. * sem_ch13.adb (Check_False_Aspect_For_Derived_Type): Remove continuation characters from the error message. * sem_ch6.adb (Assert_False): Avoid creating a continuation message without a parent. If no primary message is created then the message is considered as primary. gcc/testsuite/ChangeLog: * gnat.dg/interface6.adb: Adjust test.
2024-08-29ada: Parse the attributes of continuation messages correctlyViljar Indus2-5/+25
Currently unless pretty printing is enabled we avoid parsing the message strings for continuation messages. This leads to inconsistent state for the Error_Msg_Object-s that are being created. gcc/ada/ * erroutc.adb (Prescan_Message): Avoid not parsing all of the message attributes. * erroutc.ads: Update the documentation.
2024-08-29ada: Use consistent type continuations messagesViljar Indus3-8/+8
Avoid cases where the main message is an error and the continuation is a warning. gcc/ada/ * freeze.adb: Remove warning insertion characters from a continuation message. * sem_util.adb: Remove warning insertion characters from a continuation message. * sem_warn.adb: Use same warning character as the main message.
2024-08-29ada: Extract line fitting algorithmViljar Indus2-85/+96
Separate the line fitting algorithm from the general line printing algorithm. gcc/ada/ * erroutc.ads: Add new method Output_Text_Within * erroutc.adb: Move the line fitting code to a new method called Output_Text_Within
2024-08-29ada: Ensure validity checks for private scalar typesPiotr Trojanek2-2/+3
To check validity of data values, we must strip privacy from their types. gcc/ada/ * checks.adb (Expr_Known_Valid): Use Validated_View, which strips type derivation and privacy. * exp_ch3.adb (Simple_Init_Private_Type): Kill checks inside unchecked conversions, just like in Simple_Init_Scalar_Type.
2024-08-29ada: Display actual line length in line length checkViljar Indus1-1/+3
gcc/ada/ * styleg.adb (Check_Line_Max_Length): Add the actual line length to the diagnostic message.
2024-08-29ada: Proper handling for iterator associations in array aggregatesGary Dismukes1-1/+61
The compiler was flagging type-mismatch errors on iterated component associations in array aggregates of form "for C in <iterator_name>", improperly requiring the type of the iterator to be the array index type. The parser can't distinguish whether the association is one involving an actual discrete choice vs. an iterator specification, and creates an N_Iterated_Component_Association with a Defining_Identifer and Discrete_Choices, and the analysis phase has to disambiguate this, determining whether to create an N_Iterator_Specification node for the association. A related change is to revise the similar code for iterated associations of container aggregates, to allow forms of iterator objects other than just function calls. gcc/ada/ * sem_aggr.adb (Resolve_Array_Aggregate): Add loop over associations to locate N_Iterated_Component_Associations that do not have an Iterator_Specification, and if their Discrete_Choices list consists of a single choice, analyze it and if it's the name of an iterator object, then create an Iterator_Specification and associate it with the iterated component association. (Resolve_Iterated_Association): Replace test for function call with test of Is_Object_Reference, to handle other forms of iterator objects in container aggregates.
2024-08-29ada: First controlling parameter aspectJavier Miranda3-40/+211
gcc/ada/ * usage.adb (Usage): Document switch -gnatw_j * doc/gnat_rm/gnat_language_extensions.rst: Add documentation. * gnat_rm.texi: Regenerate.
2024-08-29ada: Update documentation for conditional when constructsJustin Squirek3-158/+157
This patch moves the documentation for conditional when constructs out of the curated set (e.g. into -gnatX0). gcc/ada/ * doc/gnat_rm/gnat_language_extensions.rst: Move conditional when constructs out of the curated set. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2024-08-24Daily bump.GCC Administrator1-0/+181
2024-08-23optabs-query: Use opt_machine_mode for smallest_int_mode_for_size [PR115495].Robin Dapp1-2/+3
In get_best_extraction_insn we use smallest_int_mode_for_size with struct_bits as size argument. PR115495 has struct_bits = 256 and we don't have a mode for that. This patch makes smallest_mode_for_size and smallest_int_mode_for_size return opt modes so we can just skip over the loop when there is no mode. PR middle-end/115495 gcc/ChangeLog: * cfgexpand.cc (expand_debug_expr): Require mode. * combine.cc (make_extraction): Ditto. * config/aarch64/aarch64.cc (aarch64_expand_cpymem): Ditto. (aarch64_expand_setmem): Ditto. * config/arc/arc.cc (arc_expand_cpymem): Ditto. * config/arm/arm.cc (arm_expand_divmod_libfunc): Ditto. * config/i386/i386.cc (ix86_get_mask_mode): Ditto. * config/rs6000/predicates.md: Ditto. * config/rs6000/rs6000.cc (vspltis_constant): Ditto. * config/s390/s390.cc (s390_expand_insv): Ditto. * config/sparc/sparc.cc (assign_int_registers): Ditto. * coverage.cc (get_gcov_type): Ditto. (get_gcov_unsigned_t): Ditto. * dse.cc (find_shift_sequence): Ditto. * expmed.cc (store_integral_bit_field): Ditto. * expr.cc (convert_mode_scalar): Ditto. (op_by_pieces_d::smallest_fixed_size_mode_for_size): Ditto. (emit_block_move_via_oriented_loop): Ditto. (copy_blkmode_to_reg): Ditto. (store_field): Ditto. * internal-fn.cc (expand_arith_overflow): Ditto. * machmode.h (HAVE_MACHINE_MODES): Ditto. (smallest_mode_for_size): Use opt_machine_mode. (smallest_int_mode_for_size): Use opt_scalar_int_mode. * optabs-query.cc (get_best_extraction_insn): Require mode. * optabs.cc (expand_twoval_binop_libfunc): Ditto. * stor-layout.cc (smallest_mode_for_size): Return opt_machine_mode. (layout_type): Require mode. (initialize_sizetypes): Ditto. * tree-ssa-loop-manip.cc (canonicalize_loop_ivs): Ditto. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/pr115495.c: New test. gcc/ada/ChangeLog: * gcc-interface/utils2.cc (fast_modulo_reduction): Require mode. (nonbinary_modular_operation): Ditto.