aboutsummaryrefslogtreecommitdiff
path: root/gcc
AgeCommit message (Collapse)AuthorFilesLines
9 daysDaily bump.GCC Administrator6-1/+848
9 daysc++/modules: Cleanup import handling [PR99682]Nathaniel Shead13-19/+113
This patch fixes some issues with import handling. The main functional change is to allow importing a module's interface file into its implementation file indirectly. [module.import] p9 forbids an explicit 'import M;' declaration, but there's no provision against having 'import X;' where module X itself imports M, so this patch splits up the detection of circular imports to handle this better. I also updated the errors to be closer to the standard wording. A second issue I found while testing this is that we don't properly handle name visibility when a partition implementation unit imports its primary module interface (g++.dg/modules/part-10). This is resolved by setting 'module_p' on the primary interface when it gets imported. Solving this I incidentally removed the assertion that PR121808 was failing on, which was never valid: we can enter import_module for a module previously seen as a module-declaration if parsing bails before declare_module is called. I experimented with guaranteeing that declare_module always gets called for a module_state generated during preprocessing if at all possible, but the resulting errors didn't seem a lot better so I've left it as-is for now. I did make a small adjustment so that a direct import of a module doesn't overwrite the location of a module-declaration from earlier in the file; this is important because preprocessing (and thus the assigning of these locations) seems to happen for the whole file before parsing begins, which can otherwise cause confusing locations referring to later in the file than parsing would otherwise indicate. PR c++/99682 PR c++/121808 gcc/cp/ChangeLog: * module.cc (class module_state): Add comment to 'parent'. (module_state::check_not_purview): Rename to... (module_state::check_circular_import): ...this. Only handle interface dependencies, adjust diagnostic message. (module_state::read_imports): Use new function. Pass location of import as from_loc instead of the module location. (module_state::do_import): Set module_p when importing the primary interface for the current module. (import_module): Split out check for imports in own unit. Remove incorrect assertion. (preprocess_module): Don't overwrite module-decl location with later import. gcc/testsuite/ChangeLog: * g++.dg/modules/circ-1_c.C: Adjust diagnostic. * g++.dg/modules/mod-decl-1.C: Likewise. * g++.dg/modules/mod-decl-2_b.C: Likewise. * g++.dg/modules/pr99174.H: Likewise. * g++.dg/modules/import-3_a.C: New test. * g++.dg/modules/import-3_b.C: New test. * g++.dg/modules/import-3_c.C: New test. * g++.dg/modules/mod-decl-9.C: New test. * g++.dg/modules/part-10_a.C: New test. * g++.dg/modules/part-10_b.C: New test. * g++.dg/modules/part-10_c.C: New test. * g++.dg/modules/part-10_d.C: New test. Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com> Reviewed-by: Jason Merrill <jason@redhat.com>
9 daysc++/modules: Create helper to get current TU's module_stateNathaniel Shead1-19/+27
A lot of places use (*modules)[0] to refer to the module state for the current TU. This is a bit awkward to type and not particularly clear what it represents; make a helper function to clarify it. gcc/cp/ChangeLog: * module.cc (this_module): New function. (import_entity_module): Use it. (trees_out::decl_node): Likewise. (get_module): Likewise. (module_state::check_not_purview): Likewise. (module_state::read_imports): Likewise. (module_state::read_using_directives): Likewise. (module_state::read_initial): Likewise. (get_import_bitmap): Likewise. (module_may_redeclare): Likewise. (direct_import): Likewise. (declare_module): Likewise. (name_pending_imports): Likewise. (preprocess_module): Likewise. (finish_module_processing): Likewise. (late_finish_module): Likewise. Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
9 daystestsuite: Fix UNRESOLVEDs for mistakenly dg-run test [PR121872]Nathaniel Shead1-1/+2
PR testsuite/121872 gcc/testsuite/ChangeLog: * g++.dg/modules/default-arg-4_b.C: Change run to compile. Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
10 daysFortran: fix bootstrap with -Werror=maybe-uninitializedHarald Anlauf1-2/+3
gcc/fortran/ChangeLog: * trans-intrinsic.cc (conv_intrinsic_fstat_lstat_stat_sub): Init some variables.
10 daysc++: non-dep cmp op rewritten from <=> returning int [PR121779]Patrick Palka3-5/+55
Apparently an explicitly defined operator<=> isn't required to return std::foo_ordering, so build_min_non_dep_op_overload needs to be able to rebuild forms of (x <=> y) @ 0 where the @ resolved to a built-in and in turn isn't expressed as a function call. PR c++/121779 gcc/cp/ChangeLog: * tree.cc (build_min_non_dep_op_overload): Handle comparison operator expressions rewritten from a <=> that returns a non-class type. gcc/testsuite/ChangeLog: * g++.dg/lookup/operator-8.C: Remove outdated comment about this test failing. * g++.dg/lookup/operator-8a.C: New test. Reviewed-by: Jason Merrill <jason@redhat.com>
10 daysamdgcn: fix GFX10/GFX11 VGPR countsAndrew Stubbs2-21/+17
The previous definition had all the GFX11 register counts doubled to fix a bug that was encountered in early testing. This seems to have been a misunderstanding of the problem (which is no longer reproducible). gcc/ChangeLog: * config/gcn/gcn-devices.def: Correct the Max ISA VGPRs counts for GFX10 and GFX11 devices. * config/gcn/gcn.cc (gcn_hsa_declare_function_name): Remove the wave64 VGPR count fudge.
10 daysamdgcn: fix builtin codegen at -O0Andrew Stubbs1-1/+25
Fix an unrecognised insn ICE that only shows while using builtins at -O0. gcc/ChangeLog: * config/gcn/gcn.cc (gcn_expand_builtin_1): Enable the "mode" parameter and ensure that "target" is a register for most of the builtins.
10 daysFortran: make STAT/LSTAT/FSTAT intrinsics generic [PR82480]Harald Anlauf8-38/+352
PR fortran/82480 gcc/fortran/ChangeLog: * check.cc (error_unsupported_kind): Helper function to report an unsupported kind of an argument. (check_minrange4): Helper function to report if an integer variable does not have a decimal range of at least four. (gfc_check_fstat): Adjust checks for generalization of instrinsic function FSTAT. (gfc_check_fstat_sub): Likewise for subroutine FSTAT. (gfc_check_stat): Likewise for functio STAT. (gfc_check_stat_sub): Likewise for subroutine STAT. * intrinsic.texi: Document generalized versions of intrinsics STAT/LSTAT/FSTAT. * iresolve.cc (gfc_resolve_stat): STAT function result shall have the same kind as the VALUES argument. (gfc_resolve_lstat): Likewise for LSTAT. (gfc_resolve_fstat): Likewise for FSTAT. (gfc_resolve_stat_sub): Resolve proper library subroutine for STAT. (gfc_resolve_lstat_sub): Likewise for LSTAT. * trans-decl.cc (gfc_build_intrinsic_function_decls): Declare fndecls for required subroutines in runtine library. * trans-intrinsic.cc (conv_intrinsic_fstat_lstat_stat_sub): Emit runtime wrapper code for the library functions, taking care of possible kind conversion of the optional STATUS argument of the subroutine versions of the intrinsics. (gfc_conv_intrinsic_subroutine): Use it. * trans.h (GTY): Declare prototypes. gcc/testsuite/ChangeLog: * gfortran.dg/stat_3.f90: Extend argument checking. * gfortran.dg/stat_4.f90: New test.
10 daysctf: fix integer truncations in very large structs [PR121411]David Faust2-18/+48
DWARF to CTF translation for type bit sizes was using uint32_t, and for member offsets was inadvertently using unsigned int via get_AT_unsigned. For very large struct types, at least one of these could be truncated causing incorrect encoding of the struct type and member offsets. Use HOST_WIDE_INT to avoid these truncation issues and fix the encoding for large structs. PR debug/121411 gcc/ * dwarf2ctf.cc (ctf_get_AT_data_member_location) Use AT_unsigned when fetching AT_bit_offset and AT_data_member_location. Simplify. (ctf_die_bitsize): Return unsigned HOST_WIDE_INT instead of uint32_t. (gen_ctf_base_type, gen_ctf_sou_type, gen_ctf_enumeration_type): Adapt accordingly. gcc/testsuite/ * gcc.dg/debug/ctf/ctf-struct-3.c: New test.
10 daysRISC-V: Add pattern for vector-scalar dual widening floating-point subPaul-Antoine Arras13-8/+79
This pattern enables the combine pass (or late-combine, depending on the case) to merge a float_extend'ed vec_duplicate into a minus RTL instruction. Both minus operands are widened. Before this patch, we have six instructions, e.g.: fcvt.d.s fa0,fa0 vsetvli a5,zero,e64,m1,ta,ma vfmv.v.f v3,fa0 vfwcvt.f.f.v v1,v2 vsetvli zero,zero,e64,m1,ta,ma vfsub.vv v1,v1,v3 After, we get only one: vfwsub.vf v1,v2,fa0 gcc/ChangeLog: * config/riscv/autovec-opt.md (*vfwsub_vf_<mode>): New pattern to combine float_extend + vec_duplicate + vfwsub.vv into vfwsub.vf. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/vx_vf/vf-1-f16.c: Add vfwsub.vf. * gcc.target/riscv/rvv/autovec/vx_vf/vf-1-f32.c: Likewise. * gcc.target/riscv/rvv/autovec/vx_vf/vf-2-f16.c: Likewise. * gcc.target/riscv/rvv/autovec/vx_vf/vf-2-f32.c: Likewise. * gcc.target/riscv/rvv/autovec/vx_vf/vf-3-f16.c: Likewise. * gcc.target/riscv/rvv/autovec/vx_vf/vf-3-f32.c: Likewise. * gcc.target/riscv/rvv/autovec/vx_vf/vf-4-f16.c: Likewise. * gcc.target/riscv/rvv/autovec/vx_vf/vf-4-f32.c: Likewise. * gcc.target/riscv/rvv/autovec/vx_vf/vf_binop.h (DEF_VF_BINOP_WIDEN_CASE_0, DEF_VF_BINOP_WIDEN_CASE_1): Swap operands. * gcc.target/riscv/rvv/autovec/vx_vf/vf_binop_widen_run.h: Likewise. * gcc.target/riscv/rvv/autovec/vx_vf/vf_vfwsub-run-1-f16.c: New test. * gcc.target/riscv/rvv/autovec/vx_vf/vf_vfwsub-run-1-f32.c: New test.
10 daysc, c++: Allow &__real__ static_var in constant expressions [PR121678]Jakub Jelinek3-0/+18
When looking at constexpr references, I've noticed staticp handles COMPONENT_REFs and ARRAY_REFs (the latter if the index is INTEGER_CST), but not {REAL,IMAG}PART_EXPR. I think that is incorrect and causes rejection of constexpr (for C++) or static const (for C) addresses of __real__ or __imag__ parts of static vars. 2025-09-09 Jakub Jelinek <jakub@redhat.com> PR c++/121678 * tree.cc (staticp): Handle REALPART_EXPR and IMAGPART_EXPR. * g++.dg/ext/pr121678.C: New test. * gcc.dg/pr121678.c: New test.
10 daysdoc: Adjust -Wextra description for -Wunterminated-string-initializationJonathan Wakely1-1/+1
Say that -Wunterminated-string-initialization is for C and ObjC only when it appears in the -Wextra documentation. gcc/ChangeLog: * doc/invoke.texi (Warning Options): Note that an option enabled by -Wextra is for C and ObjC only.
10 daysRISC-V: Add pattern for vector-scalar single widening floating-point addPaul-Antoine Arras14-9/+115
This pattern enables the combine pass (or late-combine, depending on the case) to merge a float_extend'ed vec_duplicate into a plus RTL instruction. The other plus operand is already wide. Before this patch, we have four instructions, e.g.: fcvt.d.s fa0,fa0 vsetvli a5,zero,e64,m1,ta,ma vfmv.v.f v2,fa0 vfadd.vv v1,v1,v2 After, we get only one: vfwadd.wf v1,v1,fa0 gcc/ChangeLog: * config/riscv/autovec-opt.md (*vfwadd_wf_<mode>): New pattern to combine float_extend + vec_duplicate + vfadd.vv into vfwadd.wf. * config/riscv/vector.md (@pred_single_widen_<plus_minus:optab><mode>_scalar): Swap and reorder operands to match the RTL emitted by expand. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/vx_vf/vf-1-f16.c: Add vfwadd.wf. * gcc.target/riscv/rvv/autovec/vx_vf/vf-1-f32.c: Likewise. * gcc.target/riscv/rvv/autovec/vx_vf/vf-2-f16.c: Likewise. * gcc.target/riscv/rvv/autovec/vx_vf/vf-2-f32.c: Likewise. * gcc.target/riscv/rvv/autovec/vx_vf/vf-3-f16.c: Likewise. * gcc.target/riscv/rvv/autovec/vx_vf/vf-3-f32.c: Likewise. * gcc.target/riscv/rvv/autovec/vx_vf/vf-4-f16.c: Likewise. * gcc.target/riscv/rvv/autovec/vx_vf/vf-4-f32.c: Likewise. * gcc.target/riscv/rvv/autovec/vx_vf/vf_binop.h: Add support for single widening variants. * gcc.target/riscv/rvv/autovec/vx_vf/vf_binop_widen_run.h: Add support for single widening variants. * gcc.target/riscv/rvv/autovec/vx_vf/vf_vfwadd-run-2-f16.c: New test. * gcc.target/riscv/rvv/autovec/vx_vf/vf_vfwadd-run-2-f32.c: New test.
10 daysRevert "aarch64: Handle DImode BCAX operations"Kyrylo Tkachov2-34/+1
This reverts commit 1b7bcac0327ccd84f1966c748f4d1aedef64a9c5. PR target/121785 gcc/ * config/aarch64/aarch64-simd.md (*bcaxqdi4): Delete. gcc/testsuite/ * gcc.target/aarch64/simd/bcax_d.c: Remove tests for DImode arguments.
10 daysRevert "tree-optimization/121829 - bogus CFG with asm goto"Tamar Christina2-39/+15
This reverts commit a632becefad29206a980cc080eee74ed808f9cd3.
10 daysada: Warning for composite equality that calls an abstract equality functionGary Dismukes1-0/+39
When equality is tested for a composite type that has any record components whose type has an abstract equality function that will be called as part of the enclosing type's equality, Program_Error will be raised. We now issue a warning on the equality test, mentioning the component type whose abstract equality function will trigger the exception. Note that this is currently only done for top-level components of the composite type. Another limitation is that the warning is not issued when the outer composite type is tagged. gcc/ada/ChangeLog: * exp_ch4.adb (Expand_N_Op_Eq): Check for warning about call to the abstract equality function of a component type, for both array and record enclosing types. (Warn_On_Abstract_Equality_For_Component): New procedure to issue a warning when an abstract equality function of a component type will be called and result in Program_Error.
10 daysada: Fix spurious warning for procedure named "Continue"Ronan Desplanques1-3/+8
The recent addition of a language extension for the "continue" nonreserved keyword caused spurious warnings about unreferenced subprograms for procedures named "Continue", because the call statements that are generated when identifiers are determined not to refer to the keyword were considered to come from expansion. This patch fixes this by marking those generated calls as coming from source instead. gcc/ada/ChangeLog: * sem_ch5.adb (Make_Call): Mark generated nodes as coming from source.
10 daysada: Remove incorrect commentRonan Desplanques1-5/+1
gcc/ada/ChangeLog: * sem_ch3.adb (Analyze_Incomplete_Type_Decl): Remove incorrect comment.
10 daysada: Ignore Ghost policy checks for some pragmasViljar Indus2-6/+58
Some pragmas where the ghostness is based on the argument of the pragma triggered ghost policy errors because we had not marked the pragmas as ghost. However we could only do so once the argument of the pragma was analyzed. We can safely ignore the policy checks for those pragmas since if the argument was ghost then the pragma also had to be ghost. Marking the pragma afterwards as ghost is only for the cleanup of ignored ghost purposes. gcc/ada/ChangeLog: * ghost.adb (Is_OK_Pragma): Use the Suppressed_Ghost_Policy_Check_Pragma list for ignoring certain pragmas. * sem_prag.ads (Suppressed_Ghost_Policy_Check_Pragma): New variable to store the pragmas that could be ignored when checking for consitant ghost policy.
10 daysada: Platform-specific import for read() and write()Tonu Naks5-4/+130
read() and write() return int on windows, whereas on Posix systems the return type is ssize_t (effectively long_int). The object file was added to GNAT_ADA_OBJS only, although the unit is also in the compilation closure of GNATbind, but this was harmless because the object file was essentially empty; that is no longer the case. gcc/ada/ChangeLog: * libgnat/s-crtl.ads (read, write): remove import * libgnat/s-crtl__mingw.adb: body for windows * libgnat/s-crtl.adb: body for all the other targets * Makefile.rtl: configure s-crtl.adb/libgnat/s-crtl__mingw.adb * gcc-interface/Make-lang.in (GNAT_ADA_OBJS): Alphabetize. (GNATBIND_OBJS): Add ada/libgnat/s-crtl.o. Co-authored-by: Eric Botcazou <ebotcazou@adacore.com>
10 daysada: Update the uses of Is_Ignored*_In_CodegenViljar Indus20-45/+96
Replace calls to Is_Ignored_Ghost_Entity and Predicates_Ignored with their In_Codegen versions in places where we would analyze those nodes differently from checked nodes. Describe the motive and use cases for those In_Codegen functions. gcc/ada/ChangeLog: * contracts.adb: Use the In_Codegen function instead. * exp_ch3.adb: Likewise. * exp_ch5.adb: Likewise. * exp_ch6.adb: Likewise. * exp_ch7.adb: Likewise. * exp_ch9.adb: Likewise. * exp_disp.adb: Likewise. * exp_util.adb: Likewise. * freeze.adb: Likewise. * ghost.adb: Likewise. * inline.adb: Likewise. * repinfo.adb: Likewise. * sem_ch10.adb: Likewise. * sem_ch13.adb: Likewise. * sem_ch3.adb: Likewise. * sem_ch6.adb: Likewise. * sem_elab.adb: Likewise. * sem_res.adb: Likewise. * sem_util.adb (Predicates_Ignored_In_Codegen): Add new function for the Predicates_Ignored property. (Predicates_Enabled): Use Predicates_Ignored_In_Codegen instead. * sem_util.ads (Predicates_Ignored_In_Codegen): New function. (Is_Ignored_In_Codegen): Add documentation on how _In_Codegen functions should be used.
10 daysada: Improve comments in Copy_And_SwapRonan Desplanques1-10/+13
This patch replaces usages of "attribute" with the more appropriate "field" when referring to Gen_IL fields, to avoid confusion with Ada's concept of attributes. This patch also makes comments more explicit about Gen_IL IDs and slots around a call to the low-level Atree.Exchange_Entities, and makes a few other minor comment changes. gcc/ada/ChangeLog: * sem_ch3.adb (Copy_And_Swap): Improve comments.
10 daysada: Spurious error on generalized prefix notationJavier Miranda1-2/+5
The compiler reports a spurious error when a primitive function of an untagged type that returns an array type is invoked using the prefix notation, and the sources are compiled with language extensions enabled. gcc/ada/ChangeLog: * sem_util.adb (Needs_One_Actual): Add support for untagged record types when the sources are compiled with Core Extensions allowed.
10 daysada: Fix comment in Find_Type_NameRonan Desplanques1-3/+5
The comment this patch changes was made incorrect by the possibility of completing an incomplete view with a private type declaration in Ada 2012. To avoid any possible confusion, this patch brings the comment up to date. gcc/ada/ChangeLog: * sem_ch3.adb (Find_Type_Name): Fix comment.
10 daysada: Remove unnecessary if statementRonan Desplanques1-14/+4
Calling Check_Nonoverridable_Aspects only makes sense when the full type declaration being analyzed is the completion of a partial view, and the one call site of this procedure ensures this. Therefore the handling of all the possible cases of completion in the procedure that this patch removes was useless. gcc/ada/ChangeLog: * sem_ch3.adb (Check_Nonoverridable_Aspects): Remove if statement.
10 daysada: Improve documentation commentRonan Desplanques1-2/+4
The new version of the comment makes it clearer that Check_Nonoverridable_Aspects is only concerned with cases where a partial view is present. This patch also fixes a reference to an ARM clause in the comment. gcc/ada/ChangeLog: * sem_ch3.adb (Check_Nonoverridable_Aspects): Improve documentation comment.
10 daysada: Add location info to policy difference errorsViljar Indus1-8/+10
gcc/ada/ChangeLog: * ghost.adb (Check_Ghost_Completion): Add location info to the policy messages. (Check_Ghost_Policy): Likwise.
10 daysada: Adding support to defer the addition of extra formals (part 2)Javier Miranda7-30/+56
Adjust previous patch to improve the support for AI05-0151-1/08. gcc/ada/ChangeLog: * exp_attr.adb (Rewrite_Attribute_Proc_Call): Add new parameter to calls to Create_Extra_Formals. (Expand_N_Attribute_Reference): Ditto. * exp_ch3.adb (Expand_Freeze_Record_Type): Ditto. * exp_ch6.adb (Expand_Call_Helper): Ditto. * exp_disp.adb (Expand_Dispatching_Call): Ditto. * freeze.adb (Check_Itype): Ditto. (Freeze_Expression): Ditto. * sem_ch6.adb (Analyze_Subprogram_Body_Helper): Ditto. (Create_Extra_Formals): Add new formal, and use it to determine if the creation of the extra formals can be deferred. Add the new parameter to calls to Create_Extra_Formals. (Is_Unsupported_Extra_Actuals_Call): Adjust the code to improve its performance when the result is known. (Is_Unsupported_Extra_Formals_Entity): Ditto. Add new formal * sem_ch6.ads (Create_Extra_Formals): Add new formal. (Is_Unsupported_Extra_Formals_Entity): Ditto.
10 daysada: Improve error message in the case of missing indicesViljar Indus1-2/+22
When both a missing index and an out of bounds error are present then we should also mention the error on out of bounds index as it suggests removing the index that is out of bounds rather than suggesting adding indices that are also out of bounds. gcc/ada/ChangeLog: * sem_aggr.adb (Resolve_Array_Aggregate): Indicate an out of bounds index error also in the case of a missing index.
10 daysada: Create a pragma to emit a misplaced Storage_Size aspect errorViljar Indus1-2/+16
We do not emit an error on misplaced Strorage_Size error when the aspect is not applied to a task (or an access type). We instead create an attribute definition which is ignored most of the time. Create a temporary pragma for the aspect specification to emit the same misplaced aspect error as we do for pragmas. gcc/ada/ChangeLog: * sem_ch13.adb (Analyze_Aspect_Definitions): Create a temporary pragma for the non-task and access type cases.
10 daysada: Remove useless statementsRonan Desplanques1-3/+0
The initial value of fields of type Elist_Id is No_Elist, therefore the statements this patch removes were useless. gcc/ada/ChangeLog: * sem_ch7.adb (New_Private_Type): Remove useless statements.
10 daysada: Replace Preelaborable_Initialization pragmas with equivalent aspect specsDenis Mazzucato86-231/+231
All Preelaborable_Initialization pragmas in the language-defined units are replaced by the equivalent Preelaborable_Initialization aspect. gcc/ada/ChangeLog: * targparm.adb (Get_Target_Parameters): Address type declaration doesn't ends anymore with a semicolon. * libgnat/a-cdlili.ads: Replace Preelaborable_Initialization. * libgnat/a-cidlli.ads: Likewise. * libgnat/a-cihama.ads: Likewise. * libgnat/a-cihase.ads: Likewise. * libgnat/a-cimutr.ads: Likewise. * libgnat/a-ciorma.ads: Likewise. * libgnat/a-ciormu.ads: Likewise. * libgnat/a-ciorse.ads: Likewise. * libgnat/a-cohama.ads: Likewise. * libgnat/a-cohase.ads: Likewise. * libgnat/a-coinho.ads: Likewise. * libgnat/a-coinho__shared.ads: Likewise. * libgnat/a-coinve.ads: Likewise. * libgnat/a-comutr.ads: Likewise. * libgnat/a-convec.ads: Likewise. * libgnat/a-coorma.ads: Likewise. * libgnat/a-coormu.ads: Likewise. * libgnat/a-coorse.ads: Likewise. * libgnat/a-crdlli.ads: Likewise. * libgnat/a-except.ads: Likewise. * libgnat/a-finali.ads: Likewise. * libgnat/a-ngcoty.ads: Likewise. * libgnat/a-strbou.ads: Likewise. * libgnat/a-stream.ads: Likewise. * libgnat/a-strmap.ads: Likewise. * libgnat/a-strunb.ads: Likewise. * libgnat/a-strunb__shared.ads: Likewise. * libgnat/a-ststio.ads: Likewise. * libgnat/a-stwibo.ads: Likewise. * libgnat/a-stwima.ads: Likewise. * libgnat/a-stwiun.ads: Likewise. * libgnat/a-stwiun__shared.ads: Likewise. * libgnat/a-stzbou.ads: Likewise. * libgnat/a-stzmap.ads: Likewise. * libgnat/a-stzunb.ads: Likewise. * libgnat/a-stzunb__shared.ads: Likewise. * libgnat/a-tags.ads: Likewise. * libgnat/i-cstrin.ads: Likewise. * libgnat/s-stopoo.ads: Likewise. * libgnat/s-stposu.ads: Likewise. * libgnat/system-aix.ads: Likewise. * libgnat/system-darwin-arm.ads: Likewise. * libgnat/system-darwin-ppc.ads: Likewise. * libgnat/system-darwin-x86.ads: Likewise. * libgnat/system-djgpp.ads: Likewise. * libgnat/system-dragonfly-x86_64.ads: Likewise. * libgnat/system-freebsd.ads: Likewise. * libgnat/system-gnu.ads: Likewise. * libgnat/system-hpux-ia64.ads: Likewise. * libgnat/system-hpux.ads: Likewise. * libgnat/system-linux-alpha.ads: Likewise. * libgnat/system-linux-arm.ads: Likewise. * libgnat/system-linux-hppa.ads: Likewise. * libgnat/system-linux-ia64.ads: Likewise. * libgnat/system-linux-loongarch.ads: Likewise. * libgnat/system-linux-m68k.ads: Likewise. * libgnat/system-linux-mips.ads: Likewise. * libgnat/system-linux-ppc.ads: Likewise. * libgnat/system-linux-riscv.ads: Likewise. * libgnat/system-linux-s390.ads: Likewise. * libgnat/system-linux-sh4.ads: Likewise. * libgnat/system-linux-sparc.ads: Likewise. * libgnat/system-linux-x86.ads: Likewise. * libgnat/system-lynxos178-ppc.ads: Likewise. * libgnat/system-lynxos178-x86.ads: Likewise. * libgnat/system-mingw.ads: Likewise. * libgnat/system-qnx-arm.ads: Likewise. * libgnat/system-rtems.ads: Likewise. * libgnat/system-solaris-sparc.ads: Likewise. * libgnat/system-solaris-x86.ads: Likewise. * libgnat/system-vxworks-ppc-kernel.ads: Likewise. * libgnat/system-vxworks-ppc-rtp-smp.ads: Likewise. * libgnat/system-vxworks-ppc-rtp.ads: Likewise. * libgnat/system-vxworks7-aarch64-rtp-smp.ads: Likewise. * libgnat/system-vxworks7-aarch64.ads: Likewise. * libgnat/system-vxworks7-arm-rtp-smp.ads: Likewise. * libgnat/system-vxworks7-arm.ads: Likewise. * libgnat/system-vxworks7-ppc-kernel.ads: Likewise. * libgnat/system-vxworks7-ppc-rtp-smp.ads: Likewise. * libgnat/system-vxworks7-ppc64-kernel.ads: Likewise. * libgnat/system-vxworks7-ppc64-rtp-smp.ads: Likewise. * libgnat/system-vxworks7-x86-kernel.ads: Likewise. * libgnat/system-vxworks7-x86-rtp-smp.ads: Likewise. * libgnat/system-vxworks7-x86_64-kernel.ads: Likewise. * libgnat/system-vxworks7-x86_64-rtp-smp.ads: Likewise.
10 daysada: Typo fix in commentMarc Poulhiès1-1/+1
gcc/ada/ChangeLog: * s-pack.adb.tmpl: Typo fix in comment.
10 daysada: Avoid marking a ghost pragma twiceViljar Indus1-6/+6
Previously all assertion level pragmas were marked based on the current scope. Additionally some pragmas were marked afterwards based on the relevant entity e.g. Pre. This would lead to cases where a pragma was marked as both ignored and checked ghost pragma. Each pragma should get marked only once based on their individual semantics. gcc/ada/ChangeLog: * sem_prag.adb (Analyze_Pragma): Set Mark_Ghost_Code individually based on the semantics of each pragma.
10 daysada: Avoid renamed declaration becoming both ignored and checkedViljar Indus1-4/+33
gcc/ada/ChangeLog: * ghost.adb (Mark_Ghost_Declaration_Or_Body): Mark ghost entity explicitly as ignored or checked.
10 daysada: The policy of a generic can be different within a instantiationViljar Indus1-2/+4
gcc/ada/ChangeLog: * ghost.adb (Check_Ghost_Policy): ignore ghost policy changes within instantiation statements.
10 daysada: Fix ghost policy change detection for procedure callsViljar Indus1-3/+10
gcc/ada/ChangeLog: * ghost.adb (Check_Ghost_Policy): Use the policy in affect for the identifier at the current moment instead of the region around it when checking a policy change for a procedure call.
10 daysada: Fix ghost policy detection for declarationsViljar Indus1-33/+20
Declarations should take the ghost policy from the region if they do not have an explicit ghost aspect/pragam themselves. gcc/ada/ChangeLog: * ghost.adb (Mark_And_Set_Ghost_Declaration): apply the ghost policy and level from the declaration only if the declaration has an explicit ghost aspect/pragma.
10 daysada: Fix inheritance of Is_Primitive and legality check for nonoverridable ↵Denis Mazzucato2-14/+230
aspects This patch fixes the identification of inherited subprograms as primitive operations via the Is_Primitive flag. This is essential in the context of the new legality check which makes sure that, if any subprogram denoted by a nonoverridable aspect of a type T with formal or return of either type T or access T, then all denoted subprograms should be primitive operations. Note that all valid interpretations of a subprogram are denoted by the aspect under evaluation, all of these needs to be primitive then. This is a respin of eng/toolchain/gnat!2039 gcc/ada/ChangeLog: * sem_ch13.adb (Check_Nonoverridable_Aspect_Subprograms): Add the new legality check in Check_Nonoverridable_Aspect_Subprograms for nonoverridable aspects to check whether the denoted subprograms satisfy MR 13.1.1(18.4/6), otherwise we emit an error. Fix spacing. * sem_ch6.adb (New_Overloaded_Entity): Set Is_Primitive flag for inherited primitives, and filter out homonym candidates without a function specification as parents.
10 daysada: Reject pragma Attach_Handler on procedures in protected bodiesPiotr Trojanek1-2/+4
Pragma Attach_Handler and Interrupt_Handler are only legal for procedures declared in protected definition. When given for procedures declared in protected body, they were wrongly accepted and triggered an odd error message from expansion. gcc/ada/ChangeLog: * sem_prag.adb (Check_Interrupt_Or_Attach_Handler): Refine test for protected procedures; fix typo in comment.
10 daysada: Avoid performing policy checks on ignored ghost pragmasViljar Indus1-0/+7
These pragamas are already disabled if the relative ghost entity is disabled. gcc/ada/ChangeLog: * ghost.adb (Is_OK_Pragma): mark the context of ignored ghost pragmas as OK.
10 daysada: Fix resolution of assertion levelsViljar Indus2-26/+9
Unsuccessful preanalyze_and_resolve still marks identifiers as Any_Id. Override that result if an identifier matched an assertion level. gcc/ada/ChangeLog: * ghost.adb (Assertion_Level_From_Arg): Ensure that assertion level is stored as the entity for its reference. (Enables_Ghostness): Derive the result from whether or not the an argument indicated an assertion level. * tbuild.adb (Make_Assertion_Level): ensure that assertion levels have a standard scope.
10 daysada: Check restriction No_Secondary_Stack for overflow eliminationPiotr Trojanek1-0/+2
When overflow checks are eliminated using System.Bignums package, we must check if secondary stack that is necessary for this package is available. gcc/ada/ChangeLog: * checks.adb (Make_Bignum_Block): Check restriction No_Secondary_Stack.
10 daysada: Add special handling for Runtime and Static in Policy_In_EffectViljar Indus1-4/+15
When one of those levels is present then we should not look for the policy in the policy stack but rather determine the policy immidiately like we do in Check_Applicable_Policy. gcc/ada/ChangeLog: * sem_util.adb (Policy_In_Effect): Add special handling for Runtime and Static values.
10 daysada: Fix crash with global No_Tasking and async delaysDenis Mazzucato2-6/+4
When optimizations are enabled, the runtime for delays is inlined and expanded. If No_Tasking is set globally, for instance via a configuration file, then the initialization of _Master, _Chain, and _Task_Name formals is skipped for task entities. Later during expansion, these identifiers are expected but won't be found, crashing the compiler. This patch fixes Init_Formals by removing the check on Global_No_Tasking. If a No_Tasking restriction applies, then a violation error will be raised when analyzing the task type. gcc/ada/ChangeLog: * exp_ch3.adb (Init_Formals): Remove the check on Global_No_Tasking. * sem.adb: Fix typo.
10 daysada: Compiler crash on container aggregate with constant element choiceGary Dismukes1-4/+2
The compiler fails when compiling a container aggregate with an element association with a key choice that denotes a constant object. The code for getting the value of the choice was only accounting for the possibility of integer and enumeration literals, and is corrected to handle static expressions generally. gcc/ada/ChangeLog: * exp_aggr.adb (Build_Container_Aggr_Code.To_Int): Replace existing conditional expression with call to Expr_Value.
10 daysada: Add default assertion level for assertionsViljar Indus2-0/+4
To standardize the comparisson between the levels of ghost entities and levels of assertion pragmasTo standardize the comparisson between the levels of ghost entities and levels of assertion pragmas. gcc/ada/ChangeLog: * sem_ch13.adb (Analyze_Aspect_Specifications): add default assertion level to assertion aspects. * sem_prag.adb (Analyze_Pragma): Likewise.
10 daysada: exp_ch6.adb: perform less checks in CodePeer_ModeGhjuvan Lacambre1-11/+18
As explained in the comments, the CodePeer_Mode AST isn't well-formed for a GCC back-end, but is fine for a CodePeer one. The checks ensuring that the AST is well-formed thus need to be disabled. gcc/ada/ChangeLog: * exp_ch6.adb (Check_BIP_Actuals, Process_Node): Disable checks.
10 daysada: Unsigned_Base_Range aspectJavier Miranda29-80/+830
This patch adds support for a new GNAT aspect/pragma for integer type definitions to explicitly enforce the use of an unsigned base type. gcc/ada/ChangeLog: * aspects.ads (Aspect_Unsigned_Base_Range): New aspect. * checks.adb (Determine_Range): Handle types with unsigned base range aspect. (Enable_Overflow_Check): ditto (Apply_Arithmetic_Overflow_Strict): ditto * debug.adb (d_o): Document new usage. * einfo.ads (Has_Unsigned_Base_Range_Aspect): New flag. * exp_attr.adb (Expand_N_Attribute_Reference): No action since it has been already handled at this stage. * exp_ch4.adb (Expand_N_Op_Add): Generate aritmetic overflow check on unsigned base range type operands. (Expand_N_Op_Subtract): ditto (Expand_N_Op_Multiply): ditto (Expand_N_Op_Minus): ditto * gen_il-fields.ads (Has_Unsigned_Base_Range_Aspect): New flag. * gen_il-gen-gen_entities.adb (Has_Unsigned_Base_Range_Aspect): New flag. * gen_il-internals.adb (Has_Unsigned_Base_Range_Aspect): New flag. * gnat1drv.adb (Adjust_Global_Switches): Handle -gnatd_o * par-prag.adb (Pragma_Unsigned_Base_Range): No action since it will be entirely handled by the semantic analyzer. * rtsfind.ads (RE_Id): Add RE_Uns_[Add|Subtract|Multiply]_With_ Ovflo_Check * sem_attr.ads (Attribute_Unsigned_Base_Range): Added to the set of implementation defined attributes. * sem_attr.adb (Analyze_Attribute): Analyze attribute Unsigned_Base_Range. (Eval_Attribute): Evaluate attribute Unsigned_Base_Range. * sem_ch13.adb (Analyze_One_Aspect): Defer checks for this aspect to the analysis of the corresponding pragma. * sem_ch3.ads (Unsigned_Base_Range_Type_Declaration): New subprogram. * sem_ch3.adb (Build_Derived_Numeric_Type): Inherit flag Has_Unsigned_Base_Range_Aspect. (Unsigned_Base_Range_Type_Declaration): New subprogram. (Has_Pragma_Unsigned_Base_Range): New subprogram. * sem_prag.adb (Analyze_Pragma): Handle Pragma_Unsigned_Base_Range. * snames.adb-tmpl (Get_Pragma_Id): Handle Name_Unsigned_Base_Range. (Is_Pragma_Name): ditto. * snames.ads-tmpl (Name_Unsigned_Base_Range): New name. (Attribute_Unsigned_Base_Range): New attribute. (Pragma_Unsigned_Base_Range): New pragma. * libgnat/s-aridou.ads (Add_With_Ovflo_Check): New routine for Double_Uns. (Subtract_With_Ovflo_Check): ditto. (Multiply_With_Ovflo_Check): ditto. * libgnat/s-aridou.adb (Add_With_Ovflo_Check): ditto. (Subtract_With_Ovflo_Check): ditto. (Multiply_With_Ovflo_Check): ditto. * libgnat/s-arit64.ads (Uns_Add_With_Ovflo_Check64): New subprogram. (Uns_Subtract_With_Ovflo_Check64): ditto. (Uns_Multiply_With_Ovflo_Check64): ditto. * libgnat/s-arit64.adb (Uns_Add_With_Ovflo_Check64): New subprogram. (Uns_Subtract_With_Ovflo_Check64): ditto. (Uns_Multiply_With_Ovflo_Check64): ditto. * libgnat/s-arit128.ads (Uns_Add_With_Ovflo_Check128): New subprogram. (Uns_Subtract_With_Ovflo_Check128): ditto. (Uns_Multiply_With_Ovflo_Check128): ditto. * libgnat/s-arit128.adb (Uns_Add_With_Ovflo_Check128): New subprogram. (Uns_Subtract_With_Ovflo_Check128): ditto. (Uns_Multiply_With_Ovflo_Check128): ditto. * doc/gnat_rm/gnat_language_extensions.rst: Document unsigned base range. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.