aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2022-05-13Fix return value in ranger_cache::get_global_range.Andrew MacLeod1-1/+1
The "is_current" status is returned by parameter, but was being returned by the function as well instead of true if NAME had a global range, and FALSE if it did not. * gimple-range-cache.cc (ranger_cache::get_global_range): Return the had_global value instead.
2022-05-13MAINTAINERS: Add myself to write after approvalSurya Kumari Jangala1-0/+1
2022-05-13 Surya Kumari Jangala <jskumari@linux.ibm.com> * MAINTAINERS: Add myself to write after approval.
2022-05-13Add relation between op1 & op2 to lhs_opN_relation API.Andrew MacLeod4-18/+68
We use the relation between op1 and op2 to help fold a statement, but it was not provided to the lhs_op1_relation and lhs_op2_relation routines to determine if is also creates a relation between the LHS and either operand. gcc/ PR tree-optimization/104547 * gimple-range-fold.cc (fold_using_range::range_of_range_op): Add the op1/op2 relation to the relation call. * range-op.cc (*::lhs_op1_relation): Add param. (*::lhs_op2_relation): Ditto. (operator_minus::lhs_op1_relation): New. (range_relational_tests): Add relation param. * range-op.h (lhs_op1_relation, lhs_op2_relation): Adjust prototype. gcc/testsuite/ * g++.dg/pr104547.C: New.
2022-05-13c++: Local symbols do not get module manglingsNathan Sidwell2-1/+52
Internal-linkage entity mangling is entirely implementation defined -- there's no ABI issue. Let's not mangle in any module attachment to them, it makes the symbols unnecessarily longer. gcc/cp/ * mangle.cc (maybe_write_module): Check external linkage. gcc/testsuite/ * g++.dg/modules/mod-sym-4.C: New.
2022-05-13Export global ranges during the VRP block walk.Andrew MacLeod2-1/+25
VRP currently searches the ssa_name list for globals to exported after it finishes running. Recent changes have VRP calling a side-effect routine for each stmt during the walk. This change simply exports globals as they are calculated the final time during the walk. * gimple-range.cc (gimple_ranger::register_side_effects): First check if the DEF should be exported as a global. * tree-vrp.cc (rvrp_folder::pre_fold_bb): Process PHI side effects, which will export globals. (execute_ranger_vrp): Remove call to export_global_ranges.
2022-05-13Clear killing defs when resetting the path in path_oracle.Andrew MacLeod1-0/+1
When we reset the path oracle, we should clear the killing defs vector. * value-relation.cc (path_oracle::reset_path): Clear killing_defs.
2022-05-13Make range_from_dom more effective.Andrew MacLeod2-50/+98
Add modes to range_from_dom such that we can simply query, or adjust the cache and deal with multiple predecessor blocks. * gimple-range-cache.cc (ranger_cache::ranger_cache): Start with worlist truncated. (ranger_cache::entry_range): Add rfd_mode parameter. (ranger_cache::exit_range): Ditto. (ranger_cache::edge_range): New. Incorporate from range_on_edge. (ranger_cache::range_of_expr): Adjust call to entry_range. (ranger_cache::range_on_edge): Split to edge_range and call. (ranger_cache::fill_block_cache): Always invoke range_from_dom. (ranger_cache::range_from_dom): Make reentrant, add search mode, handle mutiple predecessors. (ranger_cache::update_to_nonnull): Adjust call to exit_range. * gimple-range-cache.h (ranger_cache): Add enum rfd_mode. Adjust prototypes.
2022-05-13libstdc++: Improve doxygen docs for <mutex>Jonathan Wakely4-4/+58
libstdc++-v3/ChangeLog: * doc/doxygen/user.cfg.in (PREDEFINED): Define _GTHREAD_USE_MUTEX_TIMEDLOCK macro. * include/bits/std_mutex.h (mutex, lock_guard): Use @since and @headerfile. * include/bits/unique_lock.h (unique_lock): Likewise. * include/std/mutex (recursive_mutex, timed_mutex) (recursive_timed_mutex, scoped_lock): Likewise.
2022-05-13libstdc++: Improve doxygen docs for some of <memory>Jonathan Wakely4-4/+15
libstdc++-v3/ChangeLog: * doc/doxygen/user.cfg.in (PREDEFINED): Define _GLIBCXX23_CONSTEXPR macro. * include/backward/auto_ptr.h (auto_ptr): Use @deprecated. * include/bits/unique_ptr.h (default_delete): Use @since and @headerfile. * include/std/scoped_allocator: Remove @ingroup from @file block.
2022-05-13libstdc++: Improve doxygen docs for <thread> and <future>Jonathan Wakely3-10/+73
libstdc++-v3/ChangeLog: * include/bits/std_thread.h (thread, thread::id): Improve doxygen docs. * include/std/future: Likewise. * include/std/thread (jthread): Likewise.
2022-05-13libstdc++: Improve doxygen docs for algorithms and moreJonathan Wakely4-104/+112
libstdc++-v3/ChangeLog: * include/bits/ostream_insert.h: Mark helper functions as undocumented by Doxygen. * include/bits/stl_algo.h: Use markdown for formatting and mark helper functions as undocumented. * include/bits/stl_numeric.h: Likewise. * include/bits/stl_pair.h (pair): Add @headerfile.
2022-05-13libstdc++: Improve doxygen docs for std::allocatorJonathan Wakely5-10/+42
libstdc++-v3/ChangeLog: * doc/doxygen/user.cfg.in (PREDEFINED): Define __allocator_base so that Doxygen shows the right base-class for std::allocator. * include/bits/alloc_traits.h: Improve doxygen docs. * include/bits/allocator.h: Likewise. * include/bits/new_allocator.h: Likewise. * include/ext/new_allocator.h: Likewise.
2022-05-13libstdc++: Improve doxygen docs for <regex>Jonathan Wakely5-10/+66
Add @headerfile and @since tags. Improve grouping of non-member functions via @relates tags. Mark the std::pair base class of std::sub_match as undocumented, so that the docs don't show all the related non-member functions are part of the sub_match API. Use a new macro to re-add the data members for Doxygen only. libstdc++-v3/ChangeLog: * doc/doxygen/user.cfg.in (PREDEFINED): Define macro _GLIBCXX_DOXYGEN_ONLY to expand its argument. * include/bits/c++config (_GLIBCXX_DOXYGEN_ONLY): Define. * include/bits/regex.h: Improve doxygen docs. * include/bits/regex_constants.h: Likewise. * include/bits/regex_error.h: Likewise.
2022-05-13libstdc++: Improve doxygen docs for <atomic>Jonathan Wakely3-26/+56
libstdc++-v3/ChangeLog: * include/std/atomic: Suppress doxygen docs for implementation details. * include/bits/atomic_base.h: Likewise. * include/bits/shared_ptr_atomic.h: Use markdown. Fix grouping so that std::atomic is not added to the pointer abstractions group.
2022-05-13libstdc++: Improve doxygen docs for <system_error>Jonathan Wakely1-29/+107
libstdc++-v3/ChangeLog: * include/std/system_error: Improve doxygen comments.
2022-05-13libstdc++: Improve doxygen docs for std::pointer_traitsJonathan Wakely1-0/+6
libstdc++-v3/ChangeLog: * include/bits/ptr_traits.h: Add some doxygen comments.
2022-05-13libstdc++: Add macros for the inline namespace std::_V2Jonathan Wakely7-18/+28
Use macros to open and close the inline namespace _V2 that is used for ABI versioning of individual components such as chrono::system_clock. This allows the namespace to be hidden in the docs generated by Doxygen, so that we document std::foo instead of std::_V2::foo. This also makes it easy to remove that namespace entirely for the gnu-versioned-namespace build, where everything is already versioned as std::__8 and there are no backwards compatibility guarantees. libstdc++-v3/ChangeLog: * doc/doxygen/user.cfg.in (PREDEFINED): Expand new macros to nothing. * include/bits/c++config (_GLIBCXX_BEGIN_INLINE_ABI_NAMESPACE) (_GLIBCXX_END_INLINE_ABI_NAMESPACE): Define new macros. * include/bits/algorithmfwd.h (_V2::__rotate): Use new macros for the namespace. * include/bits/chrono.h (chrono::_V2::system_clock): Likewise. * include/bits/stl_algo.h (_V2::__rotate): Likewise. * include/std/condition_variable (_V2::condition_variable_any): Likewise. * include/std/system_error (_V2::error_category): Likewise.
2022-05-13libstdc++: Fix typo in doxygen @headerfile commandJonathan Wakely1-1/+1
libstdc++-v3/ChangeLog: * include/bits/mofunc_impl.h: Fix doxygen command.
2022-05-13libstdc++: Disable Doxygen GROUP_NESTED_COMPOUNDS config optionJonathan Wakely1-10/+1
Before Doxygen version 1.9.2 this option is broken (see https://github.com/doxygen/doxygen/issues/8638 for more details) and classes are not added to the correct groups by @ingroup and @addtogroup. Also remove the obsolete CLASS_DIAGRAMS option that causes a warning. libstdc++-v3/ChangeLog: * doc/doxygen/user.cfg.in (GROUP_NESTED_COMPOUNDS): Set to NO. (CLASS_DIAGRAMS): Remove obsolete option.
2022-05-13libgomp nvptx plugin: Only consider '--with-cuda-driver=[...]' when applicableThomas Schwinge2-10/+13
They're not applicable in 'PLUGIN_NVPTX_DYNAMIC' configurations. libgomp/ * plugin/Makefrag.am (libgomp_plugin_nvptx_la_CPPFLAGS) [PLUGIN_NVPTX_DYNAMIC]: Don't append '$(PLUGIN_NVPTX_CPPFLAGS)'. (libgomp_plugin_nvptx_la_LDFLAGS) [PLUGIN_NVPTX_DYNAMIC]: Don't append '$(PLUGIN_NVPTX_LDFLAGS)'. * Makefile.in: Regenerate.
2022-05-13Avoid visiting newly-created blocks in harden-conditionalsAlexandre Oliva1-197/+220
Reverse iteration over blocks, in gimple-harden-conditionals.cc, was supposed to avoid visiting blocks introduced by hardening and introducing further reversed conditionals and traps for them, but newly-created blocks may be inserted before the current block, as shown by the PR105455 testcase. Use an auto_sbitmap to gather preexisting blocks that need visiting. for gcc/ChangeLog * gimple-harden-conditionals.cc: Include sbitmap.h. (pass_harden_conditional_branches::execute): Skip new blocks. (pass_harden_compares::execute): Likewise.
2022-05-13ada: gcc-if: build proper String_Pointer for Get_External_NameAlexandre Oliva1-1/+2
The compiler is allowed to assume it can access String bounds, such as the prefix passed to Get_External_Name, even in circumstances in which the prefix is not going to be used and has_prefix is false, so, from the C side, we have to build a proper String_Template for the String_Pointer. for gcc/ada/ChangeLog * gcc-interface/decl.cc (is_cplusplus_method): Build proper String for Get_External_Name.
2022-05-13Introduce tests for hardbool Machine_Attribute for AdaAlexandre Oliva2-0/+68
Test for the validity checking performed on nonstandard booleans annotated with the "hardbool" Machine_Attribute pragma. for gcc/testsuite/ChangeLog * gnat.dg/hardbool.ads: New. * gnat.dg/hardbool.adb: New.
2022-05-13arm: correctly handle misaligned MEMs on MVE [PR105463]Richard Earnshaw2-21/+73
Vector operations in MVE must be aligned to the element size, so if we are asked for a misaligned move in a wider mode we must recast it to a form suitable for the known alignment (larger elements have better address offset ranges, so there is some advantage to using wider element sizes if possible). Whilst fixing this, also rework the predicates used for validating operands - the Neon predicates are not right for MVE. gcc/ChangeLog: PR target/105463 * config/arm/mve.md (*movmisalign<mode>_mve_store): Use mve_memory_operand. (*movmisalign<mode>_mve_load): Likewise. * config/arm/vec-common.md (movmisalign<mode>): Convert to generator form... (@movmisalign<mode>): ... thus. Use generic predicates and then rework operands if they are not valid. For MVE rework to a narrower element size if the alignment is not high enough.
2022-05-13arm: fix some issues in mve_vector_mem_operandRichard Earnshaw1-9/+10
There are a couple of issues with the mve_vector_mem_operand function. Firstly, SP is permitted as a register provided there is no write-back operation. Secondly, there were some cases where 'strict' was not being applied when checking which registers had been used. gcc/ChangeLog: * config/arm/arm.cc (mve_vector_mem_operand): Allow SP_REGNUM when there is no write-back. Fix use when strict is true.
2022-05-13xtensa: Reflect the 32-bit Integer Divide OptionTakayuki 'January June' Suwa1-0/+5
On Espressif's ESP8266 (based on Tensilica LX106, no hardware divider), this patch reduces the size of each: __moddi3() @ libgcc.a : 969 -> 301 (saves 668) __divmoddi4() : 1111 -> 426 (saves 685) __udivmoddi4() : 1043 -> 319 (saves 724) in bytes, respectively. gcc/ChangeLog: * config/xtensa/xtensa.h (TARGET_HAS_NO_HW_DIVIDE): New macro definition.
2022-05-13xtensa: Rename deprecated extv/extzv insn patterns to extvsi/extzvsiTakayuki 'January June' Suwa1-8/+8
These patterns were deprecated since GCC 4.8. gcc/ChangeLog: * config/xtensa/xtensa.md (extvsi, extvsi_internal, extzvsi, extzvsi_internal): Rename from extv, extv_internal, extzv and extzv_internal, respectively.
2022-05-13Fix wrong SRA with VIEW_CONVERT_EXPR and reverse SSOEric Botcazou2-24/+57
Most cases of VIEW_CONVERT_EXPRs involving reverse scalar storage order are disqualified for SRA because they are storage_order_barrier_p, but you can still have a VIEW_CONVERT_EXPR to a regular composite type being applied to a component of a record type with reverse scalar storage order. In this case the bypass for !useless_type_conversion_p in sra_modify_assign, albeit already heavily guarded, triggers and may generate wrong code, so the patch makes sure that it does only when the SSO is the same on both side. gcc/ * tree-sra.cc (sra_modify_assign): Check that scalar storage order is the same on the LHS and RHS before rewriting one with the model of the other. gcc/testsuite/ * gnat.dg/sso17.adb: New test.
2022-05-13[Ada] Fix incorrect call to inherited function with limited return typeEric Botcazou1-0/+1
This is a return convention mismatch coming from a discrepancy of the Returns_By_Ref flag for the inherited function. gcc/ada/ * sem_ch3.adb (Derive_Subprogram): For a function, also copy the Returns_By_Ref flag from the parent.
2022-05-13[Ada] Storage_Model_Object fails to return object entityGary Dismukes1-1/+5
After a compilation unit containing a Designated_Storage_Model aspect was processed by the compiler front end, the aspect's expression was seen as not having been analyzed. In some cases this can lead to the Storage_Model_Object function not returning the entity of the associated model object (such as when the model object is specified using an expanded name). This was due to a second copy of the aspect's expression being made in Check_Aspect_At_Freeze_Point, and that copy wasn't analyzed, even though the earlier version of the expression prior to that copy had been. (The copy is needed for proper checking of Ada's rules for ensuring that certain aspect expressions resolve the same way at the freeze point and later at the end of the declarations.) This is corrected by doing analysis of the new aspect expression within Check_Aspect_At_Freeze_Point, as is already done in that procedure in the case of several other aspects. gcc/ada/ * sem_ch13.adb (Check_Aspect_At_Freeze_Point): Analyze the expression of the aspect at this point, like other aspects that denote simple entities. Ensures that function Storage_Model_Object will have an entity to retrieve from the aspect expression. Also, move comment about aspects that don't require delay analysis in front of last alternative of the case statement, where it's supposed to be.
2022-05-13[Ada] Compiler crash on -gnata -O2Javier Miranda2-53/+88
gcc/ada/ * contracts.adb (Build_Unique_Name): New subprogram. (Make_Class_Precondition_Subps): Use Build_Unique_Name to generate the names of the call helpers and the name of indirect call wrappers. * freeze.adb (Needs_Wrapper): Remove dead code. (Check_Inherited_Conditions): Defer building helpers and ICW until all the dispatch table wrappers have been built and analyzed. Required to ensure uniqueness in their names because when building these wrappers for overlapped subprograms their homonym number is not definite until they have been analyzed.
2022-05-13[Ada] Only use alternate stack when neededArnaud Charlet1-4/+10
If we're not going to install a signal handler for SIGSEGV then we do not need an alternate stack to handle this signal (and e.g. stack overflows). gcc/ada/ * libgnarl/s-taprop__linux.adb (Initialize): Do not use an alternate stack if no handler for SEGV is installed.
2022-05-13[Ada] Extend hardcfr testing (documentation)Alexandre Oliva2-32/+14
Having realized that noreturn calls of __builtin_return are special, and other noreturn calls don't get edges to the exit block, I've realized the consequences of the logic to insert checking before noreturn and tail calls were not quite what I'd expected before. Specifically, noreturn calls other than __builtin_return don't get any checking whatsoever. Moreover, optional tail calls are only detected long after hardcfr; the logic should work for must-tail calls, but there doesn't seem to be a way to test it. Documentation has been simplified so as to remove mention of these possibilities, that can't really be relied on. gcc/ada/ * doc/gnat_rm/security_hardening_features.rst (Control Flow Redundancy): Drop mentions of noreturn and tail calls. * gnat_rm.texi: Regenerate.
2022-05-13[Ada] CUDA: use binder to generate kernel-registration codeGhjuvan Lacambre9-6/+259
Compiling CUDA code requires compiling code for the host (= CPU) and for the device (= GPU). Device code is embedded into the host code and must be registered with the CUDA runtime by the host. The original approach we took for registering CUDA kernels was to generate the registration-code on a unit basis, i.e. each unit took care of registering its own kernels. Unfortunately, this makes linking kernels and device functions that belong to different units much harder. We thus rework this approach in order to have GNAT generate kernel names in ALI files. The binder reads the ALI files and generates kernel registration code for each of the kernels found in ALI files. gcc/ada/ * ali.adb: Introduce new 'K' line in ALI files, used to represent CUDA kernel entries. * ali.ads: Create new CUDA_Kernels table, which contains entries of type CUDA_Kernel_Record. Each CUDA_Kernel_Record corresponds to a K line in an ali file. * bindgen.adb: Introduce new Gen_CUDA_Init procedure in the binder, which generates CUDA kernel registration code. * gnat_cuda.adb: Move Get_CUDA_Kernels spec to package spec to make it available to bindgen.adb. * gnat_cuda.ads: Likewise. * lib-writ.adb: Introduce new Output_CUDA_Symbols procedure, which generates one 'K' line in the ALI file per visible CUDA kernel. * opt.ads: Introduce Enable_CUDA_Expansion option, triggered by using the -gnatd_c flag. * switch-b.adb: Likewise. * switch-c.adb: Likewise.
2022-05-13[Ada] Fix iterated component association for array aggregateMarc Poulhiès1-0/+24
Create a scope for the Ada 2022 iterated component association loops. In the case of elements needing finalization, the late expansion would crash on references to the loop variable within the loop body. gcc/ada/ * exp_aggr.adb (Gen_Loop): Create scope for loop variable of iterated components.
2022-05-13[Ada] Simplify helper units for formal hashed sets/mapsYannick Moy4-156/+24
As tampering checks do not exist in formal hashed sets and maps, remove the machinery for such checks in the version of generic key and node operations for formal sets/maps. Update comments as well. gcc/ada/ * libgnat/a-chtgfk.adb (Checked_Equivalent_Keys, Checked_Index): Remove useless functions. (Delete_Key_Sans_Free, Find, Generic_Conditional_Insert): Adapt to removal of wrapper functions. * libgnat/a-chtgfk.ads (Checked_Equivalent_Keys, Checked_Index): Remove useless functions. * libgnat/a-chtgfo.adb (Checked_Index): Remove useless function. (Clear): Delete code commented out regarding Busy and Lock management. (Delete_Node_At_Index): Delete unused procedure. (Delete_Node_Sans_Free, Free, Generic_Read, Next): Adapt to removal of wrapper functions. * libgnat/a-chtgfo.ads (Checked_Index): Remove useless function. (Delete_Node_At_Index): Delete unused procedure.
2022-05-13[Ada] Adapt body of formal sets and maps for SPARKYannick Moy7-196/+145
Remove violations of SPARK rules, to prepare for the proof of hashed sets and maps: - Make the type of hash tables not tagged, so that it will be possible to mark the type of nodes as having relaxed initialization. - Remove comparison of addresses as check or optimization: as a check, it is not necessary in SPARK as the caller cannot pass in aliased parameters in such cases; as an optimization, it is not possible in SPARK code. - Avoid aliasing when inserting a node in the hash table. The code for insertion in sets and maps was explicitly aliasing a global for the container and a parameter for its hash table component, both being written. Rewrite the code to pass only the hash table as parameter. - Insert constants for subtype constraints, which cannot depend on variables in SPARK code. - Use procedures instead of functions when side-effects are expected. - Rename variables whose value is only written through calls and not read, using Unused prefix, so that flow analysis does not warn about it. gcc/ada/ * libgnat/a-cfhama.adb (Generic_Allocate): Retype to avoid aliasing. (Assign, Move): Remove address comparison. (Include): Insert constants for subtype constraints. (Insert): Rewrite to avoid aliasing and function with side-effects. * libgnat/a-cfhase.adb (Generic_Allocate): Retype to avoid aliasing. (Assign, Move): Remove address comparison. (Difference, Intersection, Is_Subset, Overlap, Symmetric_Difference, Union): Remove address comparison. Insert constants for subtype constraints. (Insert): Rewrite to avoid aliasing and function with side-effects. * libgnat/a-chtgfk.adb (Checked_Equivalent_Keys, Checked_Index, Delete_Key_Sans_Free, Find, Generic_Replace_Element, Index): Type for hash tables not tagged anymore. (Generic_Conditional_Insert): New_Node generic formal is a procedure taking the hash table as first parameter now, to avoid aliasing in the caller. * libgnat/a-chtgfk.ads: Same. * libgnat/a-chtgfo.adb (Checked_Index, Clear, Delete_Node_At_Index, Delete_Node_Sans_Free, First, Free, Generic_Allocate, Generic_Iteration, Generic_Read, Generic_Write, Index, Next): Type for hash tables not tagged anymore. (Generic_Equal): Removed tagged. Remove address comparison. * libgnat/a-chtgfo.ads: Same. * libgnat/a-cohata.ads (Hash_Table_Type): Remove tagged.
2022-05-13[Ada] Remove dependency on tampering checks and controlled types for formalYannick Moy10-15/+1170
Formal hashed sets and maps are now using a different type of hash table that does not require controlled types. This is possible because formal containers do not rely on tampering checks, as cursors do not hold a pointer to a single matching container, but are logical indexes that can be used with multiple containers. For simplicity of the package organisation, and symmetry with other versions of containers, add a formal version of hashed types in the shared Ada.Containers.Hash_Tables unit. This unit should be specialized to only include the formal version of hash tables for runtimes that do not support controlled types (so that the dependency on Ada.Containers.Helpers can be removed). The new versions of units for generic keys and operations are modified versions of the units for bounded containers, with all tampering checks removed (they were no-op in formal containers). A declaration of constant Checks is added at the start of the body, as these units cannot use the version in Ada.Containers.Helpers. gcc/ada/ * Makefile.rtl: Add new files. * libgnat/a-cfhama.adb: Use formal version of hash tables. * libgnat/a-cfhama.ads: Same. * libgnat/a-cfhase.adb: Same. * libgnat/a-cfhase.ads: Same. * libgnat/a-chtgfk.adb: New unit for formal containers, modified version of Generic_Bounded_Keys. * libgnat/a-chtgfk.ads: Same. * libgnat/a-chtgfo.adb: New unit for formal containers, modified version of Generic_Bounded_Operations. * libgnat/a-chtgfo.ads: Same. * libgnat/a-cohata.ads (Generic_Formal_Hash_Table_Types): Third version of the type for hash tables, equivalent to the bounded version without tampering checks.
2022-05-13[Ada] Ada ABI change when building with assertionsJavier Miranda1-1/+41
Compiling with and without assertions enabled the name of some generated symbols differ; this is an issue when using pre-built libraries. gcc/ada/ * freeze.adb (Check_Inherited_Conditions): Dispatch table wrappers must be placed in the list of entities of their scope at the same place of their wrapped primitive. This is required for private types since these wrappers are built when their full tagged type declaration is frozen but they may override a primitive defined in the public part of the package (and it is important to maintain the wrapper in the list of public entities of the package to ensure their correct visibility).
2022-05-13[Ada] Take into account GNSA_ROOT env var for prefixJohannes Kanig2-3/+24
The GNSA_ROOT environment variable can be used to indicate to the compiler how to find the runtime directory. gcc/ada/ * osint.ads, osint.adb (Relocate_Path): If the GNSA_ROOT environment variable is set, we use that as the prefix, instead of computing the prefix from the executable location.
2022-05-13[Ada] Implement late initialization rules for type extensionsSteve Baird3-244/+529
Default initialization of a record object is required to initialize any components that "require late initialization" after other components. This includes the case of a type extension; "late initialization" components of the parent type are required to be initialized after non-late-init extension components. This is implemented by generalizing the use of an existing init proc parameter. Previously, the init proc for a tagged type took a Boolean parameter indicating whether or not to initialize the Tag component. With this change, this parameter can now take on any of four values indicating whether to perform 1) Full initialization (including the tag component). 2) Full initialization except for the tag component. 3) Early (non-tag) initialization only. 4) Late (non-tag) initialization only. With this change, the init proc for a type extension has the option of performing the early and late portions of the parent's initialization via two separate calls to the parent type's init proc. gcc/ada/ * exp_ch3.ads (Build_Intialization_Call): Add new formal parameter, Init_Control_Actual, with default value. Clients outside of package Exp_Ch3 are unaffected. * exp_ch3.adb (Initialization_Control): new package; support for this 4-valued parameter. The existing Requires_Late_Init function is moved into this new package. (Build_Initialization_Call): Add new formal parameter for subprogram body, use this new formal parameter in generating an init proc call. (Build_Record_Init_Proc): Replace Set_Tag Boolean formal parameter with 4-valued Init_Control_Formal. Wrap if-statements with appropriate conditions around tag initialization, early initialization, and late initialization statements. * exp_util.adb (Build_Task_Image_Decl): Avoid problem with duplicate declarations when an init proc for a type extension calls the parent type's init proc twice.
2022-05-13[Ada] Handle IN iterator for class-wide derived object of iterator typeEd Schonberg1-1/+13
The compiler currently rejects iterating on an interface type derived from an iterator type. See Ada RM 5.5.1(6/3) and 5.5.2(3/3). gcc/ada/ * sem_ch5.adb (Analyze_Iterator_Specification): Fix Typ in the case of a class-wide derived iterator.
2022-05-13[Ada] Facilitate proof of Overwrite in bounded strings libraryYannick Moy3-5/+5
Consistently use >= operator in both the code and contracts of function/procedure Overwrite, to facilitate proof, instead of the strict inequality > sometimes, as only New_Item remains in the result in the case of equal size too. gcc/ada/ * libgnat/a-strbou.ads (Overwrite): Switch to >= operator in contracts. * libgnat/a-strsup.adb (Super_Overwrite): Switch to >= operator in code of procedure (function already uses it). * libgnat/a-strsup.ads (Super_Overwrite): Switch to >= operator in contracts.
2022-05-13[Ada] Fix code example on representation clauseEtienne Servais2-6/+6
The column is superfluous, component names are missing. gcc/ada/ * doc/gnat_rm/representation_clauses_and_pragmas.rst: Fix code snippet. * gnat_rm.texi: Regenerate.
2022-05-13[Ada] Do not overwrite limited view of result typeEric Botcazou3-14/+4
This removes obsolete code that overwrites a limited view present as the result type of a function during the tentative analysis of prefixed views for function calls involving tagged types. The original view is necessary for the code generator to break the circularity present in this setup. The change also adds a couple of guards for the illegal case where the limited view is the only view available when the function is invoked. gcc/ada/ * aspects.adb (Find_Value_Of_Aspect): Add guard. * sem_ch4.adb (Complete_Object_Operation): Remove obsolete code. * sem_ch5.adb (Has_Sec_Stack_Default_Iterator): Add guard.
2022-05-13[Ada] Wrong address for class-wide interface access conversionJavier Miranda1-4/+25
The compiler generates wrong code on instantiations of package Address_To_Access_Conversions when the generic formal is a class-wide interface type; this causes wrong dispatching calls when the access-to-class-wide-interface object returned by To_Pointer is used to dispatch a call. gcc/ada/ * exp_attr.adb (Expand_N_Attribute_Reference): The expansion of 'Address in a call to an instantiation of the implicit subprogram To_Pointer with a class-wide interface type target requires adding an implicit type conversion to force displacement of the "this" pointer.
2022-05-13[Ada] Crash in task body reference to discriminantJavier Miranda1-0/+22
The compiler may crash processing the successor or predecessor of a task type discrete discriminant. gcc/ada/ * sem_attr.adb (Resolve_Attribute): Ensure that attribute expressions are resolved at this stage; required for preanalyzed references to discriminants since their resolution (and expansion) will take care of updating their Entity attribute to reference their discriminal.
2022-05-13[Ada] Improve expected type error messagesJustin Squirek1-2/+14
This patch improves error messages concerning type mismatches by printing the actual expected type in more cases instead of the expected type's first subtype. gcc/ada/ * sem_util.adb (Wrong_Type): Avoid using the first subtype of the expected type in error messages when the expected type is not internally generated.
2022-05-13[Ada] Document control flow redundancyAlexandre Oliva2-65/+180
Add documentation about -fharden-control-flow-redundancy. gcc/ada/ * doc/gnat_rm/security_hardening_features.rst: Add subsection on Control Flow Redundancy. * gnat_rm.texi: Regenerate.
2022-05-13[Ada] Fix compiler crash on FOR iteration scheme over containerEric Botcazou1-1/+1
The front-end drops a freeze node on the floor because it puts the node into the Condition_Actions of an N_Iteration_Scheme of a FOR loop. gcc/ada/ * exp_util.adb (Insert_Actions) <N_Iteration_Scheme>: Check that it is a WHILE iteration scheme before using Condition_Actions.