aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2022-05-24Use NSDMI for predicate classdevel/loop-unswitch-support-switchesRichard Biener1-6/+3
Use NSDMI for predicate class
2022-05-18Another bogus range from .invert so don't use it.Richard Biener2-12/+19
From _1 < _2 we conclude [-INF, +INF - 1] and invert it as [+INF, +INF] - oops. Compute the other edge range explicitely.
2022-05-18Properly only consider reachable BBs predicatesRichard Biener2-54/+72
2022-05-18Make sure to cost bb[0], work around unreachable predicatesRichard Biener1-10/+17
This applies a workaround to avoid unswitching on predicates from BBs that are considered unreachable and to that effect makes sure to always cost bb[0] which we always put on the worklist as reachable.
2022-05-18This fixes the execute FAIL of gfortran.fortran-torture/execute/forall_7.f90Richard Biener1-44/+62
Using global ranges and inverting them is not correct - in the particular case we ended up with a global range from a if (a_1 = b_2) predicate and used the inversion on the false edge. The change refactors the predicate CTORs again, using range-ops to create a bare range from the comparison in the GIMPLE_COND only and for switches resorts to computing the ranges manually by unioning the case ranges. The ranger query in the simplification code should probably change as well to use a path_range_query where we should seed the path range oracle with the predicate stack of the loop version we want to simplify.
2022-05-18Avoid ICE when removing a case sharing the edge with the default caseRichard Biener2-3/+51
2022-05-17Merge remote-tracking branch 'origin/master' into unswitchRichard Biener1246-104144/+119831
Bootstraps OK, has FAIL: gfortran.fortran-torture/execute/forall_7.f90 execution, -O3 -g and ICEs 511.povray_r, 526.blender_r, 538.imagick_r with -Ofast znver2 splines.cpp:687:5: internal compiler error: in tree_unswitch_single_loop, at tree-ssa-loop-unswitch.cc:902 blender/source/blender/modifiers/intern/MOD_weightvg_util.c:120:6: internal compiler error: Segmentation fault magick/composite.c:1631:32: internal compiler error: in tree_unswitch_single_loop, at tree-ssa-loop-unswitch.cc:902 the 902 is the size estimation assert recently added.
2022-05-17Do not clear bb->aux in duplicate_loop_body_to_header_edgeRichard Biener1-1/+0
duplicate_loop_body_to_header_edge clears bb->aux which is not wanted by a new use in loop unswitching. The clearing was introduced with r0-69110-g6580ee7781f903 and it seems accidentially so. 2022-05-17 Richard Biener <rguenther@suse.de> * cfgloopmanip.cc (duplicate_loop_body_to_header_edge): Do not clear bb->aux of the copied blocks.
2022-05-17Check for equivalence after merging relations.Andrew MacLeod2-4/+24
When registering a relation, we need to merge with any existing relation before checking if it was an equivalence... otherwise it was not being handled properly. gcc/ PR tree-optimization/105458 * value-relation.cc (path_oracle::register_relation): Merge, then check for equivalence. gcc/testsuite/ * gcc.dg/pr105458.c: New.
2022-05-17Really use first found predicate. Adjust limit for loop-unswitch-16.cRichard Biener2-27/+35
2022-05-17fix ->aux clearing of duplicate_loop_body_to_header_edgeRichard Biener1-1/+0
2022-05-17i386: Fix ICE in final_scan_insn_1 [PR105624]Uros Bizjak6-249/+268
Apparently const_int_operand and other const*_operand predicates do need constraints. Revert the offending patch that caused ICE. 2022-05-17 Uroš Bizjak <ubizjak@gmail.com> gcc/ChangeLog: PR target/105624 Revert: * config/i386/i386.md: Remove constraints when used with const_int_operand, const0_operand, const_1_operand, constm1_operand, const8_operand, const128_operand, const248_operand, const123_operand, const2367_operand, const1248_operand, const359_operand, const_4_or_8_to_11_operand, const48_operand, const_0_to_1_operand, const_0_to_3_operand, const_0_to_4_operand, const_0_to_5_operand, const_0_to_7_operand, const_0_to_15_operand, const_0_to_31_operand, const_0_to_63_operand, const_0_to_127_operand, const_0_to_255_operand, const_0_to_255_mul_8_operand, const_1_to_31_operand, const_1_to_63_operand, const_2_to_3_operand, const_4_to_5_operand, const_4_to_7_operand, const_6_to_7_operand, const_8_to_9_operand, const_8_to_11_operand, const_8_to_15_operand, const_10_to_11_operand, const_12_to_13_operand, const_12_to_15_operand, const_14_to_15_operand, const_16_to_19_operand, const_16_to_31_operand, const_20_to_23_operand, const_24_to_27_operand and const_28_to_31_operand. * config/i386/mmx.md: Ditto. * config/i386/sse.md: Ditto. * config/i386/subst.md: Ditto. * config/i386/sync.md: Ditto. gcc/testsuite/ChangeLog: PR target/105624 * gcc.target/i386/pr105624.c: New test.
2022-05-17libgomp: Clarify that omp_display_env is fully implementedJakub Jelinek1-2/+1
OpenMP 5.2 added "When called from within a target region the effect is unspecified." restriction to omp_display_env, so it is ok not to support it in target regions (worst case we could add an empty implementation or one with __builtin_trap in there). 2022-05-17 Jakub Jelinek <jakub@redhat.com> * libgomp.texi (OpenMP 5.1): Remove "Not inside target regions" comment for omp_display_env feature.
2022-05-17Advise to call 'internal_error' instead of 'abort' or 'fancy_abort'Thomas Schwinge2-5/+5
gcc/ * diagnostic.cc: Don't advise to call 'abort' instead of 'internal_error'. * system.h: Advise to call 'internal_error' instead of 'abort' or 'fancy_abort'. Suggested-by: Richard Biener <richard.guenther@gmail.com>
2022-05-17Fix recursive unswitching regressionRichard Biener3-74/+98
This fixes the recursive unswitching regression by introducing the ability to track 'handled' as bitmap separately. It also fixes the budgeting to properly subtract the original loop size (the param should probably be changed to a capped scale to not allow arbitrary relative growth of small loops when there are a lot of them?)
2022-05-17graphite: Fix minor mistakes in commentsFrederik Harwath2-3/+3
gcc/ChangeLog: * graphite-sese-to-poly.cc (build_poly_sr_1): Fix a typo and a reference to a variable which does not exist. * graphite-isl-ast-to-gimple.cc (gsi_insert_earliest): Fix typo in comment.
2022-05-17graphite: Rename isl_id_for_ssa_nameFrederik Harwath1-10/+11
The SSA names for which this function gets used are always SCoP parameters and hence "isl_id_for_parameter" is a better name. It also explains the prefix "P_" for those names in the ISL representation. gcc/ChangeLog: * graphite-sese-to-poly.cc (isl_id_for_ssa_name): Rename to ... (isl_id_for_parameter): ... this new function name. (build_scop_context): Adjust function use.
2022-05-17libgomp.texi: Document OpenMP context selectorsTobias Burnus1-0/+32
libgomp/ * libgomp.texi (Offload-Target Specifics): New chapter; add section to document OpenMP context selectors.
2022-05-17gcn/t-omp-device: Add 'amdgcn' as 'arch' [PR105602]Tobias Burnus2-2/+2
Improve cross-compiler handling. gcc/ChangeLog: PR target/105602 * config/gcn/t-omp-device (arch): Add 'amdgcn' besides existing 'gcn'. * config/gcn/gcn.cc (gcn_omp_device_kind_arch_isa): Likewise.
2022-05-17openmp: Add support for inoutset depend-kindJakub Jelinek19-42/+365
This patch adds support for inoutset depend-kind in depend clauses. It is very similar to the in depend-kind in that a task with a dependency with that depend-kind is dependent on all previously created sibling tasks with matching address unless they have the same depend-kind. In the in depend-kind case everything is dependent except for in -> in dependency, for inoutset everything is dependent except for inoutset -> inoutset dependency. mutexinoutset is also similar (everything is dependent except for mutexinoutset -> mutexinoutset dependency), but there is also the additional restriction that only one task with mutexinoutset for each address can be scheduled at once (i.e. mutual exclusitivty). For now we support mutexinoutset the same as inout/out, but the inoutset support is full. In order not to bump the ABI for dependencies each time (we've bumped it already once, the old ABI supports only inout/out and in depend-kind, the new ABI supports inout/out, mutexinoutset, in and depobj), this patch arranges for inoutset to be at least for the time being always handled as if it was specified through depobj even when it is not. So it uses the new ABI for that and inoutset are represented like depobj - pointer to a pair of pointers where the first one will be the actual address of the object mentioned in depend clause and second pointer will be (void *) GOMP_DEPEND_INOUTSET. 2022-05-17 Jakub Jelinek <jakub@redhat.com> gcc/ * tree-core.h (enum omp_clause_depend_kind): Add OMP_CLAUSE_DEPEND_INOUTSET. * tree-pretty-print.cc (dump_omp_clause): Handle OMP_CLAUSE_DEPEND_INOUTSET. * gimplify.cc (gimplify_omp_depend): Likewise. * omp-low.cc (lower_depend_clauses): Likewise. gcc/c-family/ * c-omp.cc (c_finish_omp_depobj): Handle OMP_CLAUSE_DEPEND_INOUTSET. gcc/c/ * c-parser.cc (c_parser_omp_clause_depend): Parse inoutset depend-kind. (c_parser_omp_depobj): Likewise. gcc/cp/ * parser.cc (cp_parser_omp_clause_depend): Parse inoutset depend-kind. (cp_parser_omp_depobj): Likewise. * cxx-pretty-print.cc (cxx_pretty_printer::statement): Handle OMP_CLAUSE_DEPEND_INOUTSET. gcc/testsuite/ * c-c++-common/gomp/all-memory-1.c (boo): Add test with inoutset depend-kind. * c-c++-common/gomp/all-memory-2.c (boo): Likewise. * c-c++-common/gomp/depobj-1.c (f1): Likewise. (f2): Adjusted expected diagnostics. * g++.dg/gomp/depobj-1.C (f4): Adjust expected diagnostics. include/ * gomp-constants.h (GOMP_DEPEND_INOUTSET): Define. libgomp/ * libgomp.h (struct gomp_task_depend_entry): Change is_in type from bool to unsigned char. * task.c (gomp_task_handle_depend): Handle GOMP_DEPEND_INOUTSET. Ignore dependencies where task->depend[i].is_in && task->depend[i].is_in == ent->is_in rather than just task->depend[i].is_in && ent->is_in. Remember whether GOMP_DEPEND_IN loop is needed and guard the loop with that conditional. (gomp_task_maybe_wait_for_dependencies): Handle GOMP_DEPEND_INOUTSET. Ignore dependencies where elem.is_in && elem.is_in == ent->is_in rather than just elem.is_in && ent->is_in. * testsuite/libgomp.c-c++-common/depend-1.c (test): Add task with inoutset depend-kind. * testsuite/libgomp.c-c++-common/depend-2.c (test): Likewise. * testsuite/libgomp.c-c++-common/depend-3.c (test): Likewise. * testsuite/libgomp.c-c++-common/depend-inoutset-1.c: New test.
2022-05-17More cleanupsRichard Biener2-198/+213
This performs more API cleanups, adds comments and fixes minor issues. It adds gcc.dg/loop-unswitch-16.c noting a regression from the previous implementation.
2022-05-17libstdc++: Skip tests that fail for the versioned namespaceJonathan Wakely2-0/+2
Most tests for the contents of header synopses need to be supressed for the versioned namespace build, because redeclaring the entities in std fails when they were originally declared in std::__8. I added these tests recently without the suppression, so they fail. libstdc++-v3/ChangeLog: * testsuite/20_util/expected/synopsis.cc: Skip for versioned namespace. * testsuite/27_io/headers/iosfwd/synopsis.cc: Likewise.
2022-05-17libstdc++: Stop defining C++0x compat symbols for versioned namespaceJonathan Wakely8-22/+54
The src/c++11/compatibility*-c++0x.cc files define symbols that need to be exported for ancient versions of libstdc++.so.6 due to changes between C++0x and the final C++11 standard. Those symbols are not needed in the libstdc++.so.8 library, and we can skip building them entirely. This also fixes the build failure I introduced last week when making the versioned namespace config not use the _V2 namespace for compat symbols. libstdc++-v3/ChangeLog: * src/Makefile.am [ENABLE_SYMVERS_GNU_NAMESPACE] (cxx11_sources): Do not build the compatibility*-c++0x.cc objects. * src/Makefile.in: Regenerate. * src/c++11/compatibility-c++0x.cc [_GLIBCXX_INLINE_VERSION]: Refuse to build for the versioned namespace. * src/c++11/compatibility-chrono.cc: Likewise. * src/c++11/compatibility-condvar.cc: Likewise. * src/c++11/compatibility-thread-c++0x.cc: Likewise. * src/c++11/chrono.cc (system_clock, steady_clock): Use macros to define in inline namespace _V2, matching the declarations in <system_error>. * src/c++11/system_error.cc (system_category, generic_category): Likewise.
2022-05-17libgomp.texi: Add OpenMP 5.2 implementation statusTobias Burnus1-5/+56
libgomp/ * libgomp.texi (OpenMP Implementation Status): Add 5.2 table.
2022-05-17i386: Fix up V2DI and V1TI inequality comparisons [PR105613]Jakub Jelinek2-2/+34
The recent r13-458 change to introduce vec_cmpeqv1tiv1ti and add TARGET_SSE2 support to vec_cmpeqv2div2di works nicely for equality comparisons, but as the testcase shows doesn't work for inequality comparisons. For EQ if we perform comparison with twice as many half-sized elemenets, the result should be ~0 when both halves are ~0 only (both halves need to be equal for the whole to be equal), otherwise 0, so AND is the correct operation for it. But for NE, the result should be ~0 when either of the halves is ~0 (if either half is not equal, the whole is not equal) and so the right operation for NE is IOR, not AND. 2022-05-17 Jakub Jelinek <jakub@redhat.com> PR target/105613 * config/i386/sse.md (vec_cmpeqv2div2di, vec_cmpeqv1tiv1ti): Use andv4si3 only for EQ, for NE use iorv4si3 instead. * gcc.c-torture/execute/pr105613.c: New test.
2022-05-17random fixesRichard Biener2-57/+66
restore unswitching on a < b with non-constant RHS. Avoid quadratic behavior when building predicates from switch stmts.
2022-05-17OpenMP: Add omp_all_memory support to FortranTobias Burnus11-22/+567
Fortran part to the C/C++/backend implementation r13-337-g7f78783dbedca0183d193e475262ca3c489fd365 gcc/fortran/ChangeLog: * dump-parse-tree.cc (show_omp_namelist): Handle omp_all_memory. * openmp.cc (gfc_match_omp_variable_list, gfc_match_omp_depend_sink, gfc_match_omp_clauses, resolve_omp_clauses): Likewise. * trans-openmp.cc (gfc_trans_omp_clauses, gfc_trans_omp_depobj): Likewise. * resolve.cc (resolve_symbol): Reject it as symbol. libgomp/ChangeLog: * libgomp.texi (OpenMP 5.1): Set omp_all_memory to 'Y'. * testsuite/libgomp.fortran/depend-5.f90: New test. * testsuite/libgomp.fortran/depend-6.f90: New test. * testsuite/libgomp.fortran/depend-7.f90: New test. gcc/testsuite/ChangeLog: * gfortran.dg/gomp/all-memory-1.f90: New test. * gfortran.dg/gomp/all-memory-2.f90: New test. * gfortran.dg/gomp/all-memory-3.f90: New test.
2022-05-17tree-optimization/105618 - restore load sinkingRichard Biener2-0/+24
The PR97330 fix caused some missed sinking of loads out of loops the following patch re-instantiates. 2022-05-17 Richard Biener <rguenther@suse.de> PR tree-optimization/105618 * tree-ssa-sink.cc (statement_sink_location): For virtual PHI uses ignore those defining the used virtual operand. * gcc.dg/tree-ssa/ssa-sink-19.c: New testcase.
2022-05-17[Ada] Restore defensive guard in checks for volatile actualsPiotr Trojanek1-1/+2
When flagging names of volatile objects occurring in actual parameters it is safer to guard against identifiers without entity. This is redundant (because earlier in the resolution of actual parameters we already guard against actuals with Any_Type), but perhaps such identifiers will become allowed in constructs like: Subprogram_Call (Actual => (declare X : Boolean := ... with Annotate (GNATprove, ...))); ^^^^^^^^^ which include an identifier that does not denote any entity. Code cleanup related to handling of volatile components; behaviour is unaffected. gcc/ada/ * sem_res.adb (Flag_Effectively_Volatile_Objects): Restore redundant guard.
2022-05-17[Ada] Subprogram renaming fails to hide homographGary Dismukes1-0/+25
The compiler failed to detect an error where the first prefix of an expanded name given as the renamed subprogram in a subprogram renaming declaration denotes a unit with the same name as the name given for the subprogram renaming. Such a unit must be hidden by the renaming itself. An error check is added to catch this case. gcc/ada/ * sem_ch8.adb (Analyze_Subprogram_Renaming): Add error check for the case of a renamed subprogram given by an expanded name whose outermost prefix names a unit that is hidden by the name of the renaming. (Ult_Expanded_Prefix): New local expression function to return the ultimate prefix of an expanded name.
2022-05-17[Ada] CUDA: remove code performing kernel registrationGhjuvan Lacambre2-503/+8
A previous commit implemented a new kernel registration scheme, using the binder to generate registration code rather than inserting registration code in packages. Now that this new approach has had time to be thoroughly tested, it is time to remove the old approach. gcc/ada/ * gnat_cuda.ads: Update package-level comments. (Build_And_Insert_CUDA_Initialization): Remove function. * gnat_cuda.adb (Build_And_Insert_CUDA_Initialization): Remove function. (Expand_CUDA_Package): Remove call to Build_And_Insert_CUDA_Initialization.
2022-05-17[Ada] Enhance the warning on C enum with size clause for size /= 32Etienne Servais1-5/+12
Improve the warning message and silence warning when size > 32, this is likely intentional and does not warrant a warning. gcc/ada/ * freeze.adb (Freeze_Enumeration_Type): Fix comment, enhance message and silence warning for size > 32.
2022-05-17[Ada] Allow inlining for proof inside genericsYannick Moy5-10/+103
For local subprograms without contracts inside generics, allow their inlining for proof in GNATprove mode. This requires forbidding the inlining of subprograms which contain references to object renamings, which would be replaced in the SPARK expansion and violate assumptions of the inlining code. gcc/ada/ * exp_spark.adb (Expand_SPARK_Potential_Renaming): Deal with no entity case. * inline.ads (Check_Object_Renaming_In_GNATprove_Mode): New procedure. * inline.adb (Check_Object_Renaming_In_GNATprove_Mode): New procedure. (Can_Be_Inlined_In_GNATprove_Mode): Remove case forbidding inlining for subprograms inside generics. * sem_ch12.adb (Copy_Generic_Node): Preserve global entities when inlining in GNATprove mode. * sem_ch6.adb (Analyse_Subprogram_Body_Helper): Remove body to inline if renaming is detected in GNATprove mode.
2022-05-17[Ada] Provide allocation subtype for allocators of a ↵Gary Dismukes2-8/+44
Designated_Storage_Model type When an allocator is for an access type that has a Designated_Storage_Model aspect, and the designated type is an unconstrained record type with discriminants, and the subtype associated with the allocator is constrained, a dereference of the new access value can be passed to the designated type's initialization procedure. The post-front-end phase of the compiler needs to be able to create a temporary object in the host memory space to pass to the init proc, which requires creating such an object, but the subtype needed for the allocation isn't readily available at the point of the dereference. To make the subtype easily accessible, we set the Actual_Designated_Subtype of such a dereference to the subtype of the allocated object. gcc/ada/ * exp_ch4.adb (Expand_N_Allocator): For an allocator with an unconstrained discriminated designated type, and whose allocation subtype is constrained, set the Actual_Designated_Subtype of the dereference passed to the init proc of the designated type to be the allocation subtype. * sinfo.ads: Add documentation of new setting of Actual_Designated_Subtype on a dereference used as an actual parameter of call to an init proc associated with an allocator. Also add missing syntax and documentation for the GNAT language extension that allows an expression as a default for a concrete generic formal function.
2022-05-17[Ada] Cleanups related to front-end SJLJBob Duff8-75/+21
This patch cleans up some code that is left over from the front-end SJLJ exception handling mechanism, which has been removed. This is in preparation for fixing a finalization-related bug. Most importantly: The documentation is changed: a Handled_Sequence_Of_Statements node CAN contain both Exception_Handlers and an At_End_Proc. The assertion contradicting that is removed from Expand_At_End_Handler. The From_At_End field is removed. gcc/ada/ * sinfo.ads: Remove From_At_End. Update comments. * gen_il-fields.ads, gen_il-gen-gen_nodes.adb, sem_ch11.adb: Remove From_At_End. * exp_ch11.adb (Expand_At_End_Handler): Remove assertion. * fe.h (Exception_Mechanism, Exception_Mechanism_Type, Has_DIC, Has_Invariants, Is_List_Member, List_Containing): Remove declarations that are not used in gigi. * opt.ads (Exception_Mechanism): This is not used in gigi. * exp_util.ads: Minor comment fix.
2022-05-17[Ada] GNAT.Binary_Search is not internalDmitriy Anisimkov1-0/+1
Put package GNAT.Binary_Search to predefined units list. gcc/ada/ * impunit.adb: Add "g-binsea" to Non_Imp_File_Names_95 list.
2022-05-17[Ada] Fix insertion of declaration inside quantified expressionYannick Moy1-1/+1
When the evaluation of the subtype_indication for the iterator_specification of a quantified_expression leads to the insertion of a type declaration, this should be done with Insert_Action instead of Insert_Before. gcc/ada/ * sem_ch5.adb (Analyze_Iterator_Specification): Use Insert_Action when possibly inside an expression.
2022-05-17[Ada] Fix Forced sign flag in formatted stringMarc Poulhiès1-1/+1
Fix the Forced sign flag that is incorrectly ignored for scientific notation and shortest representation. gcc/ada/ * libgnat/g-forstr.adb (Is_Number): Add scientific notation and shortest representation.
2022-05-17[Ada] Fix small glitch in Expand_N_Full_Type_DeclarationEric Botcazou1-2/+1
The original node is not guaranteed to also be an N_Full_Type_Declaration, so the code needs to look into the node itself. gcc/ada/ * exp_ch3.adb (Expand_N_Full_Type_Declaration): Look into N.
2022-05-17[Ada] Requires_Cleanup_Actions and N_Protected_BodyBob Duff1-1/+0
This patch disallows N_Protected_Body from being passed to Requires_Cleanup_Actions. Protected bodies never need cleanup, and are never passed to Requires_Cleanup_Actions, which is a good thing, because it would blow up on Handled_Statement_Sequence, which doesn't exist for N_Protected_Body. gcc/ada/ * exp_util.adb (Requires_Cleanup_Actions): Remove N_Protected_Body from the case statement, so that case will be covered by "raise Program_Error".
2022-05-17[Ada] Output.w always writes to stderrBob Duff1-4/+42
There are several debugging procedures called Output.w, and some output-redirection features. This patch modifies Output.w so their output is not redirected; it always goes to standard error. Otherwise, debugging output can get mixed in with some "real" output (perhaps to a file), which causes confusion and in some cases failure to build. gcc/ada/ * output.adb (Pop_Output, Set_Output): Unconditionally flush output when switching from one output destination to another. Otherwise buffering can cause garbled output. (w): Push/pop the current settings, and temporarily Set_Standard_Error during these procedures.
2022-05-17[Ada] Generic binary search implementationDmitriy Anisimkov5-169/+412
Allows binary search in sorted anonymous array (or array-like container). gcc/ada/ * libgnat/g-binsea.ads, libgnat/g-binsea.adb (GNAT.Binary_Search): New package. * Makefile.rtl (GNATRTL_NONTASKING_OBJS): New item in list. * doc/gnat_rm/the_gnat_library.rst (GNAT.Binary_Search): New package record. * gnat_rm.texi: Regenerate.
2022-05-17[Ada] Fix bogus visibility error with partially parameterized formal packageEric Botcazou3-79/+167
The problem comes from the special instantiation (abbreviated instantiation in GNAT parlance) done to check conformance between a formal package and its corresponding actual in a generic instantiation: the compiler instantiates the formal package, in the context of the generic instantiation, so that it can check the conformance of the actual with the result. More precisely, it occurs with formal packages that are only partially parameterized, i.e. that have at least one parameter association and an (others => <>) choice. In this case, RM 12.7(10/2) says that the visible part of the formal package contains a copy of the formal parameters that are not explicitly associated. The analysis of these copies for the abbreviated instantiation is not done in the correct context when the generic unit is a child generic unit. gcc/ada/ * sem_ch12.ads (Is_Abbreviated_Instance): Declare. * sem_ch12.adb (Check_Abbreviated_Instance): Declare. (Requires_Conformance_Checking): Declare. (Analyze_Association.Process_Default): Fix subtype of parameter. (Analyze_Formal_Object_Declaration): Check whether it is in the visible part of abbreviated instance. (Analyze_Formal_Subprogram_Declaration): Likewise. (Analyze_Formal_Type_Declaration): Likewise. (Analyze_Package_Instantiation): Do not check for a generic child unit in the case of an abbreviated instance. (Check_Abbreviated_Instance): New procedure. (Check_Formal_Packages): Tidy up. (Copy_Generic_Elist): Fix comment. (Instantiate_Formal_Package): Tidy up. If the generic unit is a child unit, copy the qualified name onto the abbreviated instance. (Is_Abbreviated_Instance): New function. (Collect_Previous_Instances): Call Is_Abbreviated_Instance. (Requires_Conformance_Checking): New function. * sem_ch7.adb (Analyze_Package_Specification): Do not install the private declarations of the parent for an abbreviated instance.
2022-05-17[Ada] Take full view of private typeEtienne Servais1-1/+3
This allows to resolve the following: type Rec (<>) is private; type Arr (<>) is private; private type Arr is array (Positive range <>) of Natural; type Rec (L : Natural) is record F1 : Integer; F2 : Arr (1 .. L); end record; gcc/ada/ * sem_ch3.adb (Analyze_Subtype_Declaration): Use underlying type of Indic_Typ. (Constrain_Array): Ditto for T.
2022-05-17[Ada] Allow 'Reduce with -gnat2022Arnaud Charlet2-12/+1
After a period of experimentation, allow 'Reduce in Ada 2022 mode. gcc/ada/ * sem_attr.adb (Analyze_Attribute [Attribute_Reduce]): Allow 'Reduce for Ada 2022 and above. * sem_attr.ads (Attribute_Impl_Def): 'Reduce is no longer implementation defined.
2022-05-17[Ada] Don't create calls to Abort_Undefer when not Abort_AllowedGhjuvan Lacambre1-1/+3
Prevent creation of references to Abort_Undefer when aborts aren't allowed. Another solution could have been an early return at Expand_N_Asynchronous_Select's beginning, but this would break backends that currently expect trees that do not contain any N_Asynchronous_Selects in their AST (e.g. CodePeer). gcc/ada/ * exp_ch9.adb (Expand_N_Asynchronous_Select): Don't generate Abort_Undefers when not Abort_Allowed.
2022-05-17[Ada] Typo fix in finalization commentMarc Poulhiès1-8/+8
Add missing 's' and reformat the comment block. gcc/ada/ * exp_ch7.adb: Fix typo.
2022-05-17[Ada] Initialize Compiler_State to avoid Constraint_ErrorEtienne Servais1-1/+1
When building gnat1 with `-gnatVa` as we do locally, rules like: `gcc -c -gnatyM79 <any adb file with lines longer than 79>` will throw a constraint error as `lib.compiler_state` is initialized by par.adb, ie after scanning. Therefore any error_msg thrown during scanning will perform this uninitialized read (which raises a Constraint_Error when the compiler was compiled with `-gnatVa`). Initialize this flag to `Parsing`. gcc/ada/ * lib.ads: initialize `Compiler_State` to `Parsing`.
2022-05-17[Ada] Deal with derived record types in Has_Compatible_RepresentationEric Botcazou1-0/+10
More precisely, untagged record types, as tagged record types are already handled by the predicate. If the derived type has not been given its own representation clause, then the representations are the same. gcc/ada/ * sem_ch13.adb (Has_Compatible_Representation): Return true for derived untagged record types without representation clause.
2022-05-17[Ada] Streamline implementation of Has_Compatible_RepresentationEric Botcazou4-49/+31
The predicate is only concerned with the internal representation of types and this representation is shared by the subtypes of a given type, so the implementation can directly look into the (implementation) base types. No functional changes. gcc/ada/ * sem_ch13.ads (Has_Compatible_Representation): Minor tweaks. * sem_ch13.adb (Has_Compatible_Representation): Look directly into the (implementation) base types and simplifiy accordingly. * exp_ch5.adb (Change_Of_Representation): Adjust. * exp_ch6.adb (Expand_Actuals): Likewise.