aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2024-05-17libstdc++: detect DLLs on windows with <stacktrace>Björn Schäpers3-0/+24
libstdc++-v3/ChangeLog: * acinclude.m4 (GLIBCXX_ENABLE_BACKTACE): Add check for tlhelp32.h, matching libbacktrace. * config.h.in: Regenerate. * configure: Regenerate. Signed-off-by: Björn Schäpers <bjoern@hazardy.de>
2024-05-17c++: aggregate CTAD w/ paren init and bases [PR115114]Patrick Palka2-0/+30
During aggregate CTAD with paren init, we're accidentally overlooking base classes since TYPE_FIELDS of a template type doesn't contain corresponding base fields. So we need to consider them separately. PR c++/115114 gcc/cp/ChangeLog: * pt.cc (maybe_aggr_guide): Consider bases in the paren init case. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/class-deduction-aggr15.C: New test. Reviewed-by: Jason Merrill <jason@redhat.com>
2024-05-17libstdc++: Fix typo in _Grapheme_cluster_view::_Iterator [PR115119]Jonathan Wakely2-2/+15
libstdc++-v3/ChangeLog: PR libstdc++/115119 * include/bits/unicode.h (_Iterator::operator++(int)): Fix typo in increment expression. * testsuite/ext/unicode/grapheme_view.cc: Check post-increment on view's iterator.
2024-05-17tree-into-ssa: speed up sorting in prune_unused_phi_nodes [PR114480]Alexander Monakov1-8/+9
In PR 114480 we are hitting a case where tree-into-ssa scales quadratically due to prune_unused_phi_nodes doing O(N log N) work for N basic blocks, for each variable individually. Sorting the 'defs' array is especially costly. It is possible to assist gcc_qsort by laying out dfs_out entries in the reverse order in the 'defs' array, starting from its tail. This is not always a win (in fact it flips most of 7-element qsorts in this testcase from 9 comparisons (best case) to 15 (worst case)), but overall it helps on the testcase and on libstdc++ build. On the testcase we go from 1.28e9 comparator invocations to 1.05e9, on libstdc++ from 2.91e6 to 2.84e6. gcc/ChangeLog: PR c++/114480 * tree-into-ssa.cc (prune_unused_phi_nodes): Add dfs_out entries to the 'defs' array in the reverse order.
2024-05-17[prange] Avoid looking at type() for undefined rangesAldy Hernandez2-0/+35
Undefined ranges have no type. This patch fixes the thinko. gcc/ChangeLog: PR middle-end/115128 * ipa-cp.cc (ipa_value_range_from_jfunc): Check for undefined_p before looking at type. (propagate_vr_across_jump_function): Same. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/pr115128.c: New test.
2024-05-17middle-end/115110 - Fix view_converted_memref_pRichard Biener1-2/+3
view_converted_memref_p was checking the reference type against the pointer type of the offset operand rather than its pointed-to type which leads to all refs being subject to view-convert treatment in get_alias_set causing numerous testsuite fails but with its new uses from r15-512-g9b7cad5884f21c is also a wrong-code issue. PR middle-end/115110 * tree-ssa-alias.cc (view_converted_memref_p): Fix.
2024-05-17Small fix to implementation of -fdump-ada-specEric Botcazou1-4/+3
gcc/c-family/ * c-ada-spec.cc (bitfield_used): Move around. (packed_layout): Likewise. (dump_ada_array_type): Do not put "aliased" for a packed layout.
2024-05-17Remove spurious lineEric Botcazou1-1/+0
2024-05-17Add widening expansion of MULT_HIGHPART_EXPR for integral modesEric Botcazou4-35/+52
For integral modes the expansion of MULT_HIGHPART_EXPR requires the presence of an {s,u}mul_highpart optab whereas, for vector modes, widening expansion is supported. This adds a widening expansion for integral modes too, which is in fact already implemented in expmed_mult_highpart_optab. gcc/ * expmed.h (expmed_mult_highpart_optab): Declare. * expmed.cc (expmed_mult_highpart_optab): Remove static keyword. Do not assume that OP1 is a constant integer. Fix pasto. (expmed_mult_highpart): Pass OP1 narrowed to MODE in all the calls to expmed_mult_highpart_optab. * optabs-query.cc (can_mult_highpart_p): Use 2 for integer widening and shift subsequent values accordingly. * optabs.cc (expand_mult_highpart): Call expmed_mult_highpart_optab when can_mult_highpart_p returns 2 and adjust to above change.
2024-05-17Add missing check for const_pool in the escaped solutionsRichard Biener4-1/+40
The ptr-vs-ptr compare folding using points-to info was missing a check for const_pool being included in the escaped solution. The following fixes that, fixing the observed execute FAIL of experimental/functional/searchers.cc * tree-ssa-alias.h (pt_solution_includes_const_pool): Declare. * tree-ssa-alias.cc (ptrs_compare_unequal): Use pt_solution_includes_const_pool. * tree-ssa-structalias.cc (pt_solution_includes_const_pool): New. * gcc.dg/torture/20240517-1.c: New testcase.
2024-05-17ada: Improve deriving initial sizes for container aggregatesViljar Indus1-28/+55
Deriving the initial size of container aggregates is necessary for deriving the correct capacity for bounded containers. Add support for deriving the correct initial size when the container aggregate is iterating over an array object. gcc/ada/ * exp_aggr.adb (Expand_Container_Aggregate): Derive the size for iterable aggregates in the case of one-dimensional array objects.
2024-05-17ada: Remove outdated workaround in aggregate expansionRonan Desplanques1-5/+4
Before this patch, the compiler refrained from rewriting aggregates into purely positional form in some cases of one-component aggregates. As explained in comments, this was because the back end could not handle positional aggregates in those situations. As the back end seems to have grown more capable, this patch removes the workaround. It also extends the comments describing a warning that is emitted in the same configuration with aggregates. gcc/ada/ * exp_aggr.adb (Aggr_Size_OK): Remove workaround and extend comment.
2024-05-17ada: Start the initialization of the tasking runtime earlierEric Botcazou3-12/+40
This installs the tasking versions of the RTS_Lock manipulation routines very early, before the elaboration of all the Ada units of the program, including those of the runtime, because this elaboration may require the initialization of RTS_Lock objects. gcc/ada/ * bindgen.adb (Gen_Adainit): Generate declaration and call to the imported procedure __gnat_tasking_runtime_initialize if need be. * libgnat/s-soflin.ads (Locking Soft-Links): Add commentary. * libgnarl/s-tasini.adb (Tasking_Runtime_Initialize): New procedure exported as __gnat_tasking_runtime_initialize. Initialize RTS_Lock manipulation routines here instead of... (Init_RTS): ...here.
2024-05-17ada: Improve test for unprocessed preprocessor directivesSteve Baird1-61/+122
Preprocessor directives are case insensitive and may have spaces or tabs between the '#' and the keyword. When checking for the error case of unprocessed preprocessor directives, take these rules into account. gcc/ada/ * scng.adb (scan): When checking for an unprocessed preprocessor directive, take into account the preprocessor's rules about case insensitivity and about white space between the '#' and the keyword.
2024-05-17ada: Restore dependency on System.OS_Interface in System.Task_PrimitivesEric Botcazou1-1/+2
The dependency is relied upon by the binder to drag the tasking runtime. gcc/ada/ * libgnarl/s-taspri__mingw.ads: Add clause for System.OS_Interface. (Private_Data): Change type of Thread component.
2024-05-17ada: Further adjustments coming from aliasing considerationsEric Botcazou2-0/+14
They are needed on 32-bit platforms because of different calling conventions and again in the units implementing AltiVec and Streams support. gcc/ada/ * libgnat/g-alvevi.ads: Add pragma Universal_Aliasing for all the view types. * libgnat/s-stratt.ads: Likewise for Fat_Pointer type.
2024-05-17ada: Replace spinlocks with fully-fledged locks in finalization collectionsEric Botcazou54-368/+723
This replaces spinlocks with fully-fledged locks in finalization collections because the former are deemed problematic with tasks that can be preempted. Because of the requirement to avoid dragging the tasking runtime when it is not necessary, the implementation goes through the usual soft links, with an additional hurdle that space must be reserved for the lock in any case since it is part of the ABI. This entails the introduction of the System.OS_Locks unit in the non-tasking runtime and the modification of the tasking runtime to also use this unit. This in turn requires a small adjustment: because of the presence of pre- and post-conditions in Interfaces.C and of the limitations of the RTSfind mechanism, the System.Finalization_Primitives unit must be preloaded, as what is done for the Ada.Strings.Text_Buffers unit. This effectively reverts the implementation to using the global task lock on bare board platforms. gcc/ada/ * Makefile.rtl (GNATRTL_NONTASKING_OBJS): Add s-oslock$(objext). (LIBGNAT_TARGET_PAIRS): Use s-oslock__dummy.ads by default. Set specific s-oslock.ads source file for all the platforms. * exp_ch7.ads (Preload_Finalization_Collection): New procedure. * exp_ch7.adb (Allows_Finalization_Collection): Return False if System.Finalization_Primitives has not been preloaded. (Preload_Finalization_Collection): New procedure. * opt.ads (Interface_Seen): New boolean variable. * s-oscons-tmplt.c: Use "N" string for pragma Style_Checks. * scng.adb (Scan): Set Interface_Seen upon seeing "interface". * sem_ch10.adb: Add clause for Exp_Ch7. (Analyze_Compilation_Unit): Call Preload_Finalization_Collection after the context of the unit is analyzed. * libgnarl/a-rttiev.adb: Add with clause for System.OS_Locks and alphabetize others. (Event_Queue_Lock): Adjust qualified name of subtype. * libgnarl/s-osinte__aix.ads: Add with clause for System.OS_Locks and change pthread_mutex_t into a local subtype. * libgnarl/s-osinte__android.ads: Likewise. * libgnarl/s-osinte__darwin.ads: Likewise. * libgnarl/s-osinte__dragonfly.ads: Likewise. * libgnarl/s-osinte__freebsd.ads: Likewise. * libgnarl/s-osinte__gnu.ads: Likewise. * libgnarl/s-osinte__hpux-dce.ads: Likewise. * libgnarl/s-osinte__hpux.ads: Add Likewise. * libgnarl/s-osinte__kfreebsd-gnu.ads: Likewise. * libgnarl/s-osinte__linux.ads: Likewise. * libgnarl/s-osinte__lynxos178e.ads: Likewise. * libgnarl/s-osinte__qnx.ads: Likewise. * libgnarl/s-osinte__rtems.ads: Likewise. * libgnarl/s-osinte__mingw.ads: Add with clause for System.OS_Locks and change CRITICAL_SECTION into a local subtype. Add declarations for imported procedures dealing with CRITICAL_SECTION. * libgnarl/s-osinte__solaris.ads: Add with clause for System.OS_Locks and change mutex_t into a local subtype. * libgnarl/s-osinte__vxworks.ads: Add missing blank line. * libgnarl/s-taprop.ads: Alphabetize clauses and package renamings. Use qualified name for RTS_Lock throughout. * libgnarl/s-taprop__dummy.adb: Add use clause for System.OS_Locks and alphabetize others. * libgnarl/s-taprop__hpux-dce.adb: Likewise. * libgnarl/s-taprop__linux.adb: Likewise. * libgnarl/s-taprop__posix.adb: Likewise. * libgnarl/s-taprop__qnx.adb: Likewise. * libgnarl/s-taprop__rtems.adb: Likewise. * libgnarl/s-taprop__solaris.adb: Likewise. * libgnarl/s-taprop__vxworks.adb: Likewise. * libgnarl/s-taprop__mingw.adb: Likewise. Remove declarations for imported procedures dealing with CRITICAL_SECTION. * libgnarl/s-tarest.adb: Add with clause for System.OS_Locks and alphabetize others. (Global_Task_Lock): Adjust qualified name of subtype. * libgnarl/s-tasini.adb: Add clause for System.OS_Locks. (Initialize_RTS_Lock): New procedure. (Finalize_RTS_Lock): Likewise. (Acquire_RTS_Lock): Likewise. (Release_RTS_Lock): Likewise. (Init_RTS): Add compile-time assertions for RTS_Lock types. Set the soft links for the RTS lock manipulation routines. * libgnarl/s-taspri__dummy.ads: Add with clause for System.OS_Locks. (RTS_Lock): Delete and adjust throughout accordingly. * libgnarl/s-taspri__hpux-dce.ads: Likewise. * libgnarl/s-taspri__lynxos.ads: Likewise. * libgnarl/s-taspri__mingw.ads: Likewise. * libgnarl/s-taspri__posix-noaltstack.ads: Likewise. * libgnarl/s-taspri__posix.ads: Likewise. * libgnarl/s-taspri__solaris.ads: Likewise. * libgnarl/s-taspri__vxworks.ads: Likewise. * libgnat/s-finpri.ads: Add clause for System.OS_Locks. (Finalization_Collection): Change type of Lock. * libgnat/s-finpri.adb (Initialize): Call Initialize_RTS_Lock. (Lock_Collection): Call Acquire_RTS_Lock. (Unlock_Collection): Call Release_RTS_Lock. * libgnat/s-oslock__dummy.ads: New file. * libgnat/s-oslock__hpux-dce.ads: Likewise. * libgnat/s-oslock__mingw.ads: Likewise. * libgnat/s-oslock__posix.ads: Likewise. * libgnat/s-oslock__solaris.ads: Likewise. * libgnat/s-oslock__vxworks.ads: Likewise. * libgnat/s-soflin.ads (Null_Set_Address): New null procedure. (Initialize_RTS_Lock): New soft link. (Finalize_RTS_Lock): Likewise. (Acquire_RTS_Lock): Likewise. (Release_RTS_Lock): Likewise. * exp_ch4.adb (Expand_N_Allocator): In the subtype indication case, call Apply_Predicate_Check on the resulting access value if need be.
2024-05-17ada: Document secondary usage of Materialize_Entity flagEric Botcazou1-2/+3
The flag is also used by the semantic analyzer. gcc/ada/ * einfo.ads (Materialize_Entity): Document secondary usage.
2024-05-17ada: Bug in computing local restrictions inherited from enclosing scopes.Steve Baird1-13/+19
In the function Local_Restrict.Active_Restriction, we traverse enclosing scopes looking for a relevant Local_Restrictions aspect specification. Fix a bug in this traversal. gcc/ada/ * local_restrict.adb (Active_Restriction): When traversing scopes, do not skip over a subprogram body.
2024-05-17ada: Factor out duplicated code in bodies of System.Task_Primitives.OperationsEric Botcazou5-129/+90
The duplication is present in some POSIX-like implementations (POSIX and RTEMS) while it has already been eliminated in others (Linux, QNX). The latter implementations are also slightly modified for consistency's sake. No functional changes. gcc/ada/ * libgnarl/s-taprop__dummy.adb (Initialize_Lock): Fix formatting. * libgnarl/s-taprop__linux.adb (RTS_Lock_Ptr): Delete. (Init_Mutex): Rename into... (Initialize_Lock): ...this. (Initialize_Lock [Lock]): Call above procedure. (Initialize_Lock [RTS_Lock]): Likewise. (Initialize_TCB): Likewise. * libgnarl/s-taprop__posix.adb (Initialize_Lock): New procedure factored out from the other two homonyms. (Initialize_Lock [Lock]): Call above procedure. (Initialize_Lock [RTS_Lock]): Likewise. * libgnarl/s-taprop__qnx.adb (RTS_Lock_Ptr): Delete. (Init_Mutex): Rename into... (Initialize_Lock): ...this. (Initialize_Lock [Lock]): Call above procedure. (Initialize_Lock [RTS_Lock]): Likewise. (Initialize_TCB): Likewise. * libgnarl/s-taprop__rtems.adb (Initialize_Lock): New procedure factored out from the other two homonyms. (Initialize_Lock [Lock]): Call above procedure. (Initialize_Lock [RTS_Lock]): Likewise.
2024-05-17ada: Fix for validity checking and conditional evaluation of 'OldPiotr Trojanek1-0/+8
Detection of expression that are "known on entry" (as defined in Ada 2022 RM 6.1.1(20/5)) was confused by validity checks when used from within expansion of attribute 'Old. gcc/ada/ * sem_util.adb (Is_Known_On_Entry): Handle constants introduced by validity checks.
2024-05-17ada: Do not query the modification time of a special file.Steve Baird1-2/+16
In Ada.Directories, the function Modification_Time raises Name_Error if it is called for a special file. So don't do that in Start_Search_Internal. gcc/ada/ * libgnat/a-direct.adb (Start_Search_Internal): Do not call Modification_Time for a special file; declare a Calendar.Time constant No_Time and use that instead.
2024-05-17ada: Disable Equivalent_Array_Aggregate optimization if predicates involvedSteve Baird1-0/+1
In most paths, the function Build_Equivalent_Record_Aggregate was already testing Has_Predicates for a given component type and conditionally returning an Empty result. This is also needed in the case of a scalar component type. Without it, we can build corrupt trees that fail use-before-definition detection checks in gigi. gcc/ada/ * exp_ch3.adb (Build_Equivalent_Record_Aggregate): Add Has_Predicates test for a scalar component to match what is already done for other kinds of components.
2024-05-17ada: Clarify code for aggregate warningsRonan Desplanques1-27/+25
This patch improves comments in code that emits warnings about particular situations involving aggregates. It also removes a conjunct in a condition that's useless because always true in the context of the test. gcc/ada/ * sem_aggr.adb (Resolve_Array_Aggregate): Improve comments and condition.
2024-05-17ada: Fix others error message locationRonan Desplanques1-24/+19
Before this patch, the compiler pointed at the wrong component association when reporting an illegal occurrence of "others" in an aggregate. This patch fixes this by keeping track of which choice contains the occurrence of "others" when resolving array aggregates. gcc/ada/ * sem_aggr.adb (Resolve_Array_Aggregate): Fix location of error message.
2024-05-17ada: Expose utility routine for processing of Depends contracts in SPARKPiotr Trojanek3-29/+28
Routine Is_Unconstrained_Or_Tagged_Item is now used both in the GNAT frontend (for checking legality of Depends clauses) and in the GNATprove backend (for representing implicit inputs in flow graphs). gcc/ada/ * sem_prag.adb (Is_Unconstrained_Or_Tagged_Item): Move to Sem_Util, so it can be used from GNATprove. * sem_util.ads (Is_Unconstrained_Or_Tagged_Item): Move from Sem_Prag; spec. * sem_util.adb (Is_Unconstrained_Or_Tagged_Item): Move from Sem_Prag; body.
2024-05-17ada: Couple of adjustments coming from aliasing considerationsEric Botcazou4-9/+71
The first adjustment is to the expansion of implementation types for array types with peculiar index types, for which the aliased property set on the component of the original type must be copied; the implicit base type also needs to be properly marked if the implementation type is constrained. The second adjustment is to selected types in the runtime, which need to be marked with pragma Universal_Aliasing because of their special usage. gcc/ada/ * exp_pakd.adb (Create_Packed_Array_Impl_Type): For non-bit-packed array types, propagate the aliased property of the component. (Install_PAT): Set fields on the implicit base type of an array. * libgnat/a-stream.ads (private part): Add pragma Universal_Aliasing for Stream_Element. * libgnat/g-alleve.ads: Add pragma Universal_Aliasing for all the vector types. * libgnat/g-alleve__hard.ads: Likewise.
2024-05-17ada: gnatbind: subprogram spec no longer existsBob Duff5-98/+141
If a subprogram spec S is present while compiling something that says "with S;", but the spec is absent while compiling the body of S, then gnatbind fails to detect the mismatch. The spec and body of S might have different parameter and result types. This patch fixes gnatbind to detect this case and give an error. gcc/ada/ * bcheck.adb (Check_Consistency_Of_Sdep): Split out new procedure. Add check for special case of subprogram spec that no longer exists. (Check_Consistency): Call Check_Consistency_Of_Sdep, except when Reified_Child_Spec is True. No need for "goto Continue" or "exit Sdep_Loop". * ali.ads (Subunit_Name, Unit_Name): Change the type to Unit_Name_Type. Add a comment pointing to the ALI file documentation, because it's in a somewhat-surprising place. * ali.adb (Scan_ALI): Subunit_Name and Unit_Name are now Unit_Name_Type. Remove comment explaining why Name_Find is used; Name_Find is the usual case. Do not remove the "%s" or "%b" from the Unit_Name. We need to be able to distinguish specs and bodies. This is also necessary to obey the invariant of Unit_Name_Type. * binde.adb (Write_Closure): Subunit_Name is now Unit_Name_Type. * clean.adb (Clean_Executables): Likewise.
2024-05-17ada: Update docs for Resolve_Null_Array_AggregateRonan Desplanques1-6/+6
The documentation comments for Sem_Aggr.Resolve_Null_Array_Aggregate suggested that this subprogram created a subtype, which it didn't. This patch replaces those comments with ones that better match the behavior. gcc/ada/ * sem_aggr.adb (Resolve_Null_Array_Aggregate): Update documentation comments.
2024-05-17ada: Fix containers' Reference_Preserving_Key functions' memory leaksSteve Baird7-3/+61
Fix memory leaks in containers' Reference_Preserving_Key functions Make the same change in each of 3 Ada.Containers child units: Ordered_Sets, Indefinite_Ordered_Sets, and Bounded_Ordered_Sets. The function Reference_Preserving_Key evaluates an allocator of type Key_Access whose storage was not being reclaimed. Update the Finalize procedure for type Reference_Control_Type to free that storage. But this change introduces a possible erroneous double-free situation if an object is copied (because the original and the copy will each be finalized at some point). So also introduce an Adjust procedure which allocates a copy of the allocated object. Another possible solution to this problem (which is not being implemented yet) is based on implementing AI22-0082. Also include a fix for a bug in Sem_Util.Has_Some_Controlled_Component that was discovered while working on this. gcc/ada/ * sem_util.adb (Has_Some_Controlled_Component): Fix a bug which causes (in some cases involving a Disable_Controlled aspect specification) Needs_Finalization to return different answers for one type depending on whether the function is called before or after the type is frozen. * libgnat/a-coorse.ads: Type Control_Reference_Type gets an Adjust procedure. * libgnat/a-cborse.ads: Likewise. * libgnat/a-ciorse.ads: Likewise * libgnat/a-coorse.adb: (Finalize): Reclaim allocated Key_Type object. (Adjust): New procedure; prevent sharing of non-null Key_Access values by allocating a copy. * libgnat/a-cborse.adb: Likewise. * libgnat/a-ciorse.adb: Likewise.
2024-05-17ada: correction to gnatbind-related cleanupsBob Duff1-3/+2
Correction to previous change; Asserts had been moved to before Buf was initialized. gcc/ada/ * uname.adb (Get_Unit_Name_String): Move Asserts after Buf is initialized.
2024-05-17ada: gnatbind-related cleanupsBob Duff3-45/+28
This patch cleans up some things noticed while working on gnatbind. No change in behavior yet. gcc/ada/ * ali-util.adb (Read_Withed_ALIs): Minor reformatting. * bindo-units.adb (Corresponding_Body): Add assert. (Corresponding_Spec): Likewise. * uname.adb: Clean up assertions, use available functions. Get_Spec_Name/Get_Body_Name can assert that N obeys the conventions for Unit_Name_Type (end in "%s" or "%b").
2024-05-17ada: Make raise-gcc.c compatible with ClangSebastian Poeplau1-0/+8
The Morello variant of Clang doesn't have __builtin_code_address_from_pointer; work around it where necessary. gcc/ada/ * raise-gcc.c: Work around __builtin_code_address_from_pointer if it is unavailable.
2024-05-17ada: Fix crash caused by missing New_Copy_treeMarc Poulhiès1-3/+6
Since a recent refactor ("Factor common processing in expansion of aggregates") where Initialize_Array_Component and Initialize_Record_Component are merged, the behavior has slightly changed. In the case of the expansion of an aggregate initialization where the number of 'others' components is <= 3, the initialization expression is not duplicated anymore, causing some incorrect multiple definition when said expression is later transformed with Expressions_With_Action that declares an object. The simple fix is to add the now missing New_Copy_Tree where the assignments are created. gcc/ada/ * exp_aggr.adb (Build_Array_Aggr_Code) <Gen_Loop>: Copy the initialization expression when unrolling the loop.
2024-05-17ada: Fix Constraint_Error on mutable assignmentBob Duff1-1/+2
For an assignment statement "X := Y;", where X is a formal parameter of a "late overriding" subprogram (i.e. it has no spec, and the body is overriding), and the subtype of X is an unconstrained record with defaulted discriminants, if the actual parameter passed to X is unconstrained, then X is unconstrained. This patch fixes a bug where X was incorrectly considered constrained, so that if Y's discriminants are different from X, Constraint_Error was raised. The bug was caused by the fact that an extra "constrained" formal parameter was missing in both caller and callee. gcc/ada/ * sem_disp.adb (Check_Dispatching_Operation): Call Create_Extra_Formals, so that the caller will have an extra "constrained" parameter, which will be checked on assignment in the callee, and will be passed in by the caller.
2024-05-17ada: Only record types with discriminants can be unconstrainedPiotr Trojanek1-7/+4
Remove redundant condition for detecting unconstrained record types. Code cleanup; behavior is unaffected. gcc/ada/ * sem_prag.adb (Is_Unconstrained_Or_Tagged_Item): Remove call to Has_Discriminants; combine ELSIF branches.
2024-05-17ada: Simplify code for private types with unknown discriminantsPiotr Trojanek2-6/+4
Private type entities have Is_Constrained set when they have no discriminants and no unknown discriminants; it is now set slightly later, but simpler (this change could only affect Process_Discriminants, but this flag should not be needed there). Also, we now reuse this flag to detect private types with discriminants. Code cleanup; behavior is unaffected. gcc/ada/ * sem_ch7.adb (New_Private_Type): Simplify setting of Is_Constrained flag. * sem_prag.adb (Is_Unconstrained_Or_Tagged_Item): Simplify detection of private types with no discriminant.
2024-05-17ada: Allow private items with unknown discriminants as Depends inputsPiotr Trojanek1-2/+4
Objects of private types with unknown discriminants are now allowed as inputs in the Depends contracts. gcc/ada/ * sem_prag.adb (Is_Unconstrained_Or_Tagged_Item): Allow objects of private types with unknown discriminants.
2024-05-17ada: Tune detection of unconstrained and tagged items in Depends contractPiotr Trojanek1-4/+4
The Tagged/Array/Record/Private types are mutually exclusive, so they can be examined like with a case statement (except for records with private extensions, but their handling is not affected by this change). gcc/ada/ * sem_prag.adb (Is_Unconstrained_Or_Tagged_Item): Tune repeated testing of type kinds.
2024-05-17ada: Fix probable copy/paste errorMarc Poulhiès3-10/+8
gcc/ada/ * doc/gnat_rm/implementation_defined_attributes.rst: Fix copy/paste. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2024-05-17ada: Check subtype to avoid a precondition failureViljar Indus1-2/+3
gcc/ada/ * sem_ch3.adb (Analyze_Component_Declaration): Apply range checks only for Scalar_Types to ensure that they have the Scalar_Range attribute.
2024-05-17ada: Fix checking range constraints within composite typesViljar Indus1-0/+50
Subtype indications were never analyzed if they were within composite types. Analyze them explicitly within Analyze_Component_Declaration. gcc/ada/ * sem_ch3.adb (Analyze_Component_Declaration): Add Range_Checks for Subtype_Indications
2024-05-17ada: Remove superfluous Relocate_Node callsRonan Desplanques2-2/+2
This patch removes two calls to Relocate_Node that were not needed. This does not affect the behavior of the compiler. gcc/ada/ * exp_ch4.adb (Expand_N_Case_Expression): Remove call to Relocate_Node. * sem_attr.adb (Analyze_Attribute): Likewise.
2024-05-17ada: Small cleanup in aggregate expansion codeRonan Desplanques1-8/+8
This patch moves a statement outside of a loop because it didn't need to be inside that loop. The behavior of the program is not affected. gcc/ada/ * exp_aggr.adb (Flatten): Small cleanup.
2024-05-17ada: Add support for 'Object_Size to pragma Compile_Time_{Warning,Error}Eric Botcazou1-64/+65
With the same level as for 'Size, that is to say, full evaluation of the boolean expressions it may be contained in and handling of private types. gcc/ada/ * sem_attr.adb (Analyze_Attribute) <Attribute_Size>: Remove special processing for pragma Compile_Time_{Warning,Error}. (Eval_Attribute.Compile_Time_Known_Attribute): Set Is_Static on the resulting value if In_Compile_Time_Warning_Or_Error is set. (Eval_Attribute.Full_Type): New helper function. (Eval_Attribute): Call Full_Type for type attributes. Add handling of Object_Size and adjust that of Max_Size_In_Storage_Elements in the non-static case.
2024-05-17make -freg-struct-return visibly a negative alias of -fpcc-struct-returnAlexandre Oliva1-2/+2
The fact that both options accept negative forms suggests that maybe they aren't negative forms of each other. They are, but that isn't clear even by examining common.opt. Use NegativeAlias to make it abundantly clear. The 'Optimization' keyword next to freg-struct-return was the only thing that caused flag_pcc_struct_return to be a per-function flag, and ipa-inline relied on that. After making it an alias, the Optimization keyword was no longer operational. I'm not sure it was sensible or desirable for flag_pcc_struct_return to be a per-function setting, but this patch does not intend to change behavior. for gcc/ChangeLog * common.opt (freg-struct-return): Make it explicitly fpcc-struct-return's NegativeAlias. Copy Optimization... (freg-struct-return): ... here.
2024-05-17RISC-V: Cleanup some temporally files [NFC]Pan Li2-0/+0
Just notice some temporally files under gcc/config/riscv, deleted as useless. * Empty file j. * Vim swap file. gcc/ChangeLog: * config/riscv/.riscv.cc.swo: Removed. * config/riscv/j: Removed. Signed-off-by: Pan Li <pan2.li@intel.com>
2024-05-16Update gcc sv.poJoseph Myers1-329/+185
* sv.po: Update.
2024-05-16RISC-V: Enable vectorizable early exit testsuitePan Li3-1/+5
After we supported vectorizable early exit in RISC-V, we would like to enable the gcc vect test for vectorizable early test. The vect-early-break_124-pr114403.c failed to vectorize for now. Because that the __builtin_memcpy with 8 bytes failed to folded into int64 assignment during ccp1. We will improve that first and mark this as xfail for RISC-V. The below tests are passed for this patch: 1. The riscv fully regression tests. gcc/testsuite/ChangeLog: * gcc.dg/vect/slp-mask-store-1.c: Add pragma novector as it will have 2 times LOOP VECTORIZED in RISC-V. * gcc.dg/vect/vect-early-break_124-pr114403.c: Xfail for the riscv backend. * lib/target-supports.exp: Add RISC-V backend. Signed-off-by: Pan Li <pan2.li@intel.com>
2024-05-16RISC-V: Implement vectorizable early exit with vcond_mask_lenPan Li6-9/+175
After we support the loop lens for the vectorizable, we would like to implement the feature for the RISC-V target. Given below example: unsigned vect_a[1923]; unsigned vect_b[1923]; void test (unsigned limit, int n) { for (int i = 0; i < n; i++) { vect_b[i] = limit + i; if (vect_a[i] > limit) { ret = vect_b[i]; return ret; } vect_a[i] = limit; } } Before this patch: ... .L8: sw a3,0(a5) addiw a0,a0,1 addi a4,a4,4 addi a5,a5,4 beq a1,a0,.L2 .L4: sw a0,0(a4) lw a2,0(a5) bleu a2,a3,.L8 ret After this patch: ... .L5: vsetvli a5,a3,e8,mf4,ta,ma vmv1r.v v4,v2 vsetvli t4,zero,e32,m1,ta,ma vmv.v.x v1,a5 vadd.vv v2,v2,v1 vsetvli zero,a5,e32,m1,ta,ma vadd.vv v5,v4,v3 slli a6,a5,2 vle32.v v1,0(t1) vmsltu.vv v1,v3,v1 vcpop.m t4,v1 beq t4,zero,.L4 vmv.x.s a4,v4 .L3: ... The below tests are passed for this patch: 1. The riscv fully regression tests. gcc/ChangeLog: * config/riscv/autovec-opt.md(*vcond_mask_len_popcount_<VB_VLS:mode><P:mode>): New pattern of vcond_mask_len_popcount for vector bool mode. * config/riscv/autovec.md (vcond_mask_len_<mode>): New pattern of vcond_mask_len for vector bool mode. (cbranch<mode>4): New pattern for vector bool mode. * config/riscv/vector-iterators.md: Add new unspec UNSPEC_SELECT_MASK. * config/riscv/vector.md (@pred_popcount<VB:mode><P:mode>): Add VLS mode to popcount pattern. (@pred_popcount<VB_VLS:mode><P:mode>): Ditto. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/early-break-1.c: New test. * gcc.target/riscv/rvv/autovec/early-break-2.c: New test. Signed-off-by: Pan Li <pan2.li@intel.com>