Skip to content
Snippets Groups Projects
  1. May 14, 2024
    • Ronan Desplanques's avatar
      ada: Fix crash with -gnatdJ and JSON output · 996fd764
      Ronan Desplanques authored
      This patch tweaks the calls made to Errout subprograms to report
      violations of dependence restrictions, in order fix a crash that
      occurred with -gnatdJ and -fdiagnostics-format=json.
      
      gcc/ada/
      
      	* restrict.adb (Violation_Of_No_Dependence): Tweak error
      	reporting calls.
      996fd764
    • Ronan Desplanques's avatar
      ada: Fix crash with -gnatdJ and -gnatw.w · 34aba154
      Ronan Desplanques authored
      This patch fixes a crash when -gnatdJ is enabled and a warning
      must be emitted about an ineffective pragma Warnings clause.
      
      Some modifications are made to the specific warnings machinery so
      that warnings carry the ID of the pragma node they're about, so the
      -gnatdJ mechanism can find an appropriate enclosing subprogram.
      
      gcc/ada/
      
      	* sem_prag.adb (Analyze_Pragma): Adapt call to new signature.
      	* erroutc.ads (Set_Specific_Warning_Off): change signature
      	and update documentation.
      	(Validate_Specific_Warnings): Move ...
      	* errout.adb: ... here and change signature. Also move body
      	of Validate_Specific_Warnings from erroutc.adb.
      	(Finalize): Adapt call.
      	* errout.ads (Set_Specific_Warning_Off): Adapt signature of
      	renaming.
      	* erroutc.adb (Set_Specific_Warning_Off): Adapt signature and
      	body.
      	(Validate_Specific_Warnings): Move to the body of Errout.
      	(Warning_Specifically_Suppressed): Adapt body.
      34aba154
    • Eric Botcazou's avatar
      ada: Restore default size for dynamic allocations of discriminated type · 06262650
      Eric Botcazou authored
      The allocation strategy for objects of a discriminated type with defaulted
      discriminants is not the same when the allocation is dynamic as when it is
      static (i.e a declaration): in the former case, the compiler allocates the
      default size whereas, in the latter case, it allocates the maximum size.
      
      This restores the default size, which was dropped during the refactoring.
      
      gcc/ada/
      
      	* exp_aggr.adb (Build_Array_Aggr_Code): Pass N in the call to
      	Build_Initialization_Call.
      	(Build_Record_Aggr_Code): Likewise.
      	(Convert_Aggr_In_Object_Decl): Likewise.
      	(Initialize_Discriminants): Likewise.
      	* exp_ch3.ads (Build_Initialization_Call): Replace Loc witn N.
      	* exp_ch3.adb (Build_Array_Init_Proc): Pass N in the call to
      	Build_Initialization_Call.
      	(Build_Default_Initialization): Likewise.
      	(Expand_N_Object_Declaration): Likewise.
      	(Build_Initialization_Call): Replace Loc witn N parameter and add
      	Loc local variable.  Build a default subtype for an allocator of
      	a discriminated type with defaulted discriminants.
      	(Build_Record_Init_Proc): Pass the declaration of components in the
      	call to Build_Initialization_Call.
      	* exp_ch6.adb (Make_CPP_Constructor_Call_In_Allocator): Pass the
      	allocator in the call to Build_Initialization_Call.
      06262650
    • Ronan Desplanques's avatar
      ada: Fix typo in diagnostic message · ab4a519a
      Ronan Desplanques authored
      A previous change introduced an error in the diagnostic message about
      overlapping actuals. This commit fixes this.
      
      gcc/ada/
      
      	* sem_warn.adb (Warn_On_Overlapping_Actuals): Fix typo.
      ab4a519a
    • Gary Dismukes's avatar
      ada: Compiler crash or errors on if_expression in container aggregate · a9714dce
      Gary Dismukes authored
      The compiler may either crash or incorrectly report errors when
      a component association in a container aggregate is an if_expression
      with an elsif part whose dependent expression is a call to a function
      returning a result that requires finalization. The compiler complains
      that a private type is expected, but a package or procedure name was
      found. This is due to the compiler improperly associating expanded
      calls to Finalize_Object with the aggregate, rather than the enclosing
      object declaration being initialized by the aggregate, which can result
      in the Finalize_Object procedure call being passed as an actual to
      the Add_Unnamed operation of the container type and leading to a type
      mismatch and the confusing error message. This is fixed by adjusting
      the code that locates the proper context for insertion of Finalize_Object
      calls to locate the enclosing declaration or statement rather than
      stopping at the aggregate.
      
      gcc/ada/
      
      	* exp_util.adb (Find_Hook_Context): Exclude N_*Aggregate Nkinds
      	of Parent (Par) from the early return in the second loop of the
      	In_Cond_Expr case, to prevent returning an aggregate from this
      	function rather than the enclosing declaration or statement.
      a9714dce
    • Steve Baird's avatar
      ada: Replace "not Present" tests with "No". · fb48b0aa
      Steve Baird authored
      Fix constructs that were flagged by CodePeer.
      
      gcc/ada/
      
      	* exp_attr.adb: Replace 6 "not Present" tests with equivalent calls to "No".
      fb48b0aa
    • Eric Botcazou's avatar
      ada: Follow-up adjustment after fix to Default_Initialize_Object · ba0b16a5
      Eric Botcazou authored
      Now that Default_Initialize_Object honors the No_Initialization flag in all
      cases, objects of an access type declared without initialization expression
      can no longer be considered as being automatically initialized to null.
      
      gcc/ada/
      
      	* exp_ch3.adb (Expand_N_Object_Declaration): Examine the Expression
      	field after the call to Default_Initialize_Object in order to set
      	Is_Known_Null, as well as Is_Known_Non_Null, on an access object.
      ba0b16a5
    • Steve Baird's avatar
      ada: Reduce generated code duplication for streaming and Put_Image subprograms · 0b7673ae
      Steve Baird authored
      In the case of an untagged composite type, the compiler does not generate
      streaming-related subprograms or a Put_Image procedure when the type is
      declared. Instead, these subprograms are declared "on demand" when a
      corresponding attribute reference is encountered. In this case, hoist the
      declaration of the implicitly declared subprogram out as far as possible
      in order to maximize the chances that it can be reused (as opposed to
      generating an identical second subprogram) in the case where a second
      reference to the same attribute is encountered. Also relax some
      privacy-related rules to allow these procedures to do what they need to do
      even when constructed in a scope where some of those actions would
      normally be illegal.
      
      gcc/ada/
      
      	* exp_attr.adb: Change name of package Cached_Streaming_Ops to
      	reflect the fact that it is now also used for Put_Image
      	procedures. Similarly change other "Streaming_Op" names therein.
      	Add Validate_Cached_Candidate procedure to detect case where a
      	subprogram found in the cache cannot be reused. Add new generic
      	procedure Build_And_Insert_Type_Attr_Subp; the "Build" part is
      	handled by just calling a formal procedure; the bulk of this
      	(generic) procedure's code has to with deciding where in the tree
      	to insert the newly-constructed subprogram. Replace each later
      	"Build" call (and the following Insert_Action or
      	Compile_Stream_Body_In_Scope call) with a declare block that
      	instantiates and then calls this generic procedure. Delete the
      	now-unused procedure Compile_Stream_Body_In_Scope. A constructed
      	subprogram is entered in the appropriate cache if the
      	corresponding type is untagged; this replaces more complex tests.
      	A new function Interunit_Ref_OK is added to determine whether an
      	attribute reference occuring in one unit can safely refer to a
      	cached subprogram declared in another unit.
      	* exp_ch3.adb (Build_Predefined_Primitive_Bodies): A formal
      	parameter was deleted, so delete the corresponding actual in a
      	call.
      	* exp_put_image.adb (Build_Array_Put_Image_Procedure): Because the
      	procedure being built may be referenced more than once, the
      	generated procedure takes its source position info from the type
      	declaration instead of the (first) attribute reference.
      	(Build_Record_Put_Image_Procedure): Likewise.
      	* exp_put_image.ads (Build_Array_Put_Image_Procedure): Eliminate
      	now-unused Nod parameter.
      	(Build_Record_Put_Image_Procedure): Eliminate now-unused Loc parameter.
      	* sem_ch3.adb (Constrain_Discriminated_Type): For declaring a
      	subtype with a discriminant constraint, ignore privacy if
      	Comes_From_Source is false (as is already done if Is_Instance is
      	true).
      	* sem_res.adb (Resolve): When passed two type entities that have
      	the same underlying base type, Sem_Type.Covers may return False in
      	some cases because of privacy. [This can happen even if
      	Is_Private_Type returns False both for Etype (N) and for Typ;
      	Covers calls Base_Type, which can take a non-private argument and
      	yield a private result.] If Comes_From_Source (N) is False
      	(e.g., for a compiler-generated Put_Image or streaming subprogram), then
      	avoid that scenario by not calling Covers. Covers already has tests for
      	doing this sort of thing (see the calls therein to Full_View_Covers),
      	but the Comes_From_Source test is too coarse to apply there. So instead
      	we handle the problem here at the call site.
      	(Original_Implementation_Base_Type): A new function. Same as
      	Implementation_Base_Type except if the Original_Node attribute of
      	a non-derived type declaration indicates that it once was a derived
      	type declaration. Needed for looking through privacy.
      	(Valid Conversion): Ignore privacy when converting between different views
      	of the same type if Comes_From_Source is False for the conversion.
      	(Valid_Tagged_Conversion): An ancestor-to-descendant conversion is not an
      	illegal downward conversion if there is no type extension involved
      	(because the derivation was from an untagged view of the parent type).
      0b7673ae
    • Steve Baird's avatar
      ada: Better error message for bad general case statements · 33541b88
      Steve Baird authored
      If -gnatX0 is specified, we allow case statements with a selector
      expression of a record or array type, but not of a private type.
      If the selector expression is of a private type then we should generate
      an appropriate error message instead of a bugbox.
      
      gcc/ada/
      
      	* sem_ch5.adb (Analyze_Case_Statement): Emit a message and return
      	early in the case where general case statements are allowed but
      	the selector expression is of a private type. This is done to
      	avoid a bugbox.
      33541b88
    • Justin Squirek's avatar
      ada: Spurious unreferenced warning on selected component · 416e572e
      Justin Squirek authored
      This patch fixes an error in the compiler whereby a selected component on the
      left hand side of an assignment statement may not get marked as referenced -
      leading to spurious unreferenced warnings on such objects.
      
      gcc/ada/
      
      	* sem_util.adb (Set_Referenced_Modified): Use Original_Node to
      	avoid recursive calls on expanded / internal objects such that
      	source nodes get appropriately marked as referenced.
      416e572e
    • Ronan Desplanques's avatar
      ada: Fix overlap warning suppression · f5454123
      Ronan Desplanques authored
      Before this patch, some warnings about overlapping actuals were
      emitted regardless of the Value of
      Warnsw.Warnings_Package.Warn_On_Overlap. This patch fixes this.
      
      gcc/ada/
      
      	* sem_warn.adb (Warn_On_Overlapping_Actuals): Stop ignoring
      	warning suppression settings.
      f5454123
    • Eric Botcazou's avatar
      ada: Follow-up adjustment to earlier fix in Build_Allocate_Deallocate_Proc · 4f3567cf
      Eric Botcazou authored
      The profile of the procedure built for an allocation on the secondary stack
      now includes the alignment parameter, so the parameter can just be forwarded
      in the call to Allocate_Any_Controlled.
      
      gcc/ada/
      
      	* exp_util.adb (Build_Allocate_Deallocate_Proc): Pass the alignment
      	parameter in the inner call for a secondary stack allocation too.
      4f3567cf
    • Javier Miranda's avatar
      ada: Missing support for consistent assertion policy · 3f079f22
      Javier Miranda authored
      Add missing support for RM 10.2/5: the region for a pragma
      Assertion_Policy given as a configuration pragma is the
      declarative region for the entire compilation unit (or units)
      to which it applies.
      
      gcc/ada/
      
      	* sem_ch10.adb (Install_Inherited_Policy_Pragmas): New subprogram.
      	(Remove_Inherited_Policy_Pragmas): New subprogram.
      	(Analyze_Compilation_Unit): Call the new subprograms to
      	install and remove inherited assertion policy pragmas.
      3f079f22
    • Eric Botcazou's avatar
      ada: Fix double finalization for dependent expression of case expression · 59c4d2e5
      Eric Botcazou authored
      The recent fix to Default_Initialize_Object, which has ensured that the
      No_Initialization flag set on an object declaration, for example for the
      temporary created by Expand_N_Case_Expression, is honored in all cases,
      has also uncovered a latent issue in the machinery responsible for the
      finalization of transient objects.
      
      More specifically, the answer returned by the Is_Finalizable_Transient
      predicate for an object of an access type is different when it is left
      uninitialized (true) than when it is initialized to null (false), which
      is incorrect; it must return false in both cases, because the only case
      where an object can be finalized by the machinery through an access value
      is when this value is a reference (N_Reference node) to the object.
      
      This was already more or less the current state of the evolution of the
      predicate, but this now explicitly states it in the code.
      
      The change also sets the No_Initialization flag for the temporary created
      by Expand_N_If_Expression for the sake of consistency.
      
      gcc/ada/
      
      	* exp_ch4.adb (Expand_N_If_Expression): Set No_Initialization on the
      	declaration of the temporary in the by-reference case.
      	* exp_util.adb (Initialized_By_Access): Delete.
      	(Is_Allocated): Likewise.
      	(Initialized_By_Reference): New predicate.
      	(Is_Finalizable_Transient): If the transient object is of an access
      	type, do not return true unless it is initialized by a reference.
      59c4d2e5
    • Steve Baird's avatar
      ada: Error in determining accumulator subtype for a reduction expression · d9f3a1d6
      Steve Baird authored
      There was an earlier bug in determining the accumulator subtype for a
      reduction expression in the case where the reducer subprogram is overloaded.
      The fix for that bug introduced a recently-discovered
      regression. Redo accumulator subtype computation in order to address
      this regression while preserving the benefits of the earlier fix.
      
      gcc/ada/
      
      	* exp_attr.adb:	Move computation of Accum_Typ entirely into the
      	function Build_Stat.
      d9f3a1d6
    • Steve Baird's avatar
      ada: Rtsfind should not trash state used in analyzing instantiations. · b2453909
      Steve Baird authored
      During analysis of an instantiation, Sem_Ch12 manages formal/actual binding
      information in package state (see Sem_Ch12.Generic_Renamings_HTable).
      A call to rtsfind can cause another unit to be loaded and compiled.
      If this occurs during the analysis of an instantiation, and if the loaded
      unit contains a second instantiation, then the Sem_Ch12 state needed for
      analyzing the first instantiation can be trashed during the analysis of the
      second instantiation. Rtsfind calls that can include the analysis of an
      instantiation need to save and restore Sem_Ch12's state.
      
      gcc/ada/
      
      	* sem_ch12.ads: Declare new Instance_Context package, which
      	declares a private type Context with operations Save_And_Reset and
      	Restore.
      	* sem_ch12.adb: Provide body for new Instance_Context package.
      	* rtsfind.adb (Load_RTU): Wrap an Instance_Context Save/Restore
      	call pair around the call to Semantics.
      	* table.ads: Add initial value for Last_Val (because
      	Save_And_Reset expects Last_Val to be initialized).
      b2453909
    • Eric Botcazou's avatar
      ada: Factor out implementation of default initialization for objects · cad2744c
      Eric Botcazou authored
      As written down in a comment, "There is a *huge* amount of code duplication"
      in the implementation of default initializaion for objects in the front-end,
      between the (static) declaration case and the dynamic allocation case.
      
      This change factors out the implementation of the (static) declaration case
      and uses it for the dynamic allocation case, with the following benefits:
      
        1. getting rid of the duplication and reducing total line count,
      
        2. bringing optimizations implemented for the (static) declaration case
           to the dynamic allocation case,
      
        3. performing the missing abort deferral prescribed by RM 9.8(9) in the
           dynamic allocation case.
      
      gcc/ada/
      
      	* exp_aggr.adb (Build_Record_Aggr_Code): Replace reference to
      	Build_Task_Allocate_Block_With_Init_Stmts in comment with reference
      	to Build_Task_Allocate_Block.
      	(Convert_Aggr_In_Allocator): Likewise for the call in the code.
      	* exp_ch6.adb (Make_Build_In_Place_Call_In_Allocator): Likewise.
      	* exp_ch3.ads: Alphabetize clauses.
      	(Build_Default_Initialization): New function declaration.
      	(Build_Default_Simple_Initialization): Likewise.
      	(Build_Initialization_Call): Add Target_Ref parameter with default.
      	* exp_ch3.adb (Build_Default_Initialization): New function extracted
      	from...
      	(Build_Default_Simple_Initialization): Likewise.
      	(Build_Initialization_Call): Add Target_Ref parameter with default.
      	(Expand_N_Object_Declaration): ...here.
      	(Default_Initialize_Object): Call Build_Default_Initialization and
      	Build_Default_Simple_Initialization.
      	* exp_ch4.adb (Expand_Allocator_Expression): Minor comment tweaks.
      	(Expand_N_Allocator): Call Build_Default_Initialization and
      	Build_Default_Simple_Initialization to implement the default
      	initialization of the allocated object.
      	* exp_ch9.ads (Build_Task_Allocate_Block): Delete.
      	(Build_Task_Allocate_Block_With_Init_Stmts): Rename into...
      	(Build_Task_Allocate_Block): ...this.
      	* exp_ch9.adb: Remove clauses for Exp_Tss.
      	(Build_Task_Allocate_Block): Delete.
      	(Build_Task_Allocate_Block_With_Init_Stmts): Rename into...
      	(Build_Task_Allocate_Block): ...this.
      	* exp_util.adb (Build_Allocate_Deallocate_Proc): Remove unnecessary
      	initialization expression, adjust commentary and replace early exit
      	with assertion.
      	* sem_ch4.adb (Analyze_Allocator): In the null-exclusion case, call
      	Apply_Compile_Time_Constraint_Error to insert the raise.
      cad2744c
    • Ronan Desplanques's avatar
      ada: Fix crash with -gnatyB and -gnatdJ · 82177247
      Ronan Desplanques authored
      The crash this patch fixes happened because calling the Errout.Error_Msg
      procedures that don't have an N parameter is not allowed when not
      parsing and -gnatdJ is on. And -gnatyB style checks are not emitted during
      parsing but during semantic analysis.
      
      This commit moves Check_Boolean_Operator from Styleg to Style so it can
      call Errout.Error_Msg with a Node_Id parameter. This change of package
      makes sense because:
      
      1. The compiler is currently the only user of Check_Boolean_Operator.
      2. Other tools don't do semantic analysis, and so cannot possibly
      know when to use Check_Boolean_Operator anyway.
      
      gcc/ada/
      
      	* styleg.ads (Check_Boolean_Operator): Moved ...
      	* style.ads (Check_Boolean_Operator): ... here.
      	* styleg.adb (Check_Boolean_Operator): Moved ...
      	* style.adb (Check_Boolean_Operator): ... here. Also add node
      	parameter to call to Errout.Error_Msg.
      82177247
    • Eric Botcazou's avatar
      ada: Small fix to printing of raise statements · 4dd6f75e
      Eric Botcazou authored
      The Name is optional on these nodes and a superflous space is printed if
      it is not present on them.
      
      gcc/ada/
      
      	* sprint.adb (Sprint_Node_Actual) <N_Raise_Statement>: Be prepared
      	for an empty Name.
      	<N_Raise_When_Statement>: Likewise.
      4dd6f75e
    • Yannick Moy's avatar
      ada: Update of SPARK RM legality rules on ghost code · df48963b
      Yannick Moy authored
      Update checking of ghost code after a small change in SPARK RM
      rules 6.9(15) and 6.9(20), so that the Ghost assertion policy
      that matters when checking the validity of a reference to a ghost entity
      in an assertion expression is the Ghost assertion policy at the point
      of declaration of the entity.
      
      Also fix references to SPARK RM rules in comments, which were off by two
      in many cases after the insertion of rules 13 and 14 regarding generic
      instantiations.
      
      gcc/ada/
      
      	* contracts.adb: Fix references to SPARK RM rules.
      	* freeze.adb: Same.
      	* ghost.adb: Fix references to SPARK RM rules.
      	(Check_Ghost_Context): Update checking of references to
      	ghost entities in assertion expressions.
      	* sem_ch6.adb: Fix references to SPARK RM rules.
      	* sem_prag.adb: Same.
      df48963b
    • Yannick Moy's avatar
      ada: Fix ghost policy in use for generic instantiation · 20dfaae2
      Yannick Moy authored
      The Ghost assertion policy relevant for analyzing a generic instantiation
      is the Ghost policy at the point of instantiation, not the one applicable
      for the generic itself.
      
      gcc/ada/
      
      	* ghost.adb (Mark_And_Set_Ghost_Instantiation): Fix the current
      	Ghost policy for the instantiation.
      20dfaae2
    • Eric Botcazou's avatar
      ada: Small fix to Default_Initialize_Object · 324b3fff
      Eric Botcazou authored
      Unlike what is assumed in other parts of the front-end, some objects created
      with No_Initialization set on their declaration may end up being initialized
      with a default value.
      
      gcc/ada/
      
      	* exp_ch3.adb (Default_Initialize_Object): Return immediately when
      	either Has_Init_Expression or No_Initialization is set on the node.
      	Tidy up the rest of the code accordingly.
      	(Simple_Initialization_OK): Do not test Has_Init_Expression here.
      324b3fff
    • Jeff Law's avatar
      Revert "[PATCH v2 1/3] RISC-V: movmem for RISCV with V extension" · 04ee1f78
      Jeff Law authored
      This reverts commit df15eb15.
      04ee1f78
    • Pan Li's avatar
      RISC-V: Fix format issue for trailing operator [NFC] · b6dc8464
      Pan Li authored
      
      This patch would like to fix below format issue of trailing operator.
      
      === ERROR type #1: trailing operator (4 error(s)) ===
      gcc/config/riscv/riscv-vector-builtins.cc:4641:39:  if ((exts &
      RVV_REQUIRE_ELEN_FP_16) &&
      gcc/config/riscv/riscv-vector-builtins.cc:4651:39:  if ((exts &
      RVV_REQUIRE_ELEN_FP_32) &&
      gcc/config/riscv/riscv-vector-builtins.cc:4661:39:  if ((exts &
      RVV_REQUIRE_ELEN_FP_64) &&
      gcc/config/riscv/riscv-vector-builtins.cc:4670:36:  if ((exts &
      RVV_REQUIRE_ELEN_64) &&
      
      Passed the ./contrib/check_GNU_style.sh for this patch,  and double
      checked there is no other format issue of the original patch.
      
      Committed as format change.
      
      gcc/ChangeLog:
      
      	* config/riscv/riscv-vector-builtins.cc
      	(validate_instance_type_required_extensions): Remove the
      	operator from the trailing and put it to new line.
      
      Signed-off-by: default avatarPan Li <pan2.li@intel.com>
      b6dc8464
    • GCC Administrator's avatar
      Daily bump. · dd594aab
      GCC Administrator authored
      dd594aab
  2. May 13, 2024
    • Jeff Law's avatar
      [to-be-committed,RISC-V] Improve AND with some constants · 158aa1b6
      Jeff Law authored
      If we have an AND with a constant operand and the constant operand
      requires synthesis, then we may be able to generate more efficient code
      than we do now.
      
      Essentially the need for constant synthesis gives us a budget for
      alternative ways to clear bits, which zext.w can do for bits 32..63
      trivially.   So if we clear 32..63  via zext.w, the constant for the
      remaining bits to clear may be simple enough to use with andi or bseti.
      That will save us an instruction.
      
      This has tested in Ventana's CI system as well as my own.  I'll wait for
      the upstream CI tester to report success before committing.
      
      Jeff
      gcc/
      	* config/riscv/bitmanip.md: Add new splitter for AND with
      	a constant that masks off bits 32..63 and needs synthesis.
      
      gcc/testsuite/
      
      	* gcc.target/riscv/zba_zbs_and-1.c: New test.
      158aa1b6
    • Sergei Lewis's avatar
      [PATCH v2 1/3] RISC-V: movmem for RISCV with V extension · df15eb15
      Sergei Lewis authored
      This patchset permits generation of inlined vectorised code for movmem,
      setmem and cmpmem, if and only if the operation size is
      at least one and at most eight vector registers' worth of data.
      
      Further vectorisation rapidly becomes debatable due to code size concerns;
      however, for these simple cases we do have an unambiguous performance win
      without sacrificing too much code size compared to a libc call.
      
      Changes in v2:
      
      * run clang-format over the code in addition to the
        contrib/check_GNU_style.sh that was used for v1
      
      * remove string.h include and refer to __builtin_* memory functions
        in multilib tests
      
      * respect stringop_strategy (don't vectorise if it doesn't include VECTOR)
      
      * use an integer constraint for movmem length parameter
      
      * use TARGET_MAX_LMUL unless riscv-autovec-lmul=dynamic
        to ensure we respect the user's wishes if they request specific lmul
      
      * add new unit tests to check that riscv-autovec-lmul is respected
      
      * PR target/112109 added to changelog for patch 1/3 as requested
      
      Sergei Lewis (3):
        RISC-V: movmem for RISCV with V extension
        RISC-V: setmem for RISCV with V extension
        RISC-V: cmpmem for RISCV with V extension
      
      gcc/ChangeLog
      
      	* config/riscv/riscv.md (movmem<mode>): Use riscv_vector::expand_block_move,
      	if and only if we know the entire operation can be performed using one vector
      	load followed by one vector store
      
      gcc/testsuite/ChangeLog
      
      	PR target/112109
      	* gcc.target/riscv/rvv/base/movmem-1.c: New test
      df15eb15
    • Patrick Palka's avatar
      c++: replace tf_norm with a local flag · 67476ba8
      Patrick Palka authored
      
      The tf_norm flag controlling whether to build diagnostic information
      during constraint normalization doesn't need to be a global tsubst flag,
      and is confusingly named.  This patch replaces it with a boolean flag
      local to normalization.
      
      gcc/cp/ChangeLog:
      
      	* constraint.cc (norm_info::norm_info): Take a bool instead of
      	tsubst_flags_t.
      	(norm_info::generate_diagnostics): Turn this predicate function
      	into a bool data member.
      	(normalize_logical_operation): Adjust after norm_info changes.
      	(normalize_concept_check): Likewise.
      	(normalize_atom): Likewise.
      	(get_normalized_constraints_from_info): Likewise.
      	(normalize_concept_definition): Likewise.
      	(normalize_constraint_expression): Likewise.
      	(normalize_placeholder_type_constraints): Likewise.
      	(satisfy_nondeclaration_constraints): Likewise.
      	* cp-tree.h (enum tsubst_flags): Remove tf_norm.
      
      Reviewed-by: default avatarJason Merrill <jason@redhat.com>
      67476ba8
    • Ken Matsui's avatar
      c++: Avoid using __array_rank as a variable name [PR115061] · 30ff6c55
      Ken Matsui authored
      
      This patch fixes a compilation error when building GCC using Clang.
      Since __array_rank is used as a built-in trait name, use rank instead.
      
      	PR c++/115061
      
      gcc/cp/ChangeLog:
      
      	* semantics.cc (finish_trait_expr): Use rank instead of
      	__array_rank.
      
      Signed-off-by: default avatarKen Matsui <kmatsui@gcc.gnu.org>
      30ff6c55
    • Vladimir N. Makarov's avatar
      [PR115013][LRA]: Modify register starvation recognition · 44e7855e
      Vladimir N. Makarov authored
        My recent patch to recognize reg starvation resulted in few GCC test
      failures.  The following patch fixes this by using more accurate
      starvation calculation and ignoring small reg classes.
      
      gcc/ChangeLog:
      
      	PR rtl-optimization/115013
      	* lra-constraints.cc (process_alt_operands): Update all_used_nregs
      	only for winreg.  Ignore reg starvation for small reg classes.
      44e7855e
    • Pan Li's avatar
      RISC-V: Bugfix ICE for RVV intrinisc vfw on _Float16 scalar · 41b3cf26
      Pan Li authored
      
      For the vfw vx format RVV intrinsic, the scalar type _Float16 also
      requires the zvfh extension.  Unfortunately,  we only check the
      vector tree type and miss the scalar _Float16 type checking.  For
      example:
      
      vfloat32mf2_t test_vfwsub_wf_f32mf2(vfloat32mf2_t vs2, _Float16 rs1, size_t vl)
      {
        return __riscv_vfwsub_wf_f32mf2(vs2, rs1, vl);
      }
      
      It should report some error message like zvfh extension is required
      instead of ICE for unreg insn.
      
      This patch would like to make up such kind of validation for _Float16
      in the RVV intrinsic API.  It will report some error like below when
      there is no zvfh enabled.
      
      error: built-in function '__riscv_vfwsub_wf_f32mf2(vs2,  rs1,  vl)'
        requires the zvfhmin or zvfh ISA extension
      
      Passed the rv64gcv fully regression tests, included c/c++/fortran.
      
      	PR target/114988
      
      gcc/ChangeLog:
      
      	* config/riscv/riscv-vector-builtins.cc
      	(validate_instance_type_required_extensions): New func impl to
      	validate the intrinisc func type ops.
      	(expand_builtin): Validate instance type before expand.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/rvv/base/pr114988-1.c: New test.
      	* gcc.target/riscv/rvv/base/pr114988-2.c: New test.
      
      Signed-off-by: default avatarPan Li <pan2.li@intel.com>
      41b3cf26
    • Patrick Palka's avatar
      c++: nested aggregate/alias CTAD fixes [PR114974, PR114901, PR114903] · 6d31a370
      Patrick Palka authored
      
      During maybe_aggr_guide with a nested class template and paren init,
      like with list init we need to consider the generic template type rather
      than the partially instantiated type since partial instantiations don't
      have (partially instantiated) TYPE_FIELDS.  In turn we need to partially
      substitute PARMs in the paren init case as well.  As a drive-by improvement
      it seems better to use outer_template_args instead of DECL_TI_ARGS during
      this partial substitution so that we lower instead of substitute the
      innermost template parameters, which is generally more robust.
      
      And during alias_ctad_tweaks with a nested class template, even though
      the guides may be already partially instantiated we still need to
      substitute the outermost arguments into its constraints.
      
      	PR c++/114974
      	PR c++/114901
      	PR c++/114903
      
      gcc/cp/ChangeLog:
      
      	* pt.cc (maybe_aggr_guide): Fix obtaining TYPE_FIELDS in
      	the paren init case.  Hoist out partial substitution logic
      	to apply to the paren init case as well.
      	(alias_ctad_tweaks): Substitute outer template arguments into
      	a guide's constraints.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/cpp2a/class-deduction-aggr14.C: New test.
      	* g++.dg/cpp2a/class-deduction-alias20.C: New test.
      	* g++.dg/cpp2a/class-deduction-alias21.C: New test.
      
      Reviewed-by: default avatarJason Merrill <jason@redhat.com>
      6d31a370
    • Joseph Myers's avatar
      Update gcc .po files · 7d894663
      Joseph Myers authored
      	* be.po, da.po, de.po, el.po, es.po, fi.po, fr.po, hr.po, id.po,
      	ja.po, nl.po, ru.po, sr.po, sv.po, tr.po, uk.po, vi.po, zh_CN.po,
      	zh_TW.po: Update.
      7d894663
    • Jeff Law's avatar
      [to-be-committed,RISC-V] Improve single inverted bit extraction - v3 · 0c585c8d
      Jeff Law authored
      So this patch fixes a minor code generation inefficiency that (IIRC) the
      RAU team discovered a while ago in spec.
      
      If we want the inverted value of a single bit we can use bext to extract
      the bit, then seq to invert the value (if viewed as a 0/1 truth value).
      
      The RTL is fairly convoluted, but it's basically a right shift to get
      the bit into position, bitwise-not then masking off all but the low bit.
      So it's a 3->2 combine, hidden by the fact that and-not is a
      define_insn_and_split, so it actually looks like a 2->2 combine.
      
      We've run this through Ventana's internal CI (which includes
      zba_zbb_zbs) and I've run it in my own tester (rv64gc, rv32gcv).  I'll
      wait for the upstream CI to finish with positive results before pushing.
      
      gcc/
      	* config/riscv/bitmanip.md (bextseqzdisi): New patterns.
      
      gcc/testsuite/
      
      	* gcc.target/riscv/zbs-bext-2.c: New test.
      	* gcc.target/riscv/zbs-bext.c: Fix one of the possible expectes sequences.
      0c585c8d
    • Richard Biener's avatar
      PR60276 fix for single-lane SLP · 8a9b159a
      Richard Biener authored
      When enabling single-lane SLP and not splitting groups the fix for
      PR60276 is no longer effective since it for unknown reason exempted
      pure SLP.  The following removes this exemption, making
      gcc.dg/vect/pr60276.c PASS even with --param vect-single-lane-slp=1
      
      	PR tree-optimization/60276
      	* tree-vect-stmts.cc (vectorizable_load): Do not exempt
      	pure_slp grouped loads from the STMT_VINFO_MIN_NEG_DIST
      	restriction.
      8a9b159a
    • Rainer Orth's avatar
      testsuite: c++: Allow for std::printf in g++.dg/modules/stdio-1_a.H [PR98529] · c4af8ebd
      Rainer Orth authored
      g++.dg/modules/stdio-1_a.H currently FAILs on Solaris:
      
      FAIL: g++.dg/modules/stdio-1_a.H -std=c++17  scan-lang-dump module "Depset:0 decl entity:[0-9]* function_decl:'::printf'"
      FAIL: g++.dg/modules/stdio-1_a.H -std=c++2a  scan-lang-dump module "Depset:0 decl entity:[0-9]* function_decl:'::printf'"
      FAIL: g++.dg/modules/stdio-1_a.H -std=c++2b  scan-lang-dump module "Depset:0 decl entity:[0-9]* function_decl:'::printf'"
      
      The problem is that the module file doesn't contain
      
       Depset:0 decl entity:95 function_decl:'::printf'
      
      as expected by the test, but
      
       Depset:0 decl entity:26 function_decl:'::std::printf'
      
      This happens because Solaris <stdio.h> declares printf in namespace std
      as allowed by C++11, Annex D, D.5.
      
      This patch allows for both forms.
      
      Tested on i386-pc-solaris2.11, sparc-sun-solaris2.11, and
      x86_64-pc-linux-gnu.
      
      2024-05-13  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
      
      	gcc/testsuite:
      	PR c++/98529
      	* g++.dg/modules/stdio-1_a.H (scan-lang-dump): Allow for
      	::std::printf.
      c4af8ebd
    • Matthias Kretz's avatar
      libstdc++: Use __builtin_shufflevector for simd split and concat · fb1649f8
      Matthias Kretz authored
      
      Signed-off-by: default avatarMatthias Kretz <m.kretz@gsi.de>
      
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/114958
      	* include/experimental/bits/simd.h (__as_vector): Return scalar
      	simd as one-element vector. Return vector from single-vector
      	fixed_size simd.
      	(__vec_shuffle): New.
      	(__extract_part): Adjust return type signature.
      	(split): Use __extract_part for any split into non-fixed_size
      	simds.
      	(concat): If the return type stores a single vector, use
      	__vec_shuffle (which calls __builtin_shufflevector) to produce
      	the return value.
      	* include/experimental/bits/simd_builtin.h
      	(__shift_elements_right): Removed.
      	(__extract_part): Return single elements directly. Use
      	__vec_shuffle (which calls __builtin_shufflevector) to for all
      	non-trivial cases.
      	* include/experimental/bits/simd_fixed_size.h (__extract_part):
      	Return single elements directly.
      	* testsuite/experimental/simd/pr114958.cc: New test.
      fb1649f8
    • Richard Biener's avatar
      Refactor SLP reduction group discovery · 898d7145
      Richard Biener authored
      The following refactors a bit how we perform SLP reduction group
      discovery possibly making it easier to have multiple reduction
      groups later, esp. with single-lane SLP.
      
      	* tree-vect-slp.cc (vect_analyze_slp_instance): Remove
      	slp_inst_kind_reduc_group handling.
      	(vect_analyze_slp): Add the meat here.
      898d7145
    • Jakub Jelinek's avatar
      tree-ssa-math-opts: Pattern recognize yet another .ADD_OVERFLOW pattern [PR113982] · b6214822
      Jakub Jelinek authored
      We pattern recognize already many different patterns, and closest to the
      requested one also
         yc = (type) y;
         zc = (type) z;
         x = yc + zc;
         w = (typeof_y) x;
         if (x > max)
      where y/z has the same unsigned type and type is a wider unsigned type
      and max is maximum value of the narrower unsigned type.
      But apparently people are creative in writing this in diffent ways,
      this requests
         yc = (type) y;
         zc = (type) z;
         x = yc + zc;
         w = (typeof_y) x;
         if (x >> narrower_type_bits)
      
      The following patch implements that.
      
      2024-05-13  Jakub Jelinek  <jakub@redhat.com>
      
      	PR middle-end/113982
      	* tree-ssa-math-opts.cc (arith_overflow_check_p): Also return 1
      	for RSHIFT_EXPR by precision of maxval if shift result is only
      	used in a cast or comparison against zero.
      	(match_arith_overflow): Handle the RSHIFT_EXPR use case.
      
      	* gcc.dg/pr113982.c: New test.
      b6214822
    • Jakub Jelinek's avatar
Loading