Skip to content
Snippets Groups Projects
  1. Jan 06, 2025
    • Stafford Horne's avatar
      or1k: add .note.GNU-stack section on linux · 803808b4
      Stafford Horne authored
      In the OpenRISC build we get the following warning:
      
          ld: warning: __modsi3_s.o: missing .note.GNU-stack section implies executable stack
          ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
      
      Fix this by adding a .note.GNU-stack to indicate the stack does not need to be
      executable for the lib1funcs.
      
      Note, this is also needed for the upcoming glibc 2.41.
      
      libgcc/
      	* config/or1k/lib1funcs.S: Add .note.GNU-stack section on linux.
      803808b4
    • Fangrui Song's avatar
      Respect -fprofile-prefix-map for getcwd in .gcno files · fa778ba7
      Fangrui Song authored
      so that
      `gcc -c a.cc --coverage -fprofile-prefix-map=$PWD=.`
      does not emit $PWD in the generated a.gcno file.
      
      gcc/ChangeLog:
      
      	PR gcov-profile/96092
      	* coverage.cc (coverage_init): Remap getpwd().
      fa778ba7
    • Jennifer Schmitz's avatar
      SVE intrinsics: Fold svmul by -1 to svneg for unsigned types · f9c99d40
      Jennifer Schmitz authored
      As follow-up to
      https://gcc.gnu.org/pipermail/gcc-patches/2024-October/665472.html
      
      ,
      this patch implements folding of svmul by -1 to svneg for
      unsigned SVE vector types. The key idea is to reuse the existing code that
      does this fold for signed types and feed it as callback to a helper function
      that adds the necessary type conversions.
      
      For example, for the test case
      svuint64_t foo (svuint64_t x, svbool_t pg)
      {
        return svmul_n_u64_x (pg, x, -1);
      }
      
      the following gimple sequence is emitted (-O2 -mcpu=grace):
      svuint64_t foo (svuint64_t x, svbool_t pg)
      {
        svint64_t D.12921;
        svint64_t D.12920;
        svuint64_t D.12919;
      
        D.12920 = VIEW_CONVERT_EXPR<svint64_t>(x);
        D.12921 = svneg_s64_x (pg, D.12920);
        D.12919 = VIEW_CONVERT_EXPR<svuint64_t>(D.12921);
        goto <D.12922>;
        <D.12922>:
        return D.12919;
      }
      
      In general, the new helper gimple_folder::convert_and_fold
      - takes a target type and a function pointer,
      - converts the lhs and all non-boolean vector types to the target type,
      - passes the converted lhs and arguments to the callback,
      - receives the new gimple statement from the callback function,
      - adds the necessary view converts to the gimple sequence,
      - and returns the new call.
      
      Because all arguments are converted to the same target types, the helper
      function is only suitable for folding calls whose arguments are all of
      the same type. If necessary, this could be extended to convert the
      arguments to different types differentially.
      
      The patch was bootstrapped and tested on aarch64-linux-gnu, no regression.
      OK for mainline?
      
      Signed-off-by: default avatarJennifer Schmitz <jschmitz@nvidia.com>
      
      gcc/ChangeLog:
      
      	* config/aarch64/aarch64-sve-builtins-base.cc
      	(svmul_impl::fold): Wrap code for folding to svneg in lambda
      	function and pass to gimple_folder::convert_and_fold to enable
      	the transform for unsigned types.
      	* config/aarch64/aarch64-sve-builtins.cc
      	(gimple_folder::convert_and_fold): New function that converts
      	operands to target type before calling callback function, adding the
      	necessary conversion statements.
      	(gimple_folder::redirect_call): Set fntype of redirected call.
      	(get_vector_type): Move from here to aarch64-sve-builtins.h.
      	* config/aarch64/aarch64-sve-builtins.h
      	(gimple_folder::convert_and_fold): Declare function.
      	(get_vector_type): Move here as inline function.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/aarch64/sve/acle/asm/mul_u8.c: Adjust expected outcome.
      	* gcc.target/aarch64/sve/acle/asm/mul_u16.c: Likewise.
      	* gcc.target/aarch64/sve/acle/asm/mul_u32.c: Likewise.
      	* gcc.target/aarch64/sve/acle/asm/mul_u64.c: New test and adjust
      	expected outcome.
      f9c99d40
    • Eric Botcazou's avatar
      Ada: fix spurious relinking of gnatbind for cross compilers · 144ddb0c
      Eric Botcazou authored
      The problem has been introduced by r15-1881.
      
      gcc/ada
      	PR ada/118247
      	* gcc-interface/Make-lang.in (GNATTOOLS_CROSS_MV): Copy gnatbind
      	instead of moving it.
      144ddb0c
    • Martin Jambor's avatar
      ipa-cp: Make dumping of bit masks representing -1 nicer · 72b27315
      Martin Jambor authored
      Dumps of the lattices representing bit-values and of propagation
      results of bit-values can print a really long hexadecimal value when
      the bit-value represents -1 (all bits set).  This patch simply detect
      that situation and prints the string "-1" in that case, making the
      dumps somewhat nicer.
      
      gcc/ChangeLog:
      
      2025-01-03  Martin Jambor  <mjambor@suse.cz>
      
      	* ipa-cp.cc (ipcp_print_widest_int): New function.
      	(ipcp_store_vr_results): Use it.
      	(ipcp_bits_lattice::print): Likewise.  Fix formatting.
      72b27315
    • Mark Wielaard's avatar
      tree-switch-conversion: don't apply switch size limit on jump tables · 668cad04
      Mark Wielaard authored
      commit 56946c80 ("gimple: Add limit after which slower switchlower
      algs are used [PR117091] [PR117352]") introduced a limit on the number
      of cases of a switch. It also bails out on finding jump tables if the
      switch is too large. This introduces a compile time regression during
      bootstrap. A riscv bootstrap takes hours longer. Particularly
      insn-attrtab.cc will take hours instead of minutes. Fix this by not
      applying the switch size limit on jump tables.
      
      An alternative would be to implement greedy switch clustering for jump
      tables as is done for switch bitmap clustering.
      
      gcc/ChangeLog:
      
      	PR tree-optimization/118032
      	* tree-switch-conversion.cc (jump_table_cluster::find_jump_tables):
      	Remove param_switch_lower_slow_alg_max_cases check.
      668cad04
    • Tamar Christina's avatar
      AArch64: Implement four and eight chunk VLA concats [PR118272] · 830bead4
      Tamar Christina authored
      The following testcase
      
        #pragma GCC target ("+sve")
        extern char __attribute__ ((simd, const)) fn3 (int, short);
        void test_fn3 (float *a, float *b, double *c, int n)
        {
          for (int i = 0; i < n; ++i)
            a[i] = fn3 (b[i], c[i]);
        }
      
      at -Ofast ICEs because my previous patch only added support for combining 2
      partial SVE vectors into a bigger vector.  However There can also 4 and 8
      piece subvectors.
      
      This patch fixes this by implementing the missing expansions.
      
      gcc/ChangeLog:
      
      	PR target/96342
      	PR target/118272
      	* config/aarch64/aarch64-sve.md (vec_init<mode><Vquad>,
      	vec_initvnx16qivnx2qi): New.
      	* config/aarch64/aarch64.cc (aarch64_sve_expand_vector_init_subvector):
      	Rewrite to support any arbitrary combinations.
      	* config/aarch64/iterators.md (SVE_NO2E): Update to use SVE_NO4E
      	(SVE_NO2E, Vquad): New.
      
      gcc/testsuite/ChangeLog:
      
      	PR target/96342
      	PR target/118272
      	* gcc.target/aarch64/vect-simd-clone-3.c: New test.
      830bead4
    • Eric Botcazou's avatar
      ada: Fix small thinko in previous change to two-pass aggregate expansion · f345ae3e
      Eric Botcazou authored
      We need a type tailored to the base index type to compute the length.
      
      gcc/ada/ChangeLog:
      
      	* exp_aggr.adb (Two_Pass_Aggregate_Expansion): Use the base type of
      	the index type to find the type used to compute the length.
      f345ae3e
    • Eric Botcazou's avatar
      ada: Streamline runtime support of finalization collections · ad8242d6
      Eric Botcazou authored
      Finalization collections are declared as (limited) controlled types so that
      they can be naturally attached to a finalization master, but the same result
      can be achieved by means of (limited) finalizable types, which need not be
      tagged and thus avoid dragging the runtime support of tagged types.
      
      gcc/ada/ChangeLog:
      
      	* libgnat/s-finpri.ads: Remove clause for Ada.Finalization.
      	(Finalization_Collection): Change to limited private type with the
      	Finalizable aspect.
      	(Initialize): Remove "overriding" keyword.
      	(Finalize): Likewise.
      	* libgnat/s-finpri.adb (Initialize): Likewise.
      	(Finalize): Likewise.
      ad8242d6
    • Eric Botcazou's avatar
      ada: Fix predicate involving array indexing rejected in generic package · 0d736433
      Eric Botcazou authored
      The indexing is rejected with the message:
      
        error: reference to current instance of type does not denote a type
      
      when it is applied to a prefix which is the current instance of the type
      to which the predicate is applied.
      
      There is already a specific handling of component selection for this case
      present in Find_Selected_Component, so this adds an equivalent specific
      handling of indexing for this case to Analyze_Indexed_Component_Form.
      
      gcc/ada/ChangeLog:
      
      	PR ada/117569
      	* sem_ch4.adb (Analyze_Indexed_Component_Form): Do not rewrite the
      	node as a type conversion if it is the current instance of a type
      	in a generic unit.
      	* sem_ch8.adb (Find_Selected_Component): Restrict the special case
      	of the current instance of a type to a generic unit.
      0d736433
    • Bob Duff's avatar
      ada: Fix incorrect RM reference in s-imagef.adb · 06bc21f4
      Bob Duff authored
      gcc/ada/ChangeLog:
      
      	* libgnat/s-imagef.adb (Set_Image_Integer):
      	Change "RM A.3.10" to be "RM A.10.9".
      06bc21f4
    • Alexandre Oliva's avatar
      ada: Reduce footprint of C++ exception interoperation support · 2d2b018d
      Alexandre Oliva authored
      The initial C++ base-type exception interoperation support change
      brought all of GNAT.CPP* along with raise-gcc, because of
      [__gnat_]Convert_Caught_Object.  Move that private but pragma-exported
      function to GNAT.CPP.Std.Type_Info, so that it can rely on the C++
      virtual/dispatch calls that justified the introduction of the Ada
      wrapper type, to avoid emulating virtual calls in C or bringing in a
      dependency on the C++ compiler and runtime.
      
      Drop the CharPtr package instantiation, that brought a huge amount of
      unnecessary code, and use string and storage primitives instead, using
      the strcmp builtin directly for the C string compares.
      
      Move the conversion to Ada String in Name to the wrapper interface in
      GNAT.CPP.Std, adjusting the private internal type to shave off a few
      more bytes from the only unit that raise-gcc will still need.
      
      Finally, disable heap finalization for Type_Info_Ptr, to avoid
      dragging in all of the finalization code.  Thank to Eric Botcazou for
      the suggestion.
      
      gcc/ada/ChangeLog:
      
      	* libgnat/g-cppexc.adb (Convert_Caught_Object): Move...
      	* libgnat/g-cstyin.adb (Convert_Caught_Object):  ... here.
      	Use object call notation.
      	(strcmp): New.
      	(Char_Arr, CharPtr, Char_Pointer, To_chars_ptr): Drop.  Do not
      	import Interfaces.C.Pointers.
      	(To_Pointer): Convert from System.Address.
      	(Name_Starts_With_Asterisk): Rename local variable.
      	(Name_Past_Asterisk): Rewrite with System.Address and strcmp.
      	Import System.Storage_Elements.
      	(Equals): Use strcmp.
      	(Before): Fix logic error.  Use strcmp.
      	(Name): Move conversion to String...
      	* libgnat/g-cppstd.adb (Name): ... here.  Import
      	Interfaces.C.Strings.
      	* libgnat/g-cppstd.ads (Type_Info_Ptr): Disable heap
      	finalization.
      	* libgnat/g-cstyin.ads (Name): Change return type.
      2d2b018d
    • Claire Dross's avatar
      ada: Support new SPARK aspect Exit_Cases · f49b098e
      Claire Dross authored
      The aspect Exit_Cases allows annotating a subprogram with a list of
      cases specifying, for all input which satisfy a guard, how the
      subprogram is allowed to terminate. For now, it can only be either
      returning normally or propagating an exception. This contract is not
      checked at runtime, it is only meant for static verification in SPARK.
      
      gcc/ada/ChangeLog:
      
      	* aspects.ads: Add aspect Aspect_Exit_Cases.
      	* contracts.adb (Analyze_Entry_Or_Subprogram_Contract): Handle Exit_Cases.
      	(Expand_Subprogram_Contract): Idem.
      	* einfo-utils.adb (Get_Pragma): Allow Pragma_Exit_Cases.
      	* einfo-utils.ads (Get_Pragma): Idem.
      	* exp_prag.adb (Expand_Pragma_Exit_Cases): Ignore the pragma, currently we don't expand it.
      	* exp_prag.ads (Expand_Pragma_Exit_Cases): Idem.
      	* inline.adb (Remove_Aspects_And_Pragmas): Add Exit_Cases to the list.
      	(Remove_Items): Idem.
      	* par-prag.adb (Last_Arg_Is_Reason): Idem.
      	* sem_ch12.adb: Idem.
      	* sem_ch13.adb: Idem.
      	* sem_util.adb: Idem.
      	* sem_util.ads: Idem.
      	* sinfo.ads: Idem.
      	* snames.ads-tmpl: Add names Name_Exit_Cases, Name_Exception_Raised, and Name_Normal_Return
      	as well as pragma Pragma_Exit_Cases.
      	* sem_prag.adb (Analyze_Exit_Cases_In_Decl_Part): Make sure that a
      	pragma or aspect Exit_Cases is well formed.
      	(Analyze_Pragma): Make sure that a pragma or aspect Exit_Cases is at the right place.
      	* sem_prag.ads (Analyze_Exit_Cases_In_Decl_Part): Declaration.
      	* doc/gnat_rm/implementation_defined_pragmas.rst: Document the Exit_Cases pragma.
      	* doc/gnat_rm/implementation_defined_aspects.rst: Document the Exit_Cases aspect.
      	* gnat_rm.texi: Regenerate.
      f49b098e
    • Bob Duff's avatar
      ada: Correct xref of operator expression function body · e3a67dcc
      Bob Duff authored
      For an expression function body that is an operator,
      make sure the xref entry in the ALI file points one past the
      double quote mark. For example, if the name is ">", point
      to the greater-than symbol, not the double quote.
      This was already the case for proper bodies.
      
      gcc/ada/ChangeLog:
      
      	* sem_util.adb (Copy_Subprogram_Spec): When copying
      	an N_Defining_Operator_Symbol, create an
      	N_Defining_Operator_Symbol rather than an N_Defining_Identifier.
      	This will cause Lib.Xref to "skip the initial quote for
      	navigation purposes" (as per comments in Lib.Xref body).
      e3a67dcc
    • Eric Botcazou's avatar
      ada: Small housekeeping work in Exp_Aggr · e4ed78fa
      Eric Botcazou authored
      This moves a few declarations around and tweaks a few comments.
      
      gcc/ada/ChangeLog:
      
      	* exp_aggr.adb (Case_Table_Type): Fix reference in comment.
      	(In_Place_Assign_OK): Move declaration around.
      	(Is_Build_In_Place_Aggregate_Return): Likewise and adjust.
      	(Expand_Array_Aggregate): Streamline for the sake of consistency.
      	(Aggr_Assignment_OK_For_Backend): Remove reference to Gigi/gcc.
      	(Backend_Processing_Possible): Likewise.
      	(Expand_Array_Aggregate): Add comment.
      e4ed78fa
    • Bob Duff's avatar
      ada: cleanup documentation for shift and rotate · 3861ac19
      Bob Duff authored
      Documentation updated.
      
      gcc/ada/ChangeLog:
      
      	* sinfo.ads (Shift_Count_OK): Update comments.
      	(Is_Power_Of_2_For_Shift): Likewise.
      3861ac19
    • Eric Botcazou's avatar
      ada: Fix memory leak when failing to initialize newly allocated memory · 7067e6f6
      Eric Botcazou authored
      This makes the compiler generate cleanup code to deallocate the memory when
      the evaluation of the expression of an allocator raises an exception, if the
      expression is a call to a function that may raise, i.e. is not declared with
      the No_Raise aspect/pragma.  This can also be disabled by means of -gnatdQ.
      
      gcc/ada/ChangeLog:
      
      	* debug.adb (dQ): Document usage.
      	* exp_ch4.ads (Build_Cleanup_For_Allocator): New declaration.
      	* exp_ch4.adb (Build_Cleanup_For_Allocator): New procedure.
      	(Expand_Allocator_Expression): Build a cleanup to deallocate the
      	memory when the evaluation of the expression raises an exception.
      	* exp_ch6.adb (Make_Build_In_Place_Call_In_Allocator): Likewise.
      	* exp_util.adb (Build_Allocate_Deallocate_Proc): Do not generate the
      	detachment if the deallocation is for the cleanup of an allocator.
      	* gen_il-fields.ads (Opt_Field_Enum): Add For_Allocator.
      	* gen_il-gen-gen_nodes.adb (N_Free_Statement): Likewise.
      	* sinfo.ads (For_Allocator): Document usage on N_Free_Statement.
      7067e6f6
    • Eric Botcazou's avatar
      ada: Fix assertion failure on 'Old in post-condition with -gnat2022 · 6be06ae8
      Eric Botcazou authored
      It comes from a small oversight in the updated implementation for Ada 2022.
      
      gcc/ada/ChangeLog:
      
      	PR ada/117956
      	* sem_util.adb (Is_Known_On_Entry): Be prepared for constants coming
      	from a renaming declaration.
      6be06ae8
    • Tonu Naks's avatar
      ada: Declare that the new argument may not be used · 75e126db
      Tonu Naks authored
      gcc/ada/ChangeLog:
      
      	* adaint.c (__gnat_locate_exec_on_path): modify function signature
      75e126db
    • Piotr Trojanek's avatar
      ada: Fix crash on Depends contract with homonym functions · 798873d2
      Piotr Trojanek authored
      When resolving names in flow contracts, we refine the ordinary analysis by
      knowing that an overloaded name must refer to an abstract state and not a
      function. However, when all overloadings refer to function, we shouldn't
      crash, but instead let the error to be diagnosed later.
      
      gcc/ada/ChangeLog:
      
      	* sem_prag.adb (Resolve_State): Continue ordinary processing.
      798873d2
    • Javier Miranda's avatar
      ada: Crash in prefix notation with access to class-wide object · 0216cca1
      Javier Miranda authored
      The compiler crashes analyzing a prefix notation call when its
      prefix is an access to a class-wide object, an actual parameter
      is missing, and the sources are compiled with language extensions
      (-gnatX) and full errors (-gnatf).
      
      gcc/ada/ChangeLog:
      
      	* sem_ch4.adb (Try_Object_Operation): if no candidate interpretation
      	matches the context, redo the same analysis with Report_Error True
      	to report the error.
      0216cca1
    • Eric Botcazou's avatar
      ada: Plug small loophole in previous change · 145314b3
      Eric Botcazou authored
      The initial change only deals with the controlled record case for assignment
      statements, but the controlled array case needs the same treatment.
      
      gcc/ada/ChangeLog:
      
      	* exp_ch5.adb (Expand_Assign_Array): Bail out for controlled
      	components if the RHS is a function call and the assignment has
      	the No_Ctrl_Actions flag set.
      145314b3
    • Viljar Indus's avatar
      ada: Fix printing boolean attributes in the SARIF report · d47596b4
      Viljar Indus authored
      Boolean attributes should have the value true or false
      without any quotes.
      
      gcc/ada/ChangeLog:
      
      	* diagnostics-json_utils.adb: Add new method
      	Write_Boolean_Attribute.
      	* diagnostics-json_utils.ads: Likewise.
      	* diagnostics-sarif_emitter.adb (Print_Invocations): print
      	the executionSuccesful property value without extra quotes.
      d47596b4
    • Viljar Indus's avatar
      ada: Remove level attribute from Rules in the SARIF report · b4c9ba20
      Viljar Indus authored
      A Rule object in the SARIF report does not have a level
      attribute. Result objects are the elements in the SARIF
      reprot that have a level attribute that ultimately determines
      the level of each diagnostic object.
      
      Rules can have a defaultConfiguration attribute which has a level
      attribute that can be overridden in multiple ways. This can make
      the overall report more complex than it needs to be. It is simpler
      to remove the attribute from rules where it does not really matter
      and add it back in under the defaultConfiguration when there is an
      explicit need for it.
      
      gcc/ada/ChangeLog:
      
      	* diagnostics-sarif_emitter.adb (Print_Rule): Remove printing
      	of the level attribute since it does not match the SARIF schema.
      b4c9ba20
    • Piotr Trojanek's avatar
      ada: Avoid null-exclusion checks for Node_Field_Table · 92d50b9d
      Piotr Trojanek authored
      By generating the type of Node_Field_Table with a "not null" qualifier
      we check the null exclusion of its elements only once, at the object
      declaration.
      
      Tiny performance improvement for the debug builds (because in production
      builds checks are disabled anyway); semantics is unaffected.
      
      gcc/ada/ChangeLog:
      
      	* gen_il-gen.adb (Put_Tables): Add "not null" to the generated code.
      	* rtsfind.adb (Cstring_Ptr): Same for table with predefined RE_Id
      	error messages.
      	* impunit.adb (Aunit_Record): Same for array of alternative unit names.
      92d50b9d
    • Piotr Trojanek's avatar
      ada: Ada version used to compile runtime is constant · a172d6cf
      Piotr Trojanek authored
      Code cleanup.
      
      gcc/ada/ChangeLog:
      
      	* opt.ads (Ada_Version_Runtime): Now a constant, since it cannot
      	and should never be modified.
      a172d6cf
    • Bob Duff's avatar
      ada: null procedure cannot be used as compilation unit · 2a38c233
      Bob Duff authored
      This patch gives a syntax error if a null procedure is used as
      a compilation unit. The error was already given during semantic
      analysis; now it is given in the parser, which is more convenient
      for other tools like gprbuild, because the -gnats switch now
      gives the error.
      
      Note that the old message "null procedure cannot be declared at library
      level" was wrong; "library level" is not the same thing as "is a library
      unit".
      
      gcc/ada/ChangeLog:
      
      	* par-ch10.adb (P_Compilation_Unit): Give an error for "is null".
      	* sem_ch10.adb (Analyze_Subunit): Remove check for "is null"
      	as a subunit.
      	* sem_ch6.adb (Analyze_Subprogram_Declaration):
      	Remove check for "is null" as a library unit.
      2a38c233
    • Javier Miranda's avatar
      ada: Cleanup preanalysis of static expressions · fd52383f
      Javier Miranda authored
      Complete previous patch; required to avoid regressions in GNATProve.
      
      gcc/ada/ChangeLog:
      
      	* sem_ch6.adb (Analyze_Expression_Function): Set the parent of
      	the new node to be the parent of the original to get the proper
      	context, which is needed for complete error reporting and for
      	semantic analysis. Patch suggested by Eric Botcazou.
      fd52383f
    • Alexandre Oliva's avatar
      ada: C++ exception hierarchies: adjust for gnat-llvm · b8a94b0b
      Alexandre Oliva authored
      
      gnat-llvm doesn't support C++ imports, so arrange for the GNAT.CPP*
      units to be omitted from gnat-llvm builds.
      
      Drop G++ exception interoperability support from raise-gcc.c, so as to
      not require the GNAT.CPP* units that define some of the required
      symbols.
      
      Co-Authored-By: default avatarOlivier Hainque <hainque@adacore.com>
      
      gcc/ada/ChangeLog:
      
      	* Makefile.rtl (LLVM_BUILD): Define based on LLVM_CONFIG.
      	(GNATRTL_NONTASKING_OBJS): Make g-cpp, g-cppstd, and g-cstyin
      	conditional on -gcc or -arm EH, and on no LLVM_BUILD.
      	* raise-gcc.c (GXX_EH_INTEROP): Define as 0 on gnat-llvm or
      	CERT, and 1 otherwise.
      	(__gnat_get_cxx_dependent_exception) Omit on !GXX_EH_INTEROP.
      	(__gnat_maybe_get_cxx_dependent_exception): Likewise.
      	(__gnat_get_cxx_exception_type_info): Likewise.
      	(__gnat_obtain_caught_object): Likewise.
      	(is_handled_by): Omit eid parameter and G++ interop on
      	!GXX_EH_INTEROP.  Adjust callers.
      b8a94b0b
    • Eric Botcazou's avatar
      ada: Elide copy for calls as default values of nonlimited by-reference components · 0fe74112
      Eric Botcazou authored
      This prevents a temporary from being created on the primary stack to hold
      the result of the function calls before it is copied to the object being
      elaborated in the nonlimited by-reference case.
      
      That's already not done in the nonlimited non-by-reference case and there is
      no reason to do it in the former case either.  The main issue are the calls
      to Remove_Side_Effects in Expand_Ctrl_Function_Call (controlled case only)
      and in Expand_N_Assignment_Statement, which serve various purposes including
      very technical ones beside removing side effects.
      
      The change is therefore very conservative and only removes the copy in the
      case of a naked function call for the time being.
      
      gcc/ada/ChangeLog:
      
      	* einfo.ads (Returns_By_Ref): Fix description.
      	* exp_ch3.adb (Build_Record_Init_Proc.Build_Assignment): Do not
      	adjust the component manually (if need be), set No_Finalize_Actions
      	instead of No_Ctrl_Actions for this purpose.  Do not adjust when
      	the expression is a naked function call.
      	* exp_ch5.adb (Make_Tag_Ctrl_Assignment): Document the quirks of
      	the function.  Assert that the LHS of the assignment does not have
      	side effects and replace calls to Duplicate_Subexpr_No_Checks with
      	calls to New_Copy_Tree.  Rename local variable Asn to New_N.
      	(Expand_N_Assignment_Statement): In the tagged or controlled record
      	case, do remove side effects from both operands on entry.  Remove
      	them in the controlled record case, except if the RHS is a function
      	call and the assignment has the No_Ctrl_Actions flag set.
      	* exp_ch6.adb (Expand_Ctrl_Function_Call): Bail out when the parent
      	node is an assignment statement with the No_Ctrl_Actions flag set.
      	* sem_util.adb (Statically_Different): Return True for a function
      	call that does not return its result by reference.
      	* sinfo.ads (No_Ctrl_Actions): Adjust description and add a note for
      	the code generator.
      	(No_Finalize_Actions): Likewise.
      0fe74112
    • Bob Duff's avatar
      ada: Follow-on to Use inheritance in Gen_IL · 42c115ee
      Bob Duff authored
      Fix too-long line.
      
      gcc/ada/ChangeLog:
      
      	* gen_il-gen.adb: Fix too-long line.
      42c115ee
    • Tonu Naks's avatar
      ada: Silence unused parameter warning on linux · 4b0a5e93
      Tonu Naks authored
      In __gnat_locate_exec_on_path (char *exec_name, int current_dir_on_windows)
      the recently added second parameter is for windows only. On non-windows
      platforms its usage is removed by the preprocessor and the compiler
      reports unused parameter.
      
      gcc/ada/ChangeLog:
      
      	* adaint.c: void parameter on non-windows platforms
      4b0a5e93
    • Bob Duff's avatar
      ada: Use inheritance in Gen_IL · 93eb5676
      Bob Duff authored
      In Gen_IL, detect cases where fields could be inherited from
      an abstract type instead of being defined in each of two or more
      descendants of that type. Raise Illegal when that is the case,
      except in specific cases called out as exceptions to this rule.
      
      For every such case, either update the types declared in
      Gen_Nodes and Gen_Entities to use inheritance, or add the case
      to the list of exceptions where we do not want to use inheritance.
      
      gcc/ada/ChangeLog:
      
      	* gen_il-internals.ads: Split Fields field into two fields
      	Imm_Fields and Fields.
      	* gen_il-gen.adb: Modify the field-inheritance
      	algorithm to inherit at each level of the type hierarchy,
      	rather than just inheriting into concrete types.
      	For example, if C is a concrete type derived from B,
      	which is in turn derived from A, we now set the Fields
      	of B to include those of A. (We had always set the Fields
      	of C to include those of A and B, and we still do that.)
      	(Compute_Fields_For_One_Type): Detect cases where a given
      	field is declared for all descendants of a given abstract
      	type, in which case we should consider declaring it in
      	the abstract type, and inheriting it in those descendants.
      	(Exception_To_Inheritance_Rule): These are the cases where
      	we could inherit, but we don't want to.
      	* gen_il-gen-gen_nodes.adb: Move fields up the type hierarchy,
      	so they are inherited instead of being defined separately.
      	* gen_il-gen-gen_entities.adb: Likewise.
      93eb5676
    • Viljar Indus's avatar
      ada: Fix incorrect incomplete type error · 950df609
      Viljar Indus authored
      In Ada 2005 even if the formal is using a tagged limited type
      then the type should not be considered incomplete.
      
      gcc/ada/ChangeLog:
      
      	* sem_ch6.adb (Analyze_Subprogram_Body_Helper):
      	Exchange_Limited_Views also in Ada 2005.
      950df609
    • Eric Botcazou's avatar
      ada: Fix finalization issue introduced by previous change · 82e9c7c9
      Eric Botcazou authored
      When detecting calls to subprograms specified for aspects of a type, the
      entity denoted by the aspects must go through Ultimate_Alias, since that
      of the name of the calls did the same.
      
      gcc/ada/ChangeLog:
      
      	* exp_ch6.adb (Expand_Call_Helper): Call Ultimate_Alias for the
      	detection of calls to subprograms specified for Constant_Indexing.
      	* exp_util.adb (Is_Indexed_Container): Likewise.
      	(Is_Iterated_Container): Likewise for Default_Iterator.
      82e9c7c9
    • Ronan Desplanques's avatar
      ada: Fix markup in user's guide · 11d0b5aa
      Ronan Desplanques authored
      gcc/ada/ChangeLog:
      
      	* doc/gnat_ugn/building_executable_programs_with_gnat.rst: Fix markup.
      	* gnat_ugn.texi: Regenerate.
      11d0b5aa
    • Piotr Trojanek's avatar
      ada: Remove workaround for RM_Size being unable to represent unknown size · 411008f2
      Piotr Trojanek authored
      When validating instances of Ada.Unchecked_Conversion, we explicitly detected
      null arrays, because a size of 0 was used to indicate both an unknown size and
      an actual size of 0. This limitation has been lifted, so we can remove
      detection of null arrays.
      
      Code cleanup; behavior is unaffected.
      
      gcc/ada/ChangeLog:
      
      	* sem_ch13.adb (Validate_Unchecked_Conversions): Remove detection of
      	null arrays; remove tests for sizes being present, which are redundant
      	after calling Known_Static_RM_Size.
      411008f2
    • Jakub Jelinek's avatar
      tree-ssa-dce: Punt on allocations with too large constant sizes [PR118224] · 804e9d55
      Jakub Jelinek authored
      As suggested by Richi in the PR, the following patch will fail to DCE
      allocation calls if they have constant size which is too large (over
      PTRDIFF_MAX), or for the case of calloc, if either of the arguments
      is too large (in that case in theory the call could succeed if the other
      argument is variable zero but who cares) or if both are constant and
      their product overflows or is above PTRDIFF_MAX.
      
      This will make some pedantic conformance tests happy, though if one
      hides the size one will still need to use -fno-malloc-dce or obfuscate even
      the malloc etc. uses.  If the size is constant and too large, it isn't worth
      trying to optimize it.
      
      2025-01-06  Jakub Jelinek  <jakub@redhat.com>
      
      	PR tree-optimization/118224
      	* tree-ssa-dce.cc (is_removable_allocation_p): Don't return true
      	for allocations with constant size argument larger than PTRDIFF_MAX
      	or for calloc with one of the arguments constant larger than
      	PTRDIFF_MAX or their product known constant above PTRDIFF_MAX.
      	Fix comment typos, furhter -> further and then -> than.
      	* lto-section-in.cc (lto_free_function_in_decl_state_for_node):
      	Fix comment typo, furhter -> further.
      
      	* gcc.dg/pr118224.c: New test.
      	* c-c++-common/ubsan/vla-1.c (bar): Use noipa attribute instead
      	of noinline, noclone.
      804e9d55
    • Eric Botcazou's avatar
      Ada: fix documentation of pragma Unimplemented_Unit · 90b6d3bc
      Eric Botcazou authored
      gcc/ada
      	PR ada/117936
      	* doc/gnat_rm/implementation_defined_pragmas.rst
      	(Unimplemented_Unit): Adjust the description of the error message.
      	* gnat_rm.texi: Regenerate.
      90b6d3bc
    • Kito Cheng's avatar
      RISC-V: Move fortran testcase to gfortran.target · a35b89a2
      Kito Cheng authored
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/rvv/fortran/pr111395.f90: Move this file to...
      	* gfortran.target/riscv/rvv/pr111395.f90: ...here.
      	* gcc.target/riscv/rvv/fortran/pr111566.f90: Move this file to...
      	* gfortran.target/riscv/rvv/pr111566.f90: ...here.
      	* gcc.target/riscv/rvv/rvv-fortran.exp: Move this file to...
      	* gfortran.target/riscv/rvv/rvv.exp: ...here.
      a35b89a2
Loading