aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
AgeCommit message (Collapse)AuthorFilesLines
2023-11-28ada: False alarms from -gnatw.t with generic functionsBob Duff1-17/+25
Disable the warnings generated by -gnatw.t on instances. Otherwise, we get false positives. gcc/ada/ * sem_util.adb (Check_Result_And_Post_State): Disable this when we're in an instance. Misc cleanup.
2023-11-28ada: Further cleanup in finalization machineryEric Botcazou4-74/+110
When transient scopes are being materialized, they can give rise to a block created around the construct being wrapped or not, depending on the kind of construct. In both cases finalization actions for the transient objects of the scope are generated the same way, with normal finalization done manually immediately after the construct and exceptional finalization deferred to the enclosing scope by means of a hooking mechanism. Now when the block is generated, it becomes this enclosing scope, so the normal finalization that comes with it would also be done immediately after the construct, even without normal finalization generated manually. Therefore this change gets rid of the manual finalization as well as of the hooking in the cases where the block is generated, leading to a significant streamlining of the expanded code in these cases. This requires fixing a small inaccuracy of the Within_Case_Or_If_Expression predicate, which must only be concerned with the dependent expressions, since those are the only ones to be treated specially by the finalization machinery. It also contains a small cleanup for the description of the transient scope management present at the beginning of the exp_ch7.adb file. gcc/ada/ * exp_ch7.ads (Expand_Cleanup_Actions): Move declaration to the Finalization Management section. * exp_ch7.adb (Transient Scope Management): Move description down to after that of the general finalization and make a few changes. (Insert_Actions_In_Scope_Around): Call Process_Transients_In_Scope only if cleanups are being handled. (Process_Transients_In_Scope): Remove redundant test on Clean. * exp_util.ads (Within_Case_Or_If_Expression): Adjust description. * exp_util.adb (Within_Case_Or_If_Expression): Only return true if within the dependent expressions of the conditional expressions.
2023-11-28ada: Fix incorrect quoting in documentationEric Botcazou2-7/+5
gcc/ada/ * doc/gnat_rm/the_implementation_of_standard_i_o.rst: Fix a couple occurrences of incorrect quoting. * gnat_rm.texi: Regenerate.
2023-11-28ada: Fix premature finalization for nested return within extended oneEric Botcazou1-50/+98
The return object is incorrectly finalized when the nested return is taken, because the special flag attached to the return object is not updated. gcc/ada/ * exp_ch6.adb (Build_Flag_For_Function): New function made up of the code building the special flag for return object present... (Expand_N_Extended_Return_Statement): ...in there. Replace the code with a call to Build_Flag_For_Function. Add assertion for the flag. (Expand_Non_Function_Return): For a nested return, if the return object needs finalization actions, update the special flag.
2023-11-28ada: Add new predicate Is_Address_Compatible_TypeSebastian Poeplau2-0/+7
When emitting code for architectures with tagged pointers, it is useful to be able to recognize values representing addresses because they require special handling. This commits adds the predicate Is_Address_Compatible_Type, which differs from the node attribute Is_Descendant_Of_Address by also taking Standard_Address into account. gcc/ada/ * einfo-utils.ads, einfo-utils.adb (Is_Address_Compatible_Type): New function.
2023-11-28ada: Type error on container aggregate with loop_parameter_specificationGary Dismukes1-2/+8
The compiler incorrectly reported a type error on a container aggregate for a Vector type with a loop_parameter_specification specifying a nonstatic upper bound, complaining that it expected the Vector index type, but instead found type Count_Type. The expansion of the aggregate was incorrectly passing a size temporary of type Count_Type to the function associated with the New_Indexed part of the container type's Aggregate aspect (New_Vector in the case of Vectors), which has two formals of the container index type. The fix is to convert the size temporary to the expected index type. gcc/ada/ * exp_aggr.adb (Expand_Container_Aggregate): Apply a conversion to the size temp object passed as the second actual parameter on the call to the New_Indexed_Subp function, to convert it to the index type of the container type (taken from the first formal parameter of the function).
2023-11-28ada: Fix internal error on declare expression in expression functionEric Botcazou2-2/+23
When the expression function is not a completion, its (return) expression does not cause freezing so analyzing the declare expression in this context must not freeze the type of the object. The change also contains another fix, which makes it so that the compiler does not evaluate a nonstatic representation attribute of a scalar subtype in the same context if the subtype is not already frozen. gcc/ada/ * sem_attr.adb (Eval_Attribute): Do not proceed in a spec expression for nonstatic representation attributes of a scalar subtype when the subtype is not frozen. * sem_ch3.adb (Analyze_Object_Declaration): Do not freeze the type of the object in a spec expression.
2023-11-28ada: Handle unchecked conversion in boundRichard Kenner1-1/+3
Look through both unchecked and normal conversions when seeing if any part of a bound is uplevel. gcc/ada/ * exp_unst.adb (Note_Uplevel_Bound): Treat N_Unchecked_Type_Conversion like N_Type_Conversion.
2023-11-28ada: Remove dependency on System.Val_Bool in System.Img_BoolYannick Moy4-37/+40
In order to facilitate the certification of System.Img_Bool, remove its dependency on unit System.Val_Bool. Modify the definition of ghost function Is_Boolean_Image_Ghost to take the expected boolean value and move it to System.Val_Spec. gcc/ada/ * libgnat/s-imgboo.adb: Remove with_clause now in spec file. * libgnat/s-imgboo.ads: Remove dependency on System.Val_Bool. (Image_Boolean): Replace call to Value_Boolean by passing value V to updated ghost function Is_Boolean_Image_Ghost. * libgnat/s-valboo.ads (Is_Boolean_Image_Ghost): Move to other unit. (Value_Boolean.): Update precondition. * libgnat/s-valspe.ads (Is_Boolean_Image_Ghost): Move here. Add new parameter for expected boolean value.
2023-11-28ada: Fix predicate failure that occurred in a test caseTucker Taft1-0/+1
The CodePeer test case illustrating a problem where a "high" precondition failure was expected, died in the GNAT FE on input_reading.adb. The problem was in Check_SCIL, where it didn't properly handle a discriminant_specification. gcc/ada/ * sem_scil.adb: Handle discriminant specification.
2023-11-22Daily bump.GCC Administrator1-0/+187
2023-11-21ada: Fix miscompilation of loop over boolean rangeEric Botcazou1-2/+6
The optimized form generated in this case turns out to be problematic. gcc/ada/ * gcc-interface/trans.cc (Loop_Statement_to_gnu): Always use the simpler form for a loop with a boolean iteration variable.
2023-11-21ada: Fix issue with indefinite vector of overaligned unconstrained arrayEric Botcazou2-3/+28
The problem is that the aligning machinery is not consistently triggered, depending on whether a constrained view or the nominal unconstrained view of the element type is used to perform the allocations and deallocations. gcc/ada/ * gcc-interface/decl.cc (gnat_to_gnu_entity) <E_Array_Subtype>: Put the alignment directly on the type in the constrained case too. * gcc-interface/utils.cc (maybe_pad_type): For an array type, take the alignment of the element type as the original alignment.
2023-11-21ada: Compiler crash on container aggregate with loop_parameter_specificationsGary Dismukes1-1/+17
The compiler crashes on a container aggregate with more than one iterated_element_association given by a loop_parameter_specification. In such a case, the tree contains N_Iterated_Component_Association nodes rather than N_Iterated_Element_Association nodes, and the code for handling those needs to obtain the bounds from the Discrete_Choices field of each N_Iterated_Component_Association rather than assuming that the association has a normal list of choices. gcc/ada/ * sem_aggr.adb (Resolve_Container_Aggregate): In the case where Comp is an N_Iterated_Component_Association, pick up Discrete_Choices rather than Choices.
2023-11-21ada: Another couple of cleanups in the finalization machineryEric Botcazou2-17/+14
For package specs and bodies that need finalizers, Build_Finalizer is invoked from the Standard scope so it needs to adjust the scope stack before creating new objects; this changes it to do so only once. For other kinds of scopes, it is invoked from Expand_Cleanup_Actions, which assumes that the correct scope is already on the stack; that's why Cleanup_Scopes adjusts the scope stack explicitly, but it should use Pop_Scope instead of End_Scope to do it. gcc/ada/ * exp_ch7.adb (Build_Finalizer): For package specs and bodies, push and pop the specs onto the scope stack only once. * inline.adb (Cleanup_Scopes): Call Pop_Scope instead of End_Scope.
2023-11-21ada: Deep delta aggregates in postconditionsSteve Baird1-1/+4
Fix a bug in handling array-valued deep delta aggregates occurring in postconditions. The bug could result in a spurious compilation failure. gcc/ada/ * sem_aggr.adb (Resolve_Delta_Array_Aggregate): In the case of a deep delta choice, the expected type for the expression will typically not be the component type of the array type, so a call to Analyze_And_Resolve that assumes otherwise would be an error. It turns out that such a call, while wrong, is usually harmless because the expression has already been marked as analyzed. This doesn't work if the aggregate occurs in a postcondition and, in any case, we don't want to rely on this. So do not perform the call in the deep case.
2023-11-21ada: Small consistency fix for -gnatwv warningEric Botcazou1-8/+38
The goal is to arrange for the warning to be issued consistently between objects whose address is taken and objects whose address is not taken. gcc/ada/ * sem_warn.adb (Check_References.Type_OK_For_No_Value_Assigned): New predicate. (Check_References): For Warn_On_No_Value_Assigned, use the same test on the type in the address-not-taken and default cases. gcc/testsuite/ChangeLog: * gnat.dg/warn25.adb: Add xfail.
2023-11-21ada: Compiler error reporting illegal prefix on legal loop iterator with "in"Gary Dismukes4-24/+82
During semantic analysis, the compiler fails to determine the cursor type in the case of a generalized iterator loop with "in", in the case where the iterator type has a parent type that is a controlled type (for example) and its ancestor iterator interface type is given after as a progenitor. It also improperly determines the ancestor interface type during expansion (within Expand_Iterator_Loop_Over_Container), for both "in" and "of" iterator forms. The FE was assuming that the iterator interface is simply the parent type of the iterator type, but that type can occur later in the interface list, or be inherited. A new function is added that properly locates a type's iterator interface ancestor, if any, and is called for analysis and expansion. gcc/ada/ * exp_ch5.adb (Expand_Iterator_Loop_Over_Container): Retrieve the iteration type's iteration interface progenitor via Iterator_Interface_Ancestor, in the case of both "in" and "of" iterators. Narrow the scope of Pack, so it's declared and initialized only within the code related to "of" iterators, and change its name to Cont_Type_Pack. Adjust comments. * sem_ch5.adb (Get_Cursor_Type): In the case of a derived type, retrieve the iteration type's iterator interface progenitor (if it exists) via Iterator_Interface_Ancestor rather than assuming that the parent type is the interface progenitor. * sem_util.ads (Iterator_Interface_Ancestor): New function. * sem_util.adb (Iterator_Interface_Ancestor): New function returning a type's associated iterator interface type, if any, by collecting and traversing the type's interfaces.
2023-11-21ada: Fix internal error on 'Address of task componentEric Botcazou1-8/+2
This happens when the prefix of the selected component is of an access type, i.e. there is an implicit dereference. because the prefix is not resolved. gcc/ada/ * sem_attr.adb (Resolve_Attribute) <Attribute_Address>: Remove the bypass for prefixes with task type.
2023-11-21ada: Avoid Style_Checks pragmas affecting other unitsViljar Indus1-0/+17
gcc/ada/ * par.adb: Restore Style_Checks after parsing each unit.
2023-11-21ada: Fix type for SPARK expansion on deep delta aggregatesYannick Moy1-1/+1
gcc/ada/ * exp_spark.adb (Expand_SPARK_Delta_Or_Aggregate): Fix type.
2023-11-21ada: Further cleanup in finalization machineryEric Botcazou1-4/+1
The bodies of generic units are instantiated separately by GNAT at the end of the processing of the compilation unit. This requires the deferral of the generation of cleanups and finalization actions in enclosing scopes, except for instantiations in generic units where they are not generated. The criterion used to detect this latter case is Inside_A_Generic, but this global variable is not properly updated during the instantiation of generic bodies, leading to problems with nested instantiations, so it is changed to Expander_Active instead. As a matter of fact, the exact same idiom is used a few lines above to clear the Needs_Body variable. gcc/ada/ * sem_ch12.adb (Analyze_Package_Instantiation): Test Expander_Active to detect generic contexts for the generation of cleanup actions.
2023-11-21ada: Fix string indexing within GNAT.Calendar.Time_IO.ValueJustin Squirek1-2/+2
The patch fixes an issue in the compiler whereby calls to GNAT.Calendar.Time_IO.Value where the actual for formal String Date with indexing starting at any value besides one would result in a spurious runtime exception. gcc/ada/ * libgnat/g-catiio.adb (Value): Modify conditionals to use 'Last instead of 'Length
2023-11-21ada: Small improvement to Null_Status functionEric Botcazou1-1/+1
The function is used to optimize away access checks. gcc/ada/ * sem_util.adb (Null_Status): Deal with unchecked type conversions.
2023-11-21ada: Further cleanup in finalization machineryEric Botcazou3-46/+2
This removes the specific treatment of transient scopes in initialization procedures, which is obsolete. gcc/ada/ * exp_aggr.adb (Convert_To_Assignments): Do not treat initialization procedures specially when it comes to creating a transient scope. * exp_ch7.adb (Build_Finalizer.Process_Declarations): Likewise. * exp_util.adb (Requires_Cleanup_Actions): Likewise.
2023-11-21ada: Use CLOCK_MONOTONIC on VxWorksDoug Rupp1-1/+2
The monotonic clock keeps track of the time that has elapsed since system startup; that is, the value returned by clock_gettime() is the amount of time (in seconds and nanoseconds) that has passed since the system booted. The monotonic clock cannot be reset. As a result, time interval measurements made relative to the monotonic clock are not subject to errors resulting from the clock time being unexpectedly adjusted between the interval start and end. gcc/ada/ * s-oscons-tmplt.c: #define CLOCK_RT_Ada "CLOCK_MONOTONIC" for __vxworks
2023-11-21ada: Deep delta aggregates cleanup.Steve Baird1-1/+1
Cleanup after the introduction of deep delta aggregates. Eliminate a new gnatcheck message. gcc/ada/ * sem_aggr.adb: Replace "not Present (...)" call with "No (...)" call.
2023-11-21ada: Small cleanup in finalization machineryEric Botcazou5-45/+8
This removes an obsolete flag and adjusts a couple of obsolete comments. gcc/ada/ * gen_il-fields.ads (Opt_Field_Enum): Remove Is_Finalization_Wrapper * gen_il-gen-gen_nodes.adb (N_Block_Statement): Likewise. * sinfo.ads (Is_Finalization_Wrapper): Delete. * exp_ch7.adb (Build_Finalizer.Process_Declarations): Adjust comment and remove obsolete code testing the Is_Finalization_Wrapper flag. * exp_util.adb (Requires_Cleanup_Actions): Likewise.
2023-11-21ada: Runtime recompilation instructions improvements.Doug Rupp1-6/+7
Revise instructions to work on both cross and native targets hosted on Linux gcc/ada/ * libgnat/libada.gpr: Revise section 1
2023-11-21ada: Deep delta aggregatesSteve Baird6-66/+522
Add support for "deep" delta aggregates, a GNAT-defined language extension conditionally enabled via the -gnatX0 switch. In a deep delta aggregate, a delta choice may specify a subcomponent (as opposed to just a component). gcc/ada/ * par.adb: Add new Boolean variable Inside_Delta_Aggregate. * par-ch4.adb (P_Simple_Expression): Add support for a deep delta aggregate choice. We turn a sequence of selectors into a peculiar tree. We build a component (Indexed or Selected) whose prefix is another such component, etc. The leftmost prefix at the bottom of the tree has a "name" which is the first selector, without any further prefix. For something like "with delta (1)(2) => 3" where the type of the aggregate is an array of arrays of integers, we'll build an N_Indexed_Component whose prefix is an integer literal 1. This is consistent with the trees built for "regular" (Ada-defined) delta aggregates. * sem_aggr.adb (Is_Deep_Choice, Is_Root_Prefix_Of_Deep_Choice): New queries. (Resolve_Deep_Delta_Assoc): new procedure. (Resolve_Delta_Array_Aggregate): call Resolve_Deep_Delta_Assoc in deep case. (Resolve_Delta_Record_Aggregate): call Resolve_Deep_Delta_Assoc in deep case. (Get_Component_Type): new function replaces old Get_Component function. * sem_aggr.ads (Is_Deep_Choice, Is_Root_Prefix_Of_Deep_Choice): New queries. * exp_aggr.adb (Expand_Delta_Array_Aggregate): add nested function Make_Array_Delta_Assignment_LHS; call it instead of Make_Indexed_Component. (Expand_Delta_Record_Aggregate): add nested function Make_Record_Delta_Assignment_LHS; call it instead of Make_Selected_Component. * exp_spark.adb (Expand_SPARK_Delta_Or_Update): Insert range checks for indexes in deep delta aggregates.
2023-11-21ada: Fix Ada.Text_IO.Delete with "encoding=8bits" formRonan Desplanques6-10/+24
Before this patch, on Windows, file with non-ASCII Latin1 names could be created with Ada.Text_IO.Create by passing "encoding=8bits" through the Form parameter and a Latin1-encoded string through the Name parameter, but calling Ada.Text_IO.Delete on them raised an illegitimate exception. This patch fixes this by making the wrappers of the unlink system function aware of the encoding value passed through the Form parameter. It also removes an unnecessary curly-brace block. gcc/ada/ * adaint.c (__gnat_unlink): Add new parameter and fix text conversion on Windows. Remove unnecessary curly braces. * adaint.h (__gnat_unlink): Add new parameter. * libgnat/i-cstrea.ads (unlink): Adapt to __gnat_unlink signature change. * libgnat/i-cstrea.adb (unlink): New Subprogram definition. * libgnat/s-crtl.ads (unlink): Adapt to __gnat_unlink signature change. * libgnat/s-fileio.adb (Delete): Pass encoding argument to unlink.
2023-11-21ada: Fix spurious error on call with default parameter in generic packageEric Botcazou2-5/+16
This occurs when the default value is a function call returning a private type, and is caused by a bad interaction between two internal mechanisms. gcc/ada/ * sem_ch12.adb (Save_Global_References.Set_Global_Type): Beef up comment about the setting of the full view. * sem_res.adb (Resolve_Actuals.Insert_Default): Add another bypass for the case of a generic context.
2023-11-21ada: Fix misplaced index directive in documentationMarc Poulhiès2-14/+25
The index directive must be located before the indexed element, at least for the generated texinfo to be correct. See: https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#directive-index This was reported along with changes done in https://inbox.sourceware.org/gcc-patches/20230223102714.3606058-3-arsen@aarsen.me/ gcc/ada/ * doc/gnat_ugn/the_gnat_compilation_model.rst: Move index directives. * gnat_ugn.texi: Regenerate.
2023-11-21ada: Fix SCOs generation for aspect specificationsPierre-Marie de Rodat1-0/+7
The recent overhaul for the representation of aspect specifications in the tree broke SCOs generation: decisions that appeared in aspects were processed twice, leading to the emission of erroneous obligations. Tweak SCOs generation to skip aspect specifications the second time to go back to the previous behavior. gcc/ada/ * par_sco.adb (Process_Decisions)<Process_Node>: Skip aspect specifications.
2023-11-21ada: Always use -gnatg in run-time GPR filesRonan Desplanques1-1/+1
This patch makes it so -gnatg is always passed to the compiler when rebuilding the run-time library with the dedicated GPR files. Before this patch, if a user rebuilt the run-time with -XADAFLAGS=XXX where XXX didn't include "-gnatg", the build would immediately fail. This case occurs when following the instructions in libada.gpr, which use '-XADAFLAGS="-gnatn"'. gcc/ada/ * libgnat/libgnat_common.gpr: Unconditionally pass -gnatg.
2023-11-21ada: Trivial typo fix in commentMarc Poulhiès1-1/+1
gcc/ada/ * exp_util.ads: Typo fix.
2023-11-17Daily bump.GCC Administrator1-0/+5
2023-11-16Fix internal error on function returning dynamically-sized typeEric Botcazou1-0/+6
This is a tree sharing issue for the internal return type synthesized for a function returning a dynamically-sized type and taking an Out or In/Out parameter passed by copy. gcc/ada/ * gcc-interface/decl.cc (gnat_to_gnu_subprog_type): Also create a TYPE_DECL for the return type built for the CI/CO mechanism. gcc/testsuite/ * gnat.dg/varsize4.ads, gnat.dg/varsize4.adb: New test. * gnat.dg/varsize4_pkg.ads: New helper.
2023-11-14Daily bump.GCC Administrator1-0/+15
2023-11-10ada: Fix syntax errorAndris Pavēnis1-3/+3
gcc/ada/ * expect.c (__gnat_waitpid): fix syntax errors
2023-11-09Fix PR ada/111813 (Inconsistent limit in Ada.Calendar.Formatting)Simon Wright1-3/+8
The description of the second Value function (returning Duration) (ARM 9.6.1(87) doesn't place any limitation on the Elapsed_Time parameter's value, beyond "Constraint_Error is raised if the string is not formatted as described for Image, or the function cannot interpret the given string as a Duration value". It would seem reasonable that Value and Image should be consistent, in that any string produced by Image should be accepted by Value. Since Image must produce a two-digit representation of the Hours, there's an implication that its Elapsed_Time parameter should be less than 100.0 hours (the ARM merely says that in that case the result is implementation-defined). The current implementation of Value raises Constraint_Error if the Elapsed_Time parameter is greater than or equal to 24 hours. This patch removes the restriction, so that the Elapsed_Time parameter must only be less than 100.0 hours. 2023-10-15 Simon Wright <simon@pushface.org> PR ada/111813 gcc/ada/ * libgnat/a-calfor.adb (Value (2)): Allow values of parameter Elapsed_Time greater than or equal to 24 hours, by doing the hour calculations in Natural rather than Hour_Number (0 .. 23). Calculate the result directly rather than by using Seconds_Of (whose Hour parameter is of type Hour_Number). If an exception occurs of type Constraint_Error, re-raise it rather than raising a new CE. gcc/testsuite/ * gnat.dg/calendar_format_value.adb: New test.
2023-11-08Daily bump.GCC Administrator1-0/+386
2023-11-07c: Refer more consistently to C23 not C2XJoseph Myers1-1/+1
Continuing the move to refer to C23 in place of C2X throughout the source tree, update documentation, diagnostics, comments, variable and function names, etc., to use the C23 name. Testsuite updates are left for a future patch, except for testcases that test diagnostics that previously mentioned C2X (but in those testcases, sometimes other comments are updated, not just the diagnostic expectations). Bootstrapped with no regressions for x86_64-pc-linux-gnu. gcc/ * builtins.def (DEF_C2X_BUILTIN): Rename to DEF_C23_BUILTIN and use flag_isoc23 and function_c23_misc. * config/rl78/rl78.cc (rl78_option_override): Compare lang_hooks.name with "GNU C23" not "GNU C2X". * coretypes.h (function_c2x_misc): Rename to function_c23_misc. * doc/cpp.texi (@code{__has_attribute}): Refer to C23 instead of C2x. * doc/extend.texi: Likewise. * doc/invoke.texi: Likewise. * dwarf2out.cc (highest_c_language, gen_compile_unit_die): Compare against and return "GNU C23" language string instead of "GNU C2X". * ginclude/float.h: Refer to C23 instead of C2X in comments. * ginclude/stdint-gcc.h: Likewise. * glimits.h: Likewise. * tree.h: Likewise. gcc/ada/ * gcc-interface/utils.cc (flag_isoc2x): Rename to flag_isoc23. gcc/c-family/ * c-common.cc (flag_isoc2x): Rename to flag_isoc23. (c_common_reswords): Use D_C23 instead of D_C2X. * c-common.h: Refer throughout to C23 instead of C2X in comments. (D_C2X): Rename to D_C23. (flag_isoc2x): Rename to flag_isoc23. * c-cppbuiltin.cc (builtin_define_float_constants): Use flag_isoc23 instead of flag_isoc2x. Refer to C23 instead of C2x in comments. * c-format.cc: Use STD_C23 instead of STD_C2X and flag_isoc23 instead of flag_isoc2x. Refer to C23 instead of C2X in comments. * c-format.h: Use STD_C23 instead of STD_C2X. * c-lex.cc: Use warn_c11_c23_compat instead of warn_c11_c2x_compat and flag_isoc23 instead of flag_isoc2x. Refer to C23 instead of C2X in diagnostics. * c-opts.cc: Use flag_isoc23 instead of flag_isoc2x. Refer to C23 instead of C2X in comments. (set_std_c2x): Rename to set_std_c23. * c.opt (Wc11-c23-compat): Use CPP(cpp_warn_c11_c23_compat) CppReason(CPP_W_C11_C23_COMPAT) Var(warn_c11_c23_compat) instead of CPP(cpp_warn_c11_c2x_compat) CppReason(CPP_W_C11_C2X_COMPAT) Var(warn_c11_c2x_compat). gcc/c/ * c-decl.cc: Use flag_isoc23 instead of flag_isoc2x and c23_auto_p instead of c2x_auto_p. Refer to C23 instead of C2X in diagnostics and comments. * c-errors.cc: Use flag_isoc23 instead of flag_isoc2x and warn_c11_c23_compat instead of warn_c11_c2x_compat. Refer to C23 instead of C2X in comments. * c-parser.cc: Use flag_isoc23 instead of flag_isoc2x, warn_c11_c23_compat instead of warn_c11_c2x_compat, c23_auto_p instead of c2x_auto_p and D_C23 instead of D_C2X. Refer to C23 instead of C2X in diagnostics and comments. * c-tree.h: Refer to C23 instead of C2X in comments. (struct c_declspecs): Rename c2x_auto_p to c23_auto_p. * c-typeck.cc: Use flag_isoc23 instead of flag_isoc2x and warn_c11_c23_compat instead of warn_c11_c2x_compat. Refer to C23 instead of C2X in diagnostics and comments. gcc/fortran/ * gfortran.h (gfc_real_info): Refer to C23 instead of C2X in comment. gcc/lto/ * lto-lang.cc (flag_isoc2x): Rename to flag_isoc23. gcc/testsuite/ * gcc.dg/binary-constants-2.c: Refer to C23 instead of C2X. * gcc.dg/binary-constants-3.c: Likewise. * gcc.dg/bitint-23.c: Likewise. * gcc.dg/bitint-26.c: Likewise. * gcc.dg/bitint-27.c: Likewise. * gcc.dg/c11-attr-syntax-1.c: Likewise. * gcc.dg/c11-attr-syntax-2.c: Likewise. * gcc.dg/c11-floatn-1.c: Likewise. * gcc.dg/c11-floatn-2.c: Likewise. * gcc.dg/c11-floatn-3.c: Likewise. * gcc.dg/c11-floatn-4.c: Likewise. * gcc.dg/c11-floatn-5.c: Likewise. * gcc.dg/c11-floatn-6.c: Likewise. * gcc.dg/c11-floatn-7.c: Likewise. * gcc.dg/c11-floatn-8.c: Likewise. * gcc.dg/c2x-attr-syntax-4.c: Likewise. * gcc.dg/c2x-attr-syntax-6.c: Likewise. * gcc.dg/c2x-attr-syntax-7.c: Likewise. * gcc.dg/c2x-binary-constants-2.c: Likewise. * gcc.dg/c2x-floatn-5.c: Likewise. * gcc.dg/c2x-floatn-6.c: Likewise. * gcc.dg/c2x-floatn-7.c: Likewise. * gcc.dg/c2x-floatn-8.c: Likewise. * gcc.dg/c2x-nullptr-4.c: Likewise. * gcc.dg/c2x-qual-2.c: Likewise. * gcc.dg/c2x-qual-3.c: Likewise. * gcc.dg/c2x-qual-6.c: Likewise. * gcc.dg/cpp/c11-warning-1.c: Likewise. * gcc.dg/cpp/c11-warning-2.c: Likewise. * gcc.dg/cpp/c11-warning-3.c: Likewise. * gcc.dg/cpp/c2x-warning-2.c: Likewise. * gcc.dg/cpp/gnu11-elifdef-3.c: Likewise. * gcc.dg/cpp/gnu11-elifdef-4.c: Likewise. * gcc.dg/cpp/gnu11-warning-1.c: Likewise. * gcc.dg/cpp/gnu11-warning-2.c: Likewise. * gcc.dg/cpp/gnu11-warning-3.c: Likewise. * gcc.dg/cpp/gnu2x-warning-2.c: Likewise. * gcc.dg/dfp/c11-constants-1.c: Likewise. * gcc.dg/dfp/c11-constants-2.c: Likewise. * gcc.dg/dfp/c2x-constants-2.c: Likewise. * gcc.dg/dfp/constants-pedantic.c: Likewise. * gcc.dg/pr30260.c: Likewise. * gcc.dg/system-binary-constants-1.c: Likewise. libcpp/ * directives.cc: Refer to C23 instead of C2X in diagnostics and comments. (STDC2X): Rename to STDC23. * expr.cc: Use cpp_warn_c11_c23_compat instead of cpp_warn_c11_c2x_compat and CPP_W_C11_C23_COMPAT instead of CPP_W_C11_C2X_COMPAT. Refer to C23 instead of C2X in diagnostics and comments. * include/cpplib.h: Refer to C23 instead of C2X in diagnostics and comments. (CLK_GNUC2X): Rename to CLK_GNUC23. (CLK_STDC2X): Rename to CLK_STDC23. (CPP_W_C11_C2X_COMPAT): Rename to CPP_W_C11_C23_COMPAT. * init.cc: Use GNUC23 instead of GNUC2X, STDC23 instead of STDC2X and cpp_warn_c11_c23_compat instead of cpp_warn_c11_c2x_compat. * lex.cc (maybe_va_opt_error): Refer to C23 instead of C2X in diagnostic. * macro.cc (_cpp_arguments_ok): Refer to C23 instead of C2X in comment.
2023-11-07ada: Fix debug info for aliased packed array with unconstrained nominal subtypeEric Botcazou1-0/+12
The front-end now rewrites it as a renaming when it is initialized with a function call and the same processing must be applied in the renaming case as in the regular case for this kind of special objects. gcc/ada/ * gcc-interface/decl.cc (gnat_to_gnu_entity) <E_Variable>: Apply the specific rewriting done for an aliased object with an unconstrained array nominal subtype in the renaming case too.
2023-11-07ada: Fix spurious -Wstringop-overflow with link time optimizationEric Botcazou1-24/+0
It comes from an incomplete optimization performed by LTO that is caused by an obsolete transformation done in Gigi, which is redundant with the common uniquization of constant CONSTRUCTORs now performed during gimplification. gcc/ada/ * gcc-interface/trans.cc (gnat_gimplify_expr) <CALL_EXPR>: Delete.
2023-11-07ada: Compiler crash on early alignment clauseBob Duff2-4/+1
This patch fixes a bug: if "for T'Alignment use..." is followed by "for T use (<enum rep>);" the compiler crashes. A workaround is to move the alignment clause after the enumeration rep clause. gcc/ada/ * sem_ch13.ads (Set_Enum_Esize): Do not set alignment. * sem_ch13.adb (Set_Enum_Esize): Do not set alignment. Archaeology seems to show that this line of code dates from when "Alignment = 0" meant "the Alignment is not known at compile time" and "the Alignment is not yet known at compile time" as well as "the Alignment is zero". In any case, it seems to be unnecessary, and in this case harmful, because gigi would crash. Alignment_Clause is set (because there is one), so gigi would query the Alignment, but Alignment was destroyed.
2023-11-07ada: Update the logo in the gnat docJulien Bortolussi1-3/+6
Update the logo and the background color in the top right corner of the GNAT User’s Guide for Native Platforms gcc/ada/ * doc/share/conf.py: Changed the background color and the logo.
2023-11-07ada: Fix incorrect resolution of overloaded function call in instanceEric Botcazou6-41/+87
The problem occurs when the function call is the operand of an equality operator, the type used to do the comparison is declared outside of the generic construct but visible inside it, and this generic construct also declares two functions with the same profile except for the result type, one result type being the aforementioned type, the other being derived from this type but not visible inside the generic construct. When the second operand is either a literal or also overloaded, the call may be resolved to the second function instead of the first in instances. gcc/ada/ * gen_il-fields.ads (Opt_Field_Enum): Add Compare_Type. * gen_il-gen-gen_nodes.adb (N_Op_Eq): Likewise. (N_Op_Ge): Likewise. (N_Op_Gt): Likewise. (N_Op_Le): Likewise. (N_Op_Lt): Likewise. (N_Op_Ne): Likewise. * sinfo.ads (Compare_Type): Document new field. * sem_ch4.adb (Analyze_Comparison_Equality_Op): If the entity is already present, set the Compare_Type on overloaded operands if it is present on the node. * sem_ch12.adb (Check_Private_View): Look into the Compare_Type instead of the Etype for comparison operators. (Copy_Generic_Node): Remove obsolete code for comparison operators. (Save_Global_References.Save_References): Do not walk into the descendants of N_Implicit_Label_Declaration nodes. (Save_Global_References.Set_Global_Type): Look into the Compare_Type instead of the Etype for comparison operators. * sem_res.adb (Resolve_Comparison_Op): Set Compare_Type. (Resolve_Equality_Op): Likewise.
2023-11-07ada: Fix Ada.Directories.Modification_Time on WindowsRonan Desplanques1-1/+10
Before this patch, Ada.Directories.Modification_Time called GetFileAttributesExA under the hood on Windows. That would sometimes fail to work with files whose names were non-ASCII. This patch replaces the call to GetFileAttributesExA with a call to GetFileAttributesEx preceded by an encoding scheme conversion, as is done in other functions of the run-time library. This fixes the issues that were observed with the previous implementations. gcc/ada/ * adaint.c (__gnat_file_time): Fix Windows version.
2023-11-07ada: Elide temporary for aliased array with unconstrained nominal subtypeEric Botcazou1-23/+24
When the array is initialized with the result of a call to a function whose result type is unconstrained, then the result is allocated with its bounds, so the array can be rewritten as a renaming of the result in this case too. gcc/ada/ * exp_ch3.adb (Expand_N_Object_Declaration): Fold initialization expression of Nominal_Subtype_Is_Constrained_Array constant into the computation of Rewrite_As_Renaming and remove the constant. Set it to True for an aliased array with unconstrained nominal subtype if the subtype of the expression is also unconstrained.