aboutsummaryrefslogtreecommitdiff
path: root/gcc
AgeCommit message (Collapse)AuthorFilesLines
2022-05-20testsuite:: Fix pr39986.c testcase for AArch64Christophe Lyon1-11/+11
The testcase in c-c++-common/dfp/pr39986.c detects if DFP constants are correctly emitted in the assembly. However, AArch64 uses .word instead of the expected .long directive. With this patch, we now accept both. 2022-03-31 Christophe Lyon <christophe.lyon@arm.com> gcc/testsuite/ * c-c++-common/dfp/pr39986.c: Accept .word directive.
2022-05-20aarch64: Add backend support for DFPChristophe Lyon3-51/+89
This patch updates the aarch64 backend as needed to support DFP modes (SD, DD and TD). Changes v1->v2: * Drop support for DFP modes in aarch64_gen_{load||store}[wb]_pair as these are only used in prologue/epilogue where DFP modes are not used. Drop the changes to the corresponding patterns in aarch64.md, and useless GPF_PAIR iterator. * In aarch64_reinterpret_float_as_int, handle DDmode the same way as DFmode (needed in case the representation of the floating-point value can be loaded using mov/movk. * In aarch64_float_const_zero_rtx_p, reject constants with DFP mode: when X is zero, the callers want to emit either '0' or 'zr' depending on the context, which is not the way 0.0 is represented in DFP mode (in particular fmov d0, #0 is not right for DFP). * In aarch64_legitimate_constant_p, accept DFP 2022-03-31 Christophe Lyon <christophe.lyon@arm.com> gcc/ * config/aarch64/aarch64.cc (aarch64_split_128bit_move): Handle DFP modes. (aarch64_mode_valid_for_sched_fusion_p): Likewise. (aarch64_classify_address): Likewise. (aarch64_legitimize_address_displacement): Likewise. (aarch64_reinterpret_float_as_int): Likewise. (aarch64_float_const_zero_rtx_p): Likewise. (aarch64_can_const_movi_rtx_p): Likewise. (aarch64_anchor_offset): Likewise. (aarch64_secondary_reload): Likewise. (aarch64_rtx_costs): Likewise. (aarch64_legitimate_constant_p): Likewise. (aarch64_gimplify_va_arg_expr): Likewise. (aapcs_vfp_sub_candidate): Likewise. (aarch64_vfp_is_call_or_return_candidate): Likewise. (aarch64_output_scalar_simd_mov_immediate): Likewise. (aarch64_gen_adjusted_ldpstp): Likewise. (aarch64_scalar_mode_supported_p): Accept DFP modes if enabled. * config/aarch64/aarch64.md (movsf_aarch64): Use SFD iterator and rename into mov<mode>_aarch64. (movdf_aarch64): Use DFD iterator and rename into mov<mode>_aarch64. (movtf_aarch64): Use TFD iterator and rename into mov<mode>_aarch64. (split pattern for move TF mode): Use TFD iterator. * config/aarch64/iterators.md (GPF_TF_F16_MOV): Add DFP modes. (SFD, DFD, TFD): New iterators. (GPF_TF): Add DFP modes. (TX, DX, DX2): Likewise.
2022-05-20aarch64: Enable DFP (Decimal Floating-point) (BID format)Christophe Lyon1-1/+2
This patch enables DFP support on aarch64, by updating config/dfp.m4 and regenerating the involved configure scripts. We enable the BID format. 2022-03-31 Christophe Lyon <christophe.lyon@arm.com> config/ * dfp.m4: Add aarch64 support. gcc/ * configure: Regenerate. libdecnumber/ * configure: Regenerate. libgcc/ * configure: Regenerate.
2022-05-20Daily bump.GCC Administrator4-1/+398
2022-05-19libstdc++: Ensure pmr aliases work without <memory_resource>Jonathan Wakely1-1/+1
Currently the alias templates for std::pmr::vector, std::pmr::string etc. are defined using a forward declaration for polymorphic_allocator. This means you can't actually use the alias templates unless you also include <memory_resource>. The rationale for that is that it's a fairly large header, and most users don't need it. This isn't uncontroversial though, and LWG 3681 questions whether it's even conforming. This change adds a new <bits/memory_resource.h> header with the minimum needed to use polymorphic_allocator and the std::pmr container aliases. Including <memory_resource> is still necessary to use the program-wide resource objects, or the pool resources or monotonic buffer resource. libstdc++-v3/ChangeLog: * include/Makefile.am: Add new header. * include/Makefile.in: Regenerate. * include/bits/memory_resource.h: New file. * include/std/deque: Include <bits/memory_resource.h>. * include/std/forward_list: Likewise. * include/std/list: Likewise. * include/std/map: Likewise. * include/std/memory_resource (pmr::memory_resource): Move to new <bits/memory_resource.h> header. (pmr::polymorphic_allocator): Likewise. * include/std/regex: Likewise. * include/std/set: Likewise. * include/std/stacktrace: Likewise. * include/std/string: Likewise. * include/std/unordered_map: Likewise. * include/std/unordered_set: Likewise. * include/std/vector: Likewise. * testsuite/21_strings/basic_string/types/pmr_typedefs.cc: Remove <memory_resource> header and check construction. * testsuite/23_containers/deque/types/pmr_typedefs.cc: Likewise. * testsuite/23_containers/forward_list/pmr_typedefs.cc: Likewise. * testsuite/23_containers/list/pmr_typedefs.cc: Likewise. * testsuite/23_containers/map/pmr_typedefs.cc: Likewise. * testsuite/23_containers/multimap/pmr_typedefs.cc: Likewise. * testsuite/23_containers/multiset/pmr_typedefs.cc: Likewise. * testsuite/23_containers/set/pmr_typedefs.cc: Likewise. * testsuite/23_containers/unordered_map/pmr_typedefs.cc: Likewise. * testsuite/23_containers/unordered_multimap/pmr_typedefs.cc: Likewise. * testsuite/23_containers/unordered_multiset/pmr_typedefs.cc: Likewise. * testsuite/23_containers/unordered_set/pmr_typedefs.cc: Likewise. * testsuite/23_containers/vector/pmr_typedefs.cc: Likewise. * testsuite/28_regex/match_results/pmr_typedefs.cc: Likewise. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/variadic-tuple.C: Qualify function to avoid ADL finding std::make_tuple.
2022-05-19PR middle-end/98865: Expand X*Y as X&-Y when Y is [0,1].Roger Sayle2-0/+86
The patch is a revised solution for PR middle-end/98865 incorporating the feedback/suggestions from Richard Biener's review here: https://gcc.gnu.org/pipermail/gcc-patches/2022-May/593928.html Most significantly, this patch now performs the transformation/optimization during RTL expansion, where the target's rtx_costs can be used to determine whether the original multiplication (that may potentially be implemented by a shift or lea) is cheaper than a negation and a bit-wise and. Previously the expression (x>>63)*y would be compiled with -O2 as shrq $63, %rdi movq %rdi, %rax imulq %rsi, %rax but with this patch now produces: sarq $63, %rdi movq %rdi, %rax andq %rsi, %rax Likewise the expression (x>>63)*135 [that appears in a hot-spot of the Botan AES-128 benchmark] was previously: shrq $63, %rdi leaq (%rdi,%rdi,8), %rdx movq %rdx, %rax salq $4, %rax subq %rdx, %rax now becomes: movq %rdi, %rax sarq $63, %rax andl $135, %eax 2022-05-19 Roger Sayle <roger@nextmovesoftware.com> gcc/ChangeLog PR middle-end/98865 * expr.cc (expand_expr_real_2) [MULT_EXPR]: Expand X*Y as X&Y when both X and Y are [0, 1], X*Y as X&-Y when Y is [0,1] and likewise X*Y as -X&Y when X is [0,1] using tree_nonzero_bits. gcc/testsuite/ChangeLog PR middle-end/98865 * gcc.target/i386/pr98865.c: New test case.
2022-05-19[PATCH, rs6000] Remove the (no longer used) BTC defines.Will Schmidt2-51/+4
These defines are no longer used once the rs6000 built-in reworks were completed. Time to remove them. There was a reference to RS6000_BTC_SPECIAL in a TODO comment in rs6000-builtins.def. That comment remains, but I have updated the comment to refer to "SPECIAL" processing, instead of having it refer directly to the _BTC_SPECIAL macro. 2022-05-18 Will Schmidt <will_schmidt@vnet.ibm.com> gcc/ * config/rs6000/rs6000-builtins.def: Rephrase to remove RS6000_BTC_SPECIAL from comment. * config/rs6000/rs6000.h (RS6000_BTC_UNARY, RS6000_BTC_BINARY, RS6000_BTC_TERNARY, RS6000_BTC_QUATERNARY, RS6000_BTC_QUINARY, RS6000_BTC_SENARY, RS6000_BTC_OPND_MASK, RS6000_BTC_SPECIAL, RS6000_BTC_PREDICATE, RS6000_BTC_ABS, RS6000_BTC_DST, RS6000_BTC_TYPE_MASK, RS6000_BTC_MISC, RS6000_BTC_CONST, RS6000_BTC_PURE, RS6000_BTC_FP, RS6000_BTC_QUAD, RS6000_BTC_PAIR, RS6000_BTC_QUADPAIR, RS6000_BTC_ATTR_MASK, RS6000_BTC_SPR, RS6000_BTC_VOID, RS6000_BTC_CR, RS6000_BTC_OVERLOADED, RS6000_BTC_GIMPLE, RS6000_BTC_MISC_MASK, RS6000_BTC_MEM, RS6000_BTC_SAT, RS6000_BTM_ALWAYS): Delete.
2022-05-19Fix OMP CAS expansion with separate conditionRichard Biener1-5/+6
When forcing the condition to be split out from COND_EXPRs I see a runtime failure of libgomp.fortran/atomic-19.f90 which can be reduced to !$omp atomic update, compare, capture if (x == 69_2 - r) x = 6_8 v = x being miscompiled, the difference being - _13 = .ATOMIC_COMPARE_EXCHANGE (_9, _10, _11, 4, 0, 0); - _14 = IMAGPART_EXPR <_13>; - _15 = REALPART_EXPR <_13>; - _16 = _14 != 0 ? _11 : _15; - _2 = (integer(kind=4)) _16; - v_17 = _2; + _14 = .ATOMIC_COMPARE_EXCHANGE (_10, _11, _12, 4, 0, 0); + _15 = IMAGPART_EXPR <_14>; + _16 = REALPART_EXPR <_14>; + _2 = (logical(kind=1)) _15; + _3 = (integer(kind=4)) _16; + v_17 = _3; where one can see a missing COND_EXPR. It seems to be a latent issue to me given the code can be exercised, it just maybe misses a 'need_new' testcase combined with 'cond_stmt'. Appearantly the if (cond_stmt) code is just to avoid creating a temporary (and possibly to preserve the condition compute if used elsewhere since the original stmt is going to be deleted). The following makes the failure go away for me in my patched tree and it also survives libgomp and gomp testing in an unpatched tree. 2022-05-13 Richard Biener <rguenther@suse.de> * omp-expand.cc (expand_omp_atomic_cas): Do not short-cut computation of the new value.
2022-05-19Remove get_or_alloc_expression_idRichard Biener1-15/+3
This function is no longer needed. 2022-05-19 Richard Biener <rguenther@suse.de> * tree-ssa-pre.cc (get_or_alloc_expression_id): Remove. (add_to_value): Use get_expression_id. (bitmap_insert_into_set): Likewise. (bitmap_value_insert_into_set): Likewise.
2022-05-19[Ada] Avoid copy operation for returns involving function callsEric Botcazou2-0/+53
gcc/ada/ * gcc-interface/decl.cc (gnat_to_gnu_entity) <E_Constant>: Deal with a constant related to a return in a function specially. * gcc-interface/trans.cc (Call_to_gnu): Use return slot optimization if the target is a return object. (gnat_to_gnu) <N_Object_Declaration>: Deal with a constant related to a return in a function specially.
2022-05-19[Ada] Do not give warnings for compiler-generated entities by defaultEric Botcazou1-2/+5
The rationale is that these entities are almost always the result of expansion activities in the front-end, over which the user has very limited control. These warnings can be restored by means of -gnatD. gcc/ada/ * gcc-interface/utils.cc (gnat_pushdecl): Also set TREE_NO_WARNING on the decl if Comes_From_Source is false for the associated node.
2022-05-19[Ada] Small housekeeping work in gnat_gimplify_exprEric Botcazou1-71/+60
This alphabetizes the large switch statement, removes a useless nested switch statement, an artificial fall through and adds a default return. No functional changes. gcc/ada/ * gcc-interface/trans.cc (gnat_gimplify_expr): Tidy up.
2022-05-19[Ada] Add support for "simd" function attributeEric Botcazou2-1/+55
gcc/ada/ * gcc-interface/decl.cc (gnat_to_gnu_entity) <E_Function>: Also call process_attributes for built-in functions. (prepend_one_attribute_pragma): Deal with "simd" attribute. * gcc-interface/utils.cc (handle_simd_attribute): New function. (gnat_internal_attribute_table): Add entry for "simd" attribute.
2022-05-19[Ada] Fix internal error on unchecked union with component clauses (2)Eric Botcazou1-6/+23
The issue arises when the unchecked union contains both a fixed part and a variant part, and is subject to a full representation clause covering all the components in all the variants, when the component clauses do not align the variant boundaries with byte boundaries consistently. gcc/ada/ * gcc-interface/decl.cc (components_to_record): Use NULL recursively as P_GNU_REP_LIST for the innermost variant level in the unchecked union case with a fixed part.
2022-05-19[Ada] Do not set Current_Error_Node to a node without locationEric Botcazou1-1/+2
The message "No source file position information available" is displayed in the bugbox when Current_Error_Node has no location, which is useless. gcc/ada/ * gcc-interface/trans.cc (gnat_to_gnu): Do not set Current_Error_Node to a node without location.
2022-05-19[Ada] Fix internal error on semi-circular record typesEric Botcazou1-8/+11
The front-end properly computes a linear elaboration order for them, but there was a loophole in the handling of the delayed case. gcc/ada/ * gcc-interface/decl.cc (gnat_to_gnu_entity) <E_Access_Subtype>: And skip the elaboration of the designated subtype when that of its base type has been delayed.
2022-05-19[Ada] Fix for internal error on semi-circular record aggregateEric Botcazou1-2/+12
This creates a couple of record subtypes pointing to each other through access subtypes, and we break the circularity at the latter subtypes. gcc/ada/ * gcc-interface/decl.cc (gnat_to_gnu_entity) <E_Record_Subtype>: If it is a special subtype designated by an access subtype, then defer the completion of incomplete types.
2022-05-19[Ada] Adjust copyright lineEric Botcazou4-4/+4
gcc/ada/ * gcc-interface/ada-tree.h, gcc-interface/ada.h, gcc-interface/gadaint.h, gcc-interface/targtyps.cc: Adjust copyright line.
2022-05-19[Ada] Preserve unchecked conversion of string constantEric Botcazou1-0/+7
This makes it possible to pass the result to a C function directly. gcc/ada/ * gcc-interface/utils.cc (unchecked_convert): Do not fold a string constant if the target type is pointer to character.
2022-05-19[Ada] Remove redundant marking of illegal pragma with error postedPiotr Trojanek1-1/+0
We flag illegal pragma Elaborate with a call to Error_Msg on the pragma argument, which in turn calls Set_Error_Posted on the enclosing statement, i.e. on the pragma itself. The explicit call to Set_Error_Posted on the pragma itself was redundant. Cleanup related to handling of illegal code when detecting uninitialized scalar objects. gcc/ada/ * sem_prag.adb (Analyze_Pragma): Remove redundant call to Set_Error_Posted.
2022-05-19[Ada] Fix continuation message without a prior errorPiotr Trojanek1-0/+2
When resolution of an expanded name fails, we call routine Error_Missing_With_Of_Known_Unit which emits an error continuation message (i.e. an error string starting with \\). However, for error continuations to work properly there must be some prior error, because continuation itself doesn't set flags like Serious_Errors_Detected. Without these flags the problematic statement is not marked with Error_Posted, which in turn is needed to prevent cascaded errors. In particular, when unresolved procedure call uses a direct name or an extended name with an unknown prefix, e.g.: Unknown (1, 2, 3); Unknown.Call (1, 2, 3); then the N_Procedure_Call statements are marked with Error_Posted. But when a call uses an extended name with a known prefix we failed to flag the N_Procedure_Call with Error_Posted. Found while improving the robustness of a feature that detects uninitialized scalar objects. gcc/ada/ * sem_ch8.adb (Find_Expanded_Name): Emit a main error message before adding a continuation with the call to Error_Missing_With_Of_Known_Unit.
2022-05-19[Ada] Mark Requires_Transient_Scope as InlineEric Botcazou1-0/+1
The predicate is now a simple disjunction of two other predicates. gcc/ada/ * sem_util.ads (Requires_Transient_Scope): Add pragma Inline.
2022-05-19[Ada] Avoid internal compiler error for illegal Predicate_Failure aspect specSteve Baird1-1/+4
gcc/ada/ * sem_ch13.adb (Build_Predicate_Functions): If a semantic error has been detected then ignore Predicate_Failure aspect specifications in the same way as is done for CodePeer and SPARK. This avoids an internal compiler error if Ancestor_Predicate_Function_Called is True but Result_Expr is not an N_And_Then node (and is therefore unsuitable as an argument in a call to Left_Opnd).
2022-05-19[Ada] Fix spurious violations of No_Secondary_Stack restrictionEric Botcazou3-6/+9
Now that finalization and return on the secondary stack are decoupled, the transient scopes created because of the former need not necessarily manage the secondary stack and trigger a violation of the associated restriction. gcc/ada/ * exp_ch7.adb (Wrap_Transient_Declaration): Propagate Uses_Sec_Stack to enclosing function if it does not return on the secondary stack. * exp_ch6.adb (Expand_Call_Helper): Call Establish_Transient_Scope with Manage_Sec_Stack set to True only when necessary. * sem_res.adb (Resolve_Call): Likewise. (Resolve_Entry_Call): Likewise.
2022-05-19[Ada] Ignore Predicate_Failure in CodePeer modeDaniel Mercier1-0/+1
gcc/ada/ * sem_ch13.adb (Build_Predicate_Function): Ignore predicate failure in CodePeer mode.
2022-05-19[Ada] Fix compilation of raise-gcc.c with -DSTANDALONE under windowsArnaud Charlet1-1/+1
This is needed in particular by GNAT LLVM builds. gcc/ada/ * raise-gcc.c: Fix compilation with -DSTANDALONE under windows.
2022-05-19[Ada] Preserve and reuse original type in Narrow_Large_OperationEric Botcazou1-2/+2
Instead of using that of Original_Node (N) after rewriting, which does not work if N had previously been rewritten. gcc/ada/ * exp_ch4.adb (Narrow_Large_Operation): Preserve and reuse Etype.
2022-05-19[Ada] Wrong interface dynamic dispatch via access parameterJavier Miranda1-52/+84
When the prefix of an Access attribute is an explicit dereference of an access parameter (or a renaming of such a dereference, or a subcomponent of such a dereference), the context is a general access type to a class-wide interface type, and an accessibility check must be generated, the frontend silently skips generating an implicit type conversion to force the displacement of the pointer to reference the secondary dispatch table. gcc/ada/ * exp_attr.adb (Add_Implicit_Interface_Type_Conversion): New subprogram which factorizes code. (Expand_N_Attribute_Reference): Call the new subprogram to add the missing implicit interface type conversion.
2022-05-19[Ada] Ignore Predicate_Failure in GNATprove modePiotr Trojanek1-1/+7
In GNATprove mode we are don't want predicate failure to pollute the predicate expression extracted from the predicate function. gcc/ada/ * sem_ch13.adb (Build_Predicate_Function): Ignore predicate failure in GNATprove mode.
2022-05-19[Ada] Fix bug in handling of Predicate_Failure aspectSteve Baird11-577/+436
The run-time behavior of the Ada 2022 Predicate_Failure aspect was incorrectly implemented. This could cause incorrect exception messages at execution time in the case of a predicate check failure, as demonstrated by ACATS test C324006. In addition, a new attribute (Predicate_Expression) is defined in order to improve the FE/SPARK interface. gcc/ada/ * einfo-utils.ads, einfo-utils.adb: Delete Predicate_Function_M function and Set_Predicate_Function_M procedure. * einfo.ads: Delete comments for Is_Predicate_Function_M and Predicate_Function_M functions. Add comment for new Predicate_Expression function. Update comment describing predicate functions. * exp_util.ads, exp_util.adb (Make_Predicate_Call): Replace Mem formal parameter with Static_Mem and Dynamic_Mem formals. (Make_Predicate_Check): Delete Add_Failure_Expression and call to it. * exp_ch4.adb (Expand_N_In.Predicate_Check): Update Make_Predicate_Call call to match profile change. * gen_il-fields.ads: Delete Is_Predicate_Function_M field, add Predicate_Expression field. * gen_il-gen-gen_entities.adb: Delete Is_Predicate_Function_M use, add Predicate_Expression use. * sem_ch13.adb (Build_Predicate_Functions): Rename as singular, not plural; we no longer build a Predicate_M function. Delete Predicate_M references. Add new Boolean parameter for predicate functions when needed. Restructure body of generated predicate functions to implement required Predicate_Failure behavior and to set new Predicate_Expression attribute. Remove special treatment of raise expressions within predicate expressions. * sem_util.ads (Predicate_Failure_Expression, Predicate_Function_Needs_Membership_Parameter): New functions. * sem_util.adb (Is_Current_Instance): Fix bugs which caused wrong result. (Is_Current_Instance_Reference_In_Type_Aspect): Delete Is_Predicate_Function_M reference. (Predicate_Failure_Expression): New function. (Propagate_Predicate_Attributes): Delete Is_Predicate_Function_M references.
2022-05-19[Ada] Avoid copy operation for returns involving function callsEric Botcazou4-13/+12
The underlying issue is that the front-end does not create transient scopes for return statements, so objects copied for these statements can never be finalized properly. gcc/ada/ * exp_ch6.adb (Expand_Call_Helper): Adjust comment. (Expand_Simple_Function_Return): For the case of a type which needs finalization and is returned on the primary stack, do not create a copy if the expression originates from a function call. * exp_ch7.adb (Transient Scope Management): Adjust comment. * exp_util.ads (Is_Related_To_Func_Return): Add WARNING line. * fe.h (Is_Related_To_Func_Return): Declare.
2022-05-19[Ada] Fix invalid expanded code for entry familiesPiotr Trojanek1-0/+9
Expansion of entry families created a slightly illegal AST with Elsif_Parts being an empty list. Cleanup uncovered by the work on detection of uninitialized scalars. gcc/ada/ * exp_ch9.adb (Build_Find_Body_Index): Remove empty Elsif_Parts from the constructed IF statement.
2022-05-19[Ada] Cleanup expansion of protected entry familiesPiotr Trojanek1-13/+7
Expansion of entry families contained a condition that was always true. Cleanup related to detection of uninitialized scalar objects (which uncovered that expansion of entry families creates a slightly illegal AST with Elsif_Parts being an empty list). gcc/ada/ * exp_ch9.adb (Build_Find_Body_Index): Remove IF statement whose condition was true-by-construction; remove excessive assertion (since the call to Elsif_Parts will check that Nod is present and it is an if-statement).
2022-05-19[Ada] Remove remaining references to gnatfind/gnatxrefArnaud Charlet11-4892/+16
gcc/ada/ * gnat1drv.adb, gnatcmd.adb: Remove references to gnatfind/xref. * doc/gnat_ugn/building_executable_programs_with_gnat.rst, doc/gnat_ugn/the_gnat_compilation_model.rst: Ditto. * gnat_ugn.texi: Regenerate. * gnatfind.adb, gnatxref.adb, xr_tabls.adb, xr_tabls.ads, xref_lib.adb, xref_lib.ads: Removed, no longer used.
2022-05-19[Ada] Fix proof of runtime unit a-strfix and a-strsupClaire Dross2-0/+22
Update to provers caused some proof regressions. Fix the proof by adding an assertion. gcc/ada/ * libgnat/a-strfix.adb: Add assertions. * libgnat/a-strsup.adb: Idem.
2022-05-19[Ada] Support Ada 2022 null array aggregatesEd Schonberg7-18/+197
Add support for Ada 2022's "[]" null array aggregates (thanks to Ed Schonberg for producing most of this patch). gcc/ada/ * erroutc.ads: Fix a single-character typo in a comment. * exp_aggr.adb: Fix a single-character typo in a comment. Replace several pairs of calls to Low_Bound and High_Bound (which do not handle an identifier that denotes a scalar subtype) with corresponding calls to Get_Index_Bounds (which does handle that case). * par-ch4.adb (P_Aggregate_Or_Paren_Expr): Set the Component_Associations attribute of a null array aggregate to New_List. * sem_aggr.ads: New visible function Is_Null_Array_Aggregate_High_Bound. * sem_aggr.adb (Is_Null_Array_Aggregate_High_Bound, Is_Null_Aggregate, Resolve_Null_Array_Aggregate): New functions. (Resolve_Aggregate): Recognize null array aggregates (using Is_Null_Aggregate) and, when one is recognized, resolve it (using Resolve_Null_Array_Aggregate). Avoid calling Array_Aggr_Subtype for a null array aggregate; the needed subtype is built in Resolve_Null_Array_Aggregate. Do not incorrectly flag a null aggregate (after it is transformed by expansion) as being both positional and named. * sem_attr.adb (Eval_Attribute): Special treatment for null array aggregate high bounds to avoid incorrectly flagging something like Integer'Pred (Integer'First) as an illegal static expression. * sem_eval.adb (Out_Of_Range): Special treatment for null array aggregate high bounds to avoid incorrectly flagging something like Integer'Pred (Integer'First) as an illegal static expression.
2022-05-19[Ada] Further adapt proof of double arithmetic runtime unitYannick Moy1-4/+171
After changes in Why3 and generation of VCs, ghost code needs to be adapted for proofs to remain automatic. gcc/ada/ * libgnat/s-aridou.adb (Lemma_Abs_Range, Lemma_Double_Shift_Left, Lemma_Shift_Left): New lemmas. (Double_Divide): Add ghost code. (Lemma_Concat_Definition, Lemma_Double_Shift_Left, Lemma_Shift_Left, Lemma_Shift_Right): Define or complete lemmas. (Scaled_Divide): Add ghost code.
2022-05-19[Ada] Improve optimization of "=" on bit-packed arraysBob Duff2-8/+17
This patch fixes a performance regression, introduced by a previous bug fix. That fix had the unintended side effect of removing the optimization in cases where the two operands are of two different compiler-generated modular types. gcc/ada/ * exp_pakd.adb (Expand_Packed_Eq): Replace the check for *same* modular type, with a check for any modular type, and assert that the two types have the same modulus and so on. * exp_pakd.ads: Minor comment improvements.
2022-05-19[Ada] Casing style on record componentsBob Duff5-16/+20
This patch fixes a bug where the -gnatyr switch fails to detect incorrect casing of record components. gcc/ada/ * style.adb (Check_Identifier): Deal with the case where a record component definition has been transformed; we want to warn if the original came from source. * libgnat/s-objrea.ads, libgnat/s-objrea.adb: Fix casing of MF to be consistent. * uname.adb: Fix casing of Chars to be consistent. * sem_util.ads: Minor comment fix.
2022-05-19[Ada] Get rid of secondary stack for controlled componentsEric Botcazou18-164/+334
This eliminates the use of the secondary stack to return composite types with controlled components from functions, by exposing the return slot of these functions through the support interface of memory pools, much like for the secondary stack itself. This is piggybacked on the support of a specific intrinsic function by the code generator, and can be disabled if this support is not available, as well with the -gnatd_r debug switch. The change also streamlines a bit the implementation by consistently using the Needs_Finalization predicate, or its derivatives, in various places. gcc/ada/ * Makefile.rtl (GNATRTL_NONTASKING_OBJS): Add s-retsta. * debug.adb (d_r): Document usage. * exp_ch4.adb (Expand_N_Allocato): Deal with the return stack pool. * exp_ch6.adb (Expand_Simple_Function_Return): Replace calls to Requires_Transient_Scope with Returns_On_Secondary_Stack. Deal with types that need finalization returned on the primary stack, use CW_Or_Needs_Finalization for those returned on the secondary. * exp_util.adb (Build_Allocate_Deallocate_Proc): Return early for the return stack pool. (Remove_Side_Effects): Call CW_Or_Needs_Finalization. * fe.h (Requires_Transient_Scope): Delete. (Returns_On_Secondary_Stack): Declare. * gnat1drv.adb (Adjust_Global_Switches): Set Back_End_Return_Slot to False when generating C code or if -gnatd_r is specified. * opt.ads (Back_End_Return_Slot): New boolean variable. * rtsfind.ads (RTU_Id): Add System_Return_Stack. (RE_Id): Add RE_RS_Allocate and RE_RS_Pool. (RE_Unit_Table): Add entries for RE_RS_Allocate and RE_RS_Pool. * sem_util.ads (CW_Or_Has_Controlled_Part): Delete. (CW_Or_Needs_Finalization): Declare. (Requires_Transient_Scope): Adjust description. (Returns_On_Secondary_Stack): Declare. * sem_util.adb (Compute_Returns_By_Ref): Set Returns_By_Ref on types which need finalization if they are returned on the secondary stack. (CW_Or_Has_Controlled_Part): Rename to... (CW_Or_Needs_Finalization): ...this. (Requires_Transient_Scope): Move bulk of implementation to... (Returns_On_Secondary_Stack): ...here. Return true for types which need finalization only if the back-end return slot is not supported. * libgnat/s-retsta.ads: New file. * gcc-interface/ada-builtin-types.def (BT_FN_PTR_SSIZE): Define. * gcc-interface/ada-builtins.def (return_slot): Likewise. * gcc-interface/ada-tree.h (BUILT_IN_RETURN_SLOT): Likewise. * gcc-interface/decl.cc (gnat_to_gnu_subprog_type): Replace call to Requires_Transient_Scope with Returns_On_Secondary_Stack. * gcc-interface/trans.cc (gnat_to_gnu) <N_Simple_Return_Statement>: In the return by invisible reference, skip the copy if the source is the same as the destination. * gcc-interface/utils2.cc (build_call_alloc_dealloc_proc): Deal with the return stack pool.
2022-05-19[Ada] Small housekeeping work continuedEric Botcazou1-50/+50
No functional changes. gcc/ada/ * gcc-interface/trans.cc: Fix formatting issues in comments. (Subprogram_Body_to_gnu): Tidy up. (Exception_Handler_to_gnu_gcc): Rename into... (Exception_Handler_to_gnu): ...this. (gnat_to_gnu) <N_Exception_Handler>: Adjust to above renaming.
2022-05-19[Ada] Small housekeeping workEric Botcazou1-44/+39
No functional changes. gcc/ada/ * gcc-interface/trans.cc (Subprogram_Body_to_gnu): Rename a couple of local variables and use Is_Generic_Subprogram predicate. (process_decls): Likewise.
2022-05-19[Ada] Do not override inlining heuristics for expression functions at -OsEric Botcazou2-7/+9
gcc/ada/ * gcc-interface/trans.cc (Subprogram_Body_to_gnu): Do not deal with inlining heuristics for expression functions here but... * gcc-interface/decl.cc (inline_status_for_subprog): ...here instead and do not override them at -Os.
2022-05-19[Ada] Remove dead code for scope entity having E_Subprogram_Body kindPiotr Trojanek1-4/+0
In GNAT AST the Scope field always points to the semantic scope (e.g. subprogram) and never to syntactic scope (e.g. subprogram body). Cleanup related to handling of circular access-to-record types. gcc/ada/ * gcc-interface/decl.cc (gnat_to_gnu_entity): Remove dead code which expected Scope to return E_Subprogram_Body entity.
2022-05-19PR105647 Update pr105169* so it does not fail on powerpc64leGiuliano Belinassi2-4/+4
On powerpc64le, the tests related to pr105169 failed because the .localentry was not on a power of two address due to the extra nop instruction taking one byte and thus moving its position one byte further. Generating two nops instead moves .localentry to a valid position. gcc/testsuite/ChangeLog 2022-05-18 Giuliano Belinassi <gbelinassi@suse.de> PR target/105647 * g++.dg/modules/pr105169_a.C: Change -fpatchable-function-entry to 2. * g++.dg/modules/pr105169_b.C: Likewise.
2022-05-19analyzer: update docs about -fanalyzer-checker=taintDavid Malcolm1-0/+2
gcc/ChangeLog: * doc/invoke.texi (-fanalyzer-checker=): Add -Wanalyzer-va-list-leak and -Wanalyzer-va-list-use-after-va-end to the list of analyzer warnings disabled by -fanalyzer-checker=taint. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-05-19cfgexpand: Yet another spot with debug insns references to global vars ↵Jakub Jelinek2-0/+26
without varpool nodes [PR105630] This is similar to the earlier patch to avoid having MEM_EXPRs referencing global vars without varpool nodes, but this time the difference is that during gimplification some hashing actually created DECL_RTLs for the n VAR_DECL and the previous change was in the if above this when DECL_RTL is NULL and we are considering creating it. The following patch drops on the floor references to vars where we've optimized away the varpool node even when it has DECL_RTL. Bootstrapped/regtested on x86_64-linux and i686-linux, plus bootstrapped on those without the cfgexpand.cc change, reapplied it and rebuilt stage3 cc1/cc1plus, the resulting cc1/cc1plus binaries on both targets were identical except for the 16-byte executable_checksum (I've done the second bootstraps in the same directory as the first one after moving the previous one elsewhere, so pathnames were the same, just checksum hasn't been regenerated). So, at least on those binaries this patch doesn't affect debug info at all. 2022-05-19 Jakub Jelinek <jakub@redhat.com> PR debug/105630 * cfgexpand.cc (expand_debug_expr): For VAR_DECL, punt for global vars without symtab node even when they have DECL_RTL set. * gcc.dg/pr105630.c: New test.
2022-05-19pointer-query: Fix ICE with non-pointer param [PR105635]Jakub Jelinek2-1/+12
The gimple_parm_array_size function comment talks about pointe parameters but doesn't actually verify it, it checks whether an attribute is present on the function and then just uses TREE_TYPE (TREE_TYPE (var)) which assumes a pointer type (or in theory could work for ARRAY_TYPE but c-family languages which only have that attribute will never have ARRAY_TYPE parameters; and for VECTOR_TYPE/COMPLEX_TYPE it would mean something quite different). So, this patch punts early if var doesn't have pointer/reference type. 2022-05-19 Jakub Jelinek <jakub@redhat.com> PR c/105635 * pointer-query.cc (gimple_parm_array_size): Return NULL if var doesn't have pointer or reference type. * gcc.dg/pr105635.c: New test.
2022-05-18compiler: traverse expressions when exporting constantsJulia Lapenko2-1/+29
When exporting a constant A that is expressed through a constant B from another package, it is necessary to traverse an expression representing the constant A to generate a sequence of type casts from the constant B. Current implementation doesn't collect types of constants contained in such expressions. This change fetches these types. Fixes golang/go#51291 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/405976
2022-05-19Daily bump.GCC Administrator8-1/+431