aboutsummaryrefslogtreecommitdiff
path: root/gcc
AgeCommit message (Collapse)AuthorFilesLines
2024-05-22Avoid ICE in except.cc on targets that don't support exceptions.Roger Sayle1-3/+3
A number of testcases currently fail on nvptx with the ICE: during RTL pass: final openmp-simd-2.c: In function 'foo': openmp-simd-2.c:28:1: internal compiler error: in get_personality_function, at expr.cc:14037 28 | } | ^ 0x98a38f get_personality_function(tree_node*) /home/roger/GCC/nvptx-none/gcc/gcc/expr.cc:14037 0x969d3b output_function_exception_table(int) /home/roger/GCC/nvptx-none/gcc/gcc/except.cc:3226 0x9b760d rest_of_handle_final /home/roger/GCC/nvptx-none/gcc/gcc/final.cc:4252 The simple oversight in output_function_exception_table is that it calls get_personality_function (immediately) before checking the target's except_unwind_info hook (which on nvptx always returns UI_NONE). The (perhaps obvious) fix is to move the assignments of fname and personality after the tests that they are needed, and before their first use. 2024-05-22 Roger Sayle <roger@nextmovesoftware.com> gcc/ChangeLog * except.cc (output_function_exception_table): Move call to get_personality_function after targetm_common.except_unwind_info check, to avoid ICE on targets that don't support exceptions.
2024-05-22Fix mixed input kind permute optimizationRichard Biener1-0/+2
When change_vec_perm_layout runs into a permute combining two nodes where one is invariant and one internal the partition of one input can be -1 but the other might not be. The following supports this case by simply ignoring inputs with input partiton -1. I'm not sure this is correct but it avoids ICEing when accessing that partitions layout for gcc.target/i386/pr98928.c with the change to avoid splitting store dataref groups during SLP discovery. * tree-vect-slp.cc (change_vec_perm_layout): Ignore an input partition of -1.
2024-05-22Avoid SLP_REPRESENTATIVE access for VEC_PERM in SLP schedulingRichard Biener1-12/+16
SLP permute nodes can end up without a SLP_REPRESENTATIVE now, the following avoids touching it in this case in vect_schedule_slp_node. * tree-vect-slp.cc (vect_schedule_slp_node): Avoid looking at SLP_REPRESENTATIVE for VEC_PERM nodes.
2024-05-22Avoid requiring VEC_PERM represenativesRichard Biener1-3/+22
The following plugs one hole where we require a VEC_PERM node representative unnecessarily. This is for vect_check_store_rhs which looks at the RHS and checks whether a constant can be native encoded. The fix is to guard that with vect_constant_def additionally and making vect_is_simple_use forgiving for a missing SLP_TREE_REPRESENTATIVE when the child is a VEC_PERM node, initializing the scalar def to error_mark_node. * tree-vect-stmts.cc (vect_check_store_rhs): Look at *rhs only when it's a vec_constant_def. (vect_is_simple_use): When we have no representative for an internal node, fill in *op with error_mark_node.
2024-05-22web/115183 - fix typo in C++ docsRichard Biener1-1/+1
The following fixes a reported typo. * doc/invoke.texi (C++ Modules): Fix typo.
2024-05-22testsuite: Allow for non-SECTION_MERGE systems in gcc.dg/pr115066.c [PR115066]Tom de Vries1-1/+1
gcc.dg/pr115066.c currently FAILs on Solaris/SPARC with the native as: FAIL: gcc.dg/pr115066.c scan-assembler \\\\.byte\\\\t0xb\\\\t# Define macro strx Instead of the expected .byte 0xb ! Define macro strx the assembler output contains .byte 0x1 ! Define macro Apparently this happens because the Solaris as/ld combo doesn't support SHF_MERGE. While I initially meant to just skip the test on sparc*-*-solaris2* && !gas, Tom suggested to allow for both forms instead, which is what his patch does. Tested on sparc-sun-solaris2.11 and i386-pc-solaris2.11 (as and gas each) and x86_64-pc-linux-gnu. 2024-05-21 Tom de Vries <tdevries@suse.de> gcc/testsuite: PR debug/115066 * gcc.dg/pr115066.c (scan-assembler): Allow for alternative form of Define macro.
2024-05-22strlen: Fix up !si->full_string_p handling in count_nonzero_bytes_addr ↵Jakub Jelinek2-1/+21
[PR115152] The following testcase is miscompiled because strlen_pass::count_nonzero_bytes_addr doesn't handle correctly the !si->full_string_p case. If si->full_string_p, it correctly computes minlen and maxlen as minimum and maximum length of the '\0' terminated stgring and clears *nulterm (ie. makes sure !full_string_p in the ultimate caller) if minlen is equal or larger than nbytes and so '\0' isn't guaranteed to be among those bytes. But in the !si->full_string_p case, all we know is that there are [minlen,maxlen] non-zero bytes followed by unknown bytes, so effectively the maxlen is infinite (but caller cares about only the first nbytes bytes) and furthermore, we never know if there is any '\0' char among those, so *nulterm needs to be always cleared. 2024-05-22 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/115152 * tree-ssa-strlen.cc (strlen_pass::count_nonzero_bytes_addr): If !si->full_string_p, clear *nulterm and set maxlen to nbytes. * gcc.dg/pr115152.c: New test.
2024-05-22ubsan: Use right address space for MEM_REF created for bool/enum ↵Jakub Jelinek2-1/+25
sanitization [PR115172] The following testcase is miscompiled, because -fsanitize=bool,enum creates a MEM_REF without propagating there address space qualifiers, so what should be normally loaded using say %gs:/%fs: segment prefix isn't. Together with asan it then causes that load to be sanitized. 2024-05-22 Jakub Jelinek <jakub@redhat.com> PR sanitizer/115172 * ubsan.cc (instrument_bool_enum_load): If rhs is not in generic address space, use qualified version of utype with the right address space. Formatting fix. * gcc.dg/asan/pr115172.c: New test.
2024-05-22i386: Disable ix86_expand_vecop_qihi2 when !TARGET_AVX512BWHaochen Jiang2-0/+16
Since vpermq is really slow, we should avoid using it for permutation when vpmovwb is not available (needs AVX512BW) for ix86_expand_vecop_qihi2 and fall back to ix86_expand_vecop_qihi. gcc/ChangeLog: PR target/115069 * config/i386/i386-expand.cc (ix86_expand_vecop_qihi2): Do not enable the optimization when AVX512BW is not enabled. gcc/testsuite/ChangeLog: PR target/115069 * gcc.target/i386/pr115069.c: New.
2024-05-22RISC-V: Enable vectorization for vect-early-break_124-pr114403.cxuli1-2/+2
Because "targetm.slow_unaligned_access" is set to true by default (aka -mtune=rocket) for RISC-V, it causes the __builtin_memcpy with 8 bytes failed to folded into int64 assignment during ccp1. So adding "-mtune=generic-ooo" to the RISC-V target can vectorize vect-early-break_124-pr114403.c. gcc/testsuite/ChangeLog: * gcc.dg/vect/vect-early-break_124-pr114403.c: Enable vectrization for RISC-V target.
2024-05-22c++: Strengthen checks on 'main'Nathaniel Shead10-16/+53
This patch adds some missing requirements for legal main declarations, as according to [basic.start.main] p2. gcc/cp/ChangeLog: * decl.cc (grokfndecl): Check for main functions with language linkage or module attachment. (grokvardecl): Check for extern 'C' entities named main. gcc/testsuite/ChangeLog: * g++.dg/abi/main.C: Check pedwarn for main with linkage-spec. * g++.dg/modules/contracts-1_b.C: Don't declare main in named module. * g++.dg/modules/contracts-3_b.C: Likewise. * g++.dg/modules/contracts-4_d.C: Likewise. * g++.dg/modules/horcrux-1_a.C: Export declarations, so that... * g++.dg/modules/horcrux-1_b.C: Don't declare main in named module. * g++.dg/modules/main-1.C: New test. * g++.dg/parse/linkage5.C: New test. * g++.dg/parse/linkage6.C: New test. Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
2024-05-22Daily bump.GCC Administrator6-1/+517
2024-05-21c++: Fix std dialect hint for std::to_address [PR107800]Jonathan Wakely3-3/+3
The correct dialect for std::to_address is cxx20 not cxx11. gcc/cp/ChangeLog: PR libstdc++/107800 * cxxapi-data.csv <to_address>: Change dialect to cxx20. * std-name-hint.gperf: Regenerate. * std-name-hint.h: Regenerate.
2024-05-21c++: folding non-dep enumerator from current inst [PR115139]Patrick Palka2-1/+14
After the tsubst_copy removal r14-4796-g3e3d73ed5e85e7 GCC 14 ICEs during fold_non_dependent_expr for 'e1 | e2' below ultimately because we no longer exit early when substituting the CONST_DECLs for e1 and e2 with args=NULL_TREE and instead proceed to substitute the class context A<Ts...> (also with args=NULL_TREE) which ends up ICEing from tsubst_pack_expansion (due to processing_template_decl being cleared). Incidentally, the ICE went away on trunk ever since the tsubst_aggr_type removal r15-123-gf04dc89a991ddc since it changed the CONST_DECL case of tsubst_expr to use tsubst to substitute the context, which short circuits for empty args and so avoids the ICE. This patch fixes this ICE for GCC 14 by narrowly restoring the early exit for empty args that would've happened in tsubst_copy when substituting an enumerator CONST_DECL. We might as well apply this to trunk too, as a small optimization. PR c++/115139 gcc/cp/ChangeLog: * pt.cc (tsubst_expr) <case CONST_DECL>: Exit early if args is empty. gcc/testsuite/ChangeLog: * g++.dg/template/non-dependent33.C: New test. Reviewed-by: Marek Polacek <mpolacek@redhat.com> Reviewed-by: Jason Merrill <jason@redhat.com>
2024-05-21RISC-V: avoid LUI based const mat in alloca epilogue expansionVineet Gupta1-7/+26
This is continuing on the prev patch in function epilogue expansion. Broken out of easy of review. gcc/ChangeLog: * config/riscv/riscv.cc (riscv_expand_epilogue): Handle offset being sum of two S12. Tested-by: Patrick O'Neill <patrick@rivosinc.com> # pre-commit-CI #1569 Signed-off-by: Vineet Gupta <vineetg@rivosinc.com>
2024-05-21RISC-V: avoid LUI based const mat in prologue/epilogue expansion [PR/105733]Vineet Gupta11-17/+89
If the constant used for stack offset can be expressed as sum of two S12 values, the constant need not be materialized (in a reg) and instead the two S12 bits can be added to instructions involved with frame pointer. This avoids burning a register and more importantly can often get down to be 2 insn vs. 3. The prev patches to generally avoid LUI based const materialization didn't fix this PR and need this directed fix in funcion prologue/epilogue expansion. This fix doesn't move the neddle for SPEC, at all, but it is still a win considering gcc generates one insn fewer than llvm for the test ;-) gcc-13.1 release | gcc 230823 | | | g6619b3d4c15c | This patch | clang/llvm --------------------------------------------------------------------------------- li t0,-4096 | li t0,-4096 | addi sp,sp,-2048 | addi sp,sp,-2048 addi t0,t0,2016 | addi t0,t0,2032 | add sp,sp,-16 | addi sp,sp,-32 li a4,4096 | add sp,sp,t0 | add a5,sp,a0 | add a1,sp,16 add sp,sp,t0 | addi a5,sp,-2032 | sb zero,0(a5) | add a0,a0,a1 li a5,-4096 | add a0,a5,a0 | addi sp,sp,2032 | sb zero,0(a0) addi a4,a4,-2032 | li t0, 4096 | addi sp,sp,32 | addi sp,sp,2032 add a4,a4,a5 | sb zero,2032(a0) | ret | addi sp,sp,48 addi a5,sp,16 | addi t0,t0,-2032 | | ret add a5,a4,a5 | add sp,sp,t0 | add a0,a5,a0 | ret | li t0,4096 | sd a5,8(sp) | sb zero,2032(a0)| addi t0,t0,-2016 | add sp,sp,t0 | ret | gcc/ChangeLog: PR target/105733 * config/riscv/riscv.h: New macros for with aligned offsets. * config/riscv/riscv.cc (riscv_split_sum_of_two_s12): New function to split a sum of two s12 values into constituents. (riscv_expand_prologue): Handle offset being sum of two S12. (riscv_expand_epilogue): Ditto. * config/riscv/riscv-protos.h (riscv_split_sum_of_two_s12): New. gcc/testsuite/ChangeLog: * gcc.target/riscv/pr105733.c: New Test. * gcc.target/riscv/rvv/autovec/vls/spill-1.c: Adjust to not expect LUI 4096. * gcc.target/riscv/rvv/autovec/vls/spill-2.c: Ditto. * gcc.target/riscv/rvv/autovec/vls/spill-3.c: Ditto. * gcc.target/riscv/rvv/autovec/vls/spill-4.c: Ditto. * gcc.target/riscv/rvv/autovec/vls/spill-5.c: Ditto. * gcc.target/riscv/rvv/autovec/vls/spill-6.c: Ditto. * gcc.target/riscv/rvv/autovec/vls/spill-7.c: Ditto. Tested-by: Edwin Lu <ewlu@rivosinc.com> # pre-commit-CI #1568 Signed-off-by: Vineet Gupta <vineetg@rivosinc.com>
2024-05-21modula2: use groups in the type resolver of the bootstrap tool mcGaius Mulley9-165/+552
This patch introduces groups to maintain the lists used when resolving types in the bootstrap tool mc. The groups and type resolver are very similar to that used in cc1gm2. Specifically the resolver uses the group to detect any change to any element in any list within a group. This is much cleaner and safer than the previous list length comparisons. gcc/m2/ChangeLog: * Make-lang.in (MC_EXTENDED_OPAQUE): New definition. * mc-boot/GDynamicStrings.cc: Rebuild. * mc-boot/GDynamicStrings.h: Rebuild. * mc-boot/Galists.cc: Rebuild. * mc-boot/Galists.h: Rebuild. * mc-boot/Gdecl.cc: Rebuild. * mc/alists.def (equalList): New procedure. * mc/alists.mod (equalList): New procedure implementation. * mc/decl.mod (group): New type. (freeGroup): New variable. (globalGroup): Ditto. (todoQ): Remove declaration and prefix all occurances with globalGroup^. (partialQ): Ditto. (doneQ): Ditto. (newGroup): New procedure. (initGroup): Ditto. (killGroup): Ditto. (dupGroup): Ditto. (equalGroup): Ditto. (topologicallyOut): Rewrite. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2024-05-21match: Disable `(type)zero_one_valuep*CST` for 1bit signed types [PR115154]Andrew Pinski3-2/+52
The problem here is the pattern added in r13-1162-g9991d84d2a8435 assumes that it is well defined to multiply zero_one_valuep by the truncated converted integer constant. It is well defined for all types except for signed 1bit types. Where `a * -1` is produced which is undefined/ So disable this pattern for 1bit signed types. Note the pattern added in r14-3432-gddd64a6ec3b38e is able to workaround the undefinedness except when `-fsanitize=undefined` is turned on, this is why I added a testcase for that. Bootstrapped and tested on x86_64-linux-gnu with no regressions. PR tree-optimization/115154 gcc/ChangeLog: * match.pd (convert (mult zero_one_valued_p@1 INTEGER_CST@2)): Disable for 1bit signed types. gcc/testsuite/ChangeLog: * c-c++-common/ubsan/signed1bitfield-1.c: New test. * gcc.c-torture/execute/signed1bitfield-1.c: New test. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2024-05-21modula2: Pass --destdir for dir index during install of m2.info.Sam James1-1/+1
This patch adds DESTDIR to the infodir when installing m2.info. gcc/m2/ChangeLog * Make-lang.in (m2.install-info): Pass --destdir for dir index. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2024-05-21tree-optimization/115137 - more ptr-vs-ptr compare fixesRichard Biener2-0/+35
The following fixes the omission of const-pool included in NONLOCAL. PR tree-optimization/115137 * tree-ssa-structalias.cc (pt_solution_includes_const_pool): NONLOCAL also includes constant pool entries. * gcc.dg/torture/pr115137.c: New testcase.
2024-05-21Cache the set of EH_RETURN_DATA_REGNOsRichard Sandiford4-15/+18
While reviewing Andrew's fix for PR114843, it seemed like it would be convenient to have a HARD_REG_SET of EH_RETURN_DATA_REGNOs. This patch adds one and uses it to simplify a couple of use sites. gcc/ * hard-reg-set.h (target_hard_regs::x_eh_return_data_regs): New field. (eh_return_data_regs): New macro. * reginfo.cc (init_reg_sets_1): Initialize x_eh_return_data_regs. * df-scan.cc (df_get_exit_block_use_set): Use it. * ira-lives.cc (process_out_of_region_eh_regs): Likewise.
2024-05-21Fix Ada runtime library breakage on Solaris (bis)Eric Botcazou2-5/+2
Recent changes made to the runtime library broke again its build on Solaris because it uses Solaris threads instead of POSIX threads on this platform. gcc/ada/ PR ada/115168 * libgnarl/s-taprop__solaris.adb (Initialize): Fix pasto. * libgnat/s-oslock__solaris.ads (Owner_Int): Delete. (Owner_ID): Change the designated type to Integer.
2024-05-21tree-optimization/115149 - VOP live and missing PHIsRichard Biener2-2/+22
The following fixes a bug in vop-live get_live_in which was using NULL to indicate the first processed edge but at the same time using it for the case the live-in virtual operand cannot be computed. The following fixes this, avoiding sinking a load to a place where we'd have to insert virtual PHIs to make the virtual operand SSA web OK. PR tree-optimization/115149 * tree-ssa-live.cc (virtual_operand_live::get_live_in): Explicitly track the first processed edge. * gcc.dg/pr115149.c: New testcase.
2024-05-21ada: Streamline implementation of simple nonbinary modular operationsEric Botcazou1-63/+28
They are implemented by the nonbinary_modular_operation routine, which is complex and, in particular, creates signed types and types with a partial precision each time a subtraction or a multiplication resp. is generated. Both are unnecessary and a simple approach even generates better code for the subtraction on architectures with conditional moves. gcc/ada/ * gcc-interface/utils2.cc (nonbinary_modular_operation): Rewrite. Do not create signed types for subtraction, do not create types with partial precision, call fold_convert instead of convert throughout.
2024-05-21ada: Simplify test for propagation of attributes to subtypesEric Botcazou1-4/+3
This changes the test to use the Is_Base_Type predicate and also removes the superfluous call to Base_Type before First_Subtype. No functional changes. gcc/ada/ * gcc-interface/decl.cc (gnat_to_gnu_entity): Use the Is_Base_Type predicate and remove superfluous calls to Base_Type.
2024-05-21ada: Fix internal error on discriminated record with Atomic aspect in Ada 2022Eric Botcazou1-1/+12
It occurs in build_load_modify_store where the pattern matching logic cannot find the atomic load that is present in the tree because it has been wrapped in a SAVE_EXPR by gnat_protect_expr, which is unnecessary. gcc/ada/ * gcc-interface/utils2.cc (gnat_protect_expr): Deal specifically with atomic loads. Document the relationship with gnat_save_expr.
2024-05-21ada: Fix strict aliasing violation in parameter passing (continued)Eric Botcazou3-62/+159
This fixes another long-standing (implicit) violation of the strict aliasing rules that occurs when the result of a value conversion is directly passed as an actual parameter in a call to a subprogram and the passing mechanism is by reference. In this case, the reference passed to the subprogram may be to a type that is too different from the type of the underlying object, which is the definition of such a violation. The change reworks and strengthens the previous fix as follows: first, the detection of these violations is moved into a dedicated predicate; second, an assertion is added to check that none of them has been missed, which is triggered by either -fchecking or -fstrict-aliasing, as the closely related assertion that is present in relate_alias_sets. The assertion uncovered two internal sources of violations: implementation types for packed array types with peculiar index types and interface types, which are fixed by propagating alias sets in the first case and resorting to universal aliasing in the second case. Finally, an unconditional warning is implemented to inform the user that the temporary is created and to suggest a possible solution to prevent that. gcc/ada/ * gcc-interface/decl.cc (gnat_to_gnu_entity) <E_Array_Type>: For a packed type implemented specially, temporarily save the XUA type as equivalent to the entity before processing the implementation type. For this implementation type, if its component type is the same as that of the original type, copy the alias set from the latter. <types>: Resort to universal aliasing for all interface types. * gcc-interface/trans.cc (Call_to_gnu): Add GNU_ACTUAL_TYPE local variable and rename existing one to GNU_UNPADDED_ACTUAL_TYPE. If the formal is passed by reference and the actual is a conversion, call aliasable_p to detect aliasing violations, issue a warning upon finding one and create the temporary in the target type. Add an assertion that no such violation has been missed above. (addressable_p): Revert latest changes. (aliasable_p): New predicate. * gcc-interface/utils2.cc (build_binary_op) <ARRAY_RANGE_REF>: When creating a new array type on the fly, preserve the alias set of the operation type.
2024-05-21ada: Make detection of useless copy for return more robustEric Botcazou1-2/+3
In the return-by-invisible-reference case, the return object of an extended return statement is allocated directly on the return stack and, therefore, the copy operation on return is useless. The code detecting this was not robust enough and missed some complex cases. gcc/ada/ * gcc-interface/trans.cc (gnat_to_gnu) <N_Simple_Return_Statement>: In the return-by-invisible-reference case, remove conversions before looking for a dereference in the return values and building the test protecting against a useless copy operation.
2024-05-21ada: Fix strict aliasing violation in parameter passingEric Botcazou2-18/+82
This fixes a long-standing (implicit) violation of the strict aliasing rules that occurs when the result of a call to an instance of Unchecked_Conversion is directly passed as an actual parameter in a call to a subprogram and the passing mechanism is by reference. In this case, the reference passed to the subprogram may be to a type that has nothing to do with the type of the underlying object, which is the definition of such a violation. This implements the following two-pronged approach: first, the problematic cases are detected and a reference to a temporary is passed instead of the direct reference to the underlying object; second, the implementation of pragma Universal_Aliasing is enhanced so that it is propagated from the component type of an array type to the array type itself, or else can be applied to the array type directly, and may therefore be used to prevent the violation from occurring in the first place, when the array type is involved in the Unchecked_Conversion. gcc/ada/ * gcc-interface/decl.cc (gnat_to_gnu_entity) <E_Array_Type>: Set TYPE_TYPELESS_STORAGE on the array types if Universal_Aliasing is set on the type or its component type. <E_Array_Subtype>: Likewise. For other aggregate types, set TYPE_TYPELESS_STORAGE in this case. (set_typeless_storage_on_aggregate_type): New function. (set_universal_aliasing_on_type): Likewise. * gcc-interface/trans.cc (Call_to_gnu): Add const to local variable. Adjust comment. Pass GNAT_NAME in the call to addressable_p and add a bypass for atomic types in case it returns false. (addressable_p): Add GNAT_EXPR third parameter with default value and add a default value to the existing second parameter. <VIEW_CONVERT_EXPR:>: Return false if the expression comes from a function call and if the alias sets of source and target types are both distinct from zero and each other.
2024-05-21ada: Fix crash with aliased array and if expressionRonan Desplanques1-3/+5
The way if expressions were translated led the gimplifying phase to attempt to create a temporary of a variable-sized type in some cases. This patch fixes this by adding an address indirection layer in those cases. gcc/ada/ * gcc-interface/utils2.cc (build_cond_expr): Also apply an indirection when the result type is variable-sized.
2024-05-21ada: Minor typo fix in commentMarc Poulhiès1-1/+1
gcc/ada/ * gcc-interface/decl.cc: Fix typo in comment.
2024-05-21ada: Follow-up adjustment to earlier fix in Build_Allocate_Deallocate_ProcEric Botcazou1-8/+4
The deallocation call of the return and secondary stacks no longer matches the profile built in Exp_Util.Build_Allocate_Deallocate_Proc, so this just removes the code as unreachable and adds an assertion to that effect. gcc/ada/ * gcc-interface/utils2.cc (build_call_alloc_dealloc_proc): Add an assertion that this is not a deallocation of the return or secondary stack and remove subsequent unreachable code.
2024-05-21ada: Avoid temporary for conditional expression of discriminated record typeEric Botcazou1-2/+2
This just aligns the definite case (discriminants with default) with the indefinite case (discriminants without default), the latter case having been properly handled for long. In the former case, the maximum size is used so a temporary can be much larger than the actual data it contains. gcc/ada/ * gcc-interface/utils2.cc (build_cond_expr): Use the indirect path for all types containing a placeholder.
2024-05-21ada: Remove unused dependencies from gnatbind object listPiotr Trojanek1-5/+0
The gnatbind executable does not depend on aspects, SCIL, style checks, etc. Also, these dependencies are not needed to actually build the executable. Cleanup. gcc/ada/ * gcc-interface/Make-lang.in (GNATBIND_OBJS): Remove unused dependencies.
2024-05-21ada: Fix assembler error for gigantic library-level object on 64-bit WindowsEric Botcazou1-6/+21
Most small 64-bit code models have a limit of 2 GB on the span of binaries, so we also use the limit for the size of the largest statically allocatable object by the compiler. If the limit is topped, the compiler switches over to a dynamic allocation (if not forbidden) after giving a warning. gcc/ada/ * gcc-interface/decl.cc (gnat_to_gnu_entity) <E_Variable>: Give a warning for a statically allocated object whose size is constant, valid but too large. (allocatable_size_p): In the static case, return false for a size that is constant, valid but too large.
2024-05-21ada: Fix crash on aliased constant with packed array type and -g switchEric Botcazou1-0/+3
The problem is that we build a template whose array field is not an array in the case of an aliased object with nominal unconstrained array subtype. gcc/ada/ * gcc-interface/decl.cc (gnat_to_gnu_entity) <E_Variable>: For an array allocated with its bounds, make sure to have an array type to build the template.
2024-05-21ada: Fix small inaccuracy for Size attribute applied to objectsEric Botcazou1-3/+25
This reverts a change made some time ago in lvalue_required_for_attribute_p whereby the Size attribute applied to objects would no longer be considered as requiring an lvalue. While not wrong in principle, this turns out to be problematic because the implementation in Attribute_to_gnu needs to look at the translated prefix to spot particular cases and not only at the actual type of its value. This of course requires a small adjustment in gnat_to_gnu to compensate. gcc/ada/ * gcc-interface/trans.cc (access_attribute_p): New predicate. (lvalue_required_for_attribute_p): Return again 1 for Size and add the missing terminating call to gcc_unreachable. (gnat_to_gnu): Return the result unmodified for a reference to an unconstrained array only if it is the prefix of an access attribute.
2024-05-21ada: Fix oversight in previous changeEric Botcazou1-2/+5
In rare cases, types using structural equality may reach relate_alias_sets. gcc/ada/ * gcc-interface/utils.cc (relate_alias_sets): Restore previous code when the type uses structural equality.
2024-05-21ada: Missing constraint check for initial value of object with address clauseSteve Baird1-0/+29
In some cases where an object is declared with an initial value that is an aggregate and also with a specified Address (either via an aspect_specification or via an attribute_definition_clause), the check that the initial value satisfies the constraints of the object's subtype was incorrectly omitted. gcc/ada/ * exp_util.adb (Remove_Side_Effects): Make_Reference assumes that the referenced object satisfies the constraints of the designated subtype of the access type. Ensure that this assumption holds by introducing a qualified expression if needed (and then ensuring that checking associated with evaluation of the qualified expression is not suppressed).
2024-05-21ada: Fix layout in a list of aspectsPiotr Trojanek1-8/+11
Code cleanup; semantics is unaffected. gcc/ada/ * aspects.ads (Nonoverridable_Aspect_Id): Fix layout.
2024-05-21ada: Remove duplicate statementRonan Desplanques1-1/+0
This patch removes a duplicate statement that was useless and could be misleading to the reader by suggesting that there are multiple global variables named Style_Check, while there is just one. gcc/ada/ * frontend.adb (Frontend): Remove duplicate statement.
2024-05-21ada: Remove useless trampolines caused by Unchecked_ConversionEric Botcazou1-13/+16
The partial solution implemented in Validate_Unchecked_Conversion to support unchecked conversions between addresses and pointers to subprograms, for the platforms where pointers to subprograms do not all have the same size, turns out to be counter-productive for others because it may cause the creation of useless trampolines, which in turn makes the stack executable. gcc/ada/ * sem_ch13.adb (Validate_Unchecked_Conversion): Restrict forcing the Can_Use_Internal_Rep flag to platforms that require unnesting.
2024-05-21ada: Add elaboration switch tags to info messagesViljar Indus1-5/+8
Add the ?$? insertion characters for elaboration message so they would be marked with the [-gnatel] tag. Note that these insertion characters were not added for SPARK elaboration messages: gcc/ada/ * sem_elab.adb: Add missing elaboration insertion characters to info messages.
2024-05-21ada: Simplify management of scopes while inliningPiotr Trojanek1-15/+4
Code cleanup; semantics is unaffected. gcc/ada/ * inline.adb (Add_Scope_To_Clean): Use Append_Unique_Elmt. (Analyze_Inlined_Bodies): Refine type of a local counter; remove extra whitespace.
2024-05-21ada: Remove some explicit yields in tasking run-timeRonan Desplanques2-36/+0
This patch removes three occurrences where tasking run-time subprograms yielded control shortly before conditional calls to Sleep, in order to avoid these calls more often. It was intended as an optimization on systems where calls to Sleep are costly and in particular VMS. A problem was that two of the yields contained data races that were reported by thread sanitizing tools on some platforms, and that's the motivation for removing them. gcc/ada/ * libgnarl/s-taenca.adb (Wait_For_Completion): Remove call to Yield. * libgnarl/s-tasren.adb (Timed_Selective_Wait, Wait_For_Call): Remove calls to Yield.
2024-05-21ada: Fix formatting in list of implemented Ada 2012 featuresPiotr Trojanek2-6/+6
Fix formatting; meaning is unaffected. gcc/ada/ * doc/gnat_rm/implementation_of_ada_2012_features.rst: Fix formatting. * gnat_rm.texi: Regenerate.
2024-05-21ada: Sort list of implemented Ada 2012 featuresPiotr Trojanek2-1831/+1831
The list of implemented Ada 2012 features is now ordered by the AI numbers. It has been sorted mechanically using the csplit command with a bit of shell scripting. gcc/ada/ * doc/gnat_rm/implementation_of_ada_2012_features.rst: Order list by AI number. * gnat_rm.texi: Regenerate.
2024-05-21ada: Fix index entry for an implemented AI featurePiotr Trojanek2-2/+2
Fix inconsistent reference with "05" in the name of AI. gcc/ada/ * doc/gnat_rm/implementation_of_ada_2012_features.rst (AI-0216): Fix index reference. * gnat_rm.texi: Regenerate.
2024-05-21ada: Update documentation of warning messagesViljar Indus2-15/+15
Update the documentation of warning messages that only emit info messages to clearly reflect that they only emit info messages and not warning messages. gcc/ada/ * doc/gnat_ugn/building_executable_programs_with_gnat.rst: Update the documentation of -gnatw.n and -gnatw.l * gnat_ugn.texi: Regenerate.
2024-05-21ada: Do not leak tagged type names when Discard_Names is enabledPiotr Trojanek4-10/+41
When both pragmas Discard_Names and No_Tagged_Streams apply to a tagged type, the intended behavior is to prevent type names from leaking into object code, as documented in GNAT RM. However, while Discard_Names can be used as a configuration pragma, No_Tagged_Streams must be applied to each type separately. This patch enables the use of restriction No_Streams, which can be activated globally, instead of No_Tagged_Streams on individual types. When no tagged stream object can be created and allocated, then routines that make use of the External_Tag won't be used. gcc/ada/ * doc/gnat_rm/implementation_defined_pragmas.rst (No_Tagged_Streams): Document how to avoid exposing entity names for the entire partition. * exp_disp.adb (Make_DT): Make use of restriction No_Streams. * exp_put_image.adb (Build_Record_Put_Image_Procedure): Respect Discard_Names in the generated Put_Image procedure. * gnat_rm.texi: Regenerate.