aboutsummaryrefslogtreecommitdiff
path: root/gcc
AgeCommit message (Collapse)AuthorFilesLines
2021-10-03coroutines: Fail with a sorry when presented with a VLA [PR 101765].Iain Sandoe2-0/+55
We do not support this yet. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> PR c++/101765 gcc/cp/ChangeLog: * coroutines.cc (register_local_var_uses): Emit a sorry if we encounter a VLA in the coroutine local variables. gcc/testsuite/ChangeLog: * g++.dg/coroutines/pr101765.C: New test.
2021-10-03coroutines: Await expressions are not allowed in handlers [PR 99710].Iain Sandoe2-1/+41
C++20 [expr.await] / 2 An await-expression shall appear only in a potentially-evaluated expression within the compound-statement of a function-body outside of a handler. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> PR c++/99710 gcc/cp/ChangeLog: * coroutines.cc (await_statement_walker): Report an error if an await expression is found in a handler body. gcc/testsuite/ChangeLog: * g++.dg/coroutines/pr99710.C: New test.
2021-10-03coroutines: Fix ICE with an invalid await_suspend type [PR100673].John Eivind Helset2-1/+20
The reported ICE occurs when an invalid (non-template) type is found as the return for an await_suspend. Fixed by amending build_co_await to ensure that await_suspend return- type is a template-instantiation before checking to see if it is a valid coroutine handle type. Signed-off-by: John Eivind Helset <jehelset@gmail.com> Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> PR c++/100673 gcc/cp/ChangeLog: * coroutines.cc (build_co_await): Guard against NULL await_suspend types. gcc/testsuite/ChangeLog: * g++.dg/coroutines/pr100673.C: New test.
2021-10-03coroutines: Ensure co_await_exprs have TREE_SIDE_EFFECTS set [PR 101133].Iain Sandoe2-12/+43
Although it is not immediately evident from the symptoms, the PR is caused by a variable having a DECL_INITIAL() containing a co_await. This is not correct, since such expressions have side-effects. We were marking the overall co_await expression correctly, but if a consumer of that expression stripped out the underlying co_await_expr then the latter would not be properly marked. Fixed by marking both the underlying and any containing await expr with TREE_SIDE_EFFECTS. Also mark type-dependent co_await expressions. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> PR c++/101133 gcc/cp/ChangeLog: * coroutines.cc (build_co_await): Mark co_await_expr trees with TREE_SIDE_EFFECTS, also mark any containing expression. (finish_co_await_expr): Mark type-dependent co_await_expr trees with TREE_SIDE_EFFECTS. gcc/testsuite/ChangeLog: * g++.dg/coroutines/pr101133.C: New test.
2021-10-03coroutines: Look through NOPs for awaiter variables [PR 99575].Iain Sandoe2-0/+36
There was a missing STRIP_NOPS which meant that, in some cases, an awaiter variable could be hidden by a view-convert-expr. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> PR c++/99575 gcc/cp/ChangeLog: * coroutines.cc (build_co_await): Strip NOPs from candidate awaiter expressions before testing to see if they need a temporary. gcc/testsuite/ChangeLog: * g++.dg/coroutines/pr99575.C: New test.
2021-10-03options: check for CL_OPTIMIZATION only for cl_options.Martin Liska1-1/+2
gcc/ChangeLog: * toplev.c (toplev::main): Check opt_index if it is a part of cl_options.
2021-10-03Daily bump.GCC Administrator4-1/+26
2021-10-02[PR102563] Do not clobber range in operator_lshift::op1_range.Aldy Hernandez2-6/+22
We're clobbering the final range before we're done calculating it. Tested on x86-64 Linux. gcc/ChangeLog: PR tree-optimization/102563 * range-op.cc (operator_lshift::op1_range): Do not clobber range. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/pr102563.c: New test.
2021-10-02options: fix ASAN issue during saving of opt. optionsMartin Liska1-1/+1
gcc/ChangeLog: * toplev.c (toplev::main): save_decoded_options[0] is program name and so it should be skipped.
2021-10-02c-family: Fix bootstrap for targets defining TARGET_FORMAT_TYPES.Iain Sandoe1-1/+1
A recent improvement in Waddress causes a bootstrap failure on targets that define TARGET_FORMAT_TYPES since it cannot be NULL if defined to an address. There is no default for this target macro, and it would seem no purpose to defining it to NULL, so the warning appears reasonable. Fixed by removing the pointless test. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> gcc/c-family/ChangeLog: * c-format.c: Remove a test of TARGET_FORMAT_TYPES with NULL, this is not needed.
2021-10-01Use unsigned long long in asm-x86-linux-rdmsr.cH.J. Lu1-1/+1
Use unsigned long long for 64-bit integer since unsigned long is 32 bits for x32. * gcc.dg/analyzer/torture/asm-x86-linux-rdmsr.c (DECLARE_ARGS): Use unsigned long long for x86-64.
2021-10-02Daily bump.GCC Administrator8-1/+683
2021-10-02[PR102546] X << Y being non-zero implies X is also non-zero.Aldy Hernandez2-4/+37
This patch teaches this to range-ops. Tested on x86-64 Linux. gcc/ChangeLog: PR tree-optimization/102546 * range-op.cc (operator_lshift::op1_range): Teach range-ops that X << Y is non-zero implies X is also non-zero.
2021-10-01aarch64: enable cortex-x2 CPUPrzemyslaw Wirkus3-3/+5
Patch is adding 'cortex-x2' to -mcpu command line option. gcc/ChangeLog: * config/aarch64/aarch64-cores.def (AARCH64_CORE): New Cortex-X2 core. * config/aarch64/aarch64-tune.md: Regenerate. * doc/invoke.texi: Update docs.
2021-10-01aarch64: enable cortex-a710 CPUPrzemyslaw Wirkus3-2/+5
Patch is adding 'cortex-a710' to -mcpu command line option. gcc/ChangeLog: * config/aarch64/aarch64-cores.def (AARCH64_CORE): New Cortex-A710 core. * config/aarch64/aarch64-tune.md: Regenerate. * doc/invoke.texi: Update docs.
2021-10-01aarch64: enable cortex-a510 CPUPrzemyslaw Wirkus3-2/+7
Patch is adding 'cortex-a510' to -mcpu command line option. gcc/ChangeLog: * config/aarch64/aarch64-cores.def (AARCH64_CORE): New Cortex-A510 core. * config/aarch64/aarch64-tune.md: Regenerate. * doc/invoke.texi: Update docs.
2021-10-01Enhance -Waddress to detect more suspicious expressions [PR102103].Martin Sebor17-75/+722
Resolves: PR c/102103 - missing warning comparing array address to null gcc/ChangeLog: PR c/102103 * doc/invoke.texi (-Waddress): Update. * gengtype.c (write_types): Avoid -Waddress. * poly-int.h (POLY_SET_COEFF): Avoid using null. gcc/c-family/ChangeLog: PR c/102103 * c-common.c (decl_with_nonnull_addr_p): Handle members. Check and perform warning suppression. (c_common_truthvalue_conversion): Enhance warning suppression. gcc/c/ChangeLog: PR c/102103 * c-typeck.c (maybe_warn_for_null_address): New function. (build_binary_op): Call it. gcc/cp/ChangeLog: PR c/102103 * typeck.c (warn_for_null_address): Enhance. (cp_build_binary_op): Call it also for member pointers. gcc/fortran/ChangeLog: PR c/102103 * array.c: Remove an unnecessary test. * trans-array.c: Same. gcc/testsuite/ChangeLog: PR c/102103 * g++.dg/cpp0x/constexpr-array-ptr10.C: Suppress a valid warning. * g++.dg/warn/Wreturn-local-addr-6.C: Correct a cast. * gcc.dg/Waddress.c: Expect a warning. * c-c++-common/Waddress-3.c: New test. * c-c++-common/Waddress-4.c: New test. * g++.dg/warn/Waddress-5.C: New test. * g++.dg/warn/Waddress-6.C: New test. * g++.dg/warn/pr101219.C: Expect a warning. * gcc.dg/Waddress-3.c: New test.
2021-10-01Default to dwarf version 4 on hppa64-hpuxJohn David Anglin1-0/+10
2021-10-01 John David Anglin <danglin@gcc.gnu.org> gcc/ChangeLog: PR debug/102373 * config/pa/pa.c (pa_option_override): Default to dwarf version 4 on hppa64-hpux.
2021-10-01Update c-c++-common/tsan/atomic_stack.cH.J. Lu1-2/+1
Print out from __tsan_atomic32_fetch_add was removed by commit da7a5c09c86c3f639c63ce8843d6f21c915ae1c6 Author: Dmitry Vyukov <dvyukov@google.com> Date: Wed Jul 28 16:57:39 2021 +0200 tsan: don't print __tsan_atomic* functions in report stacks Currently __tsan_atomic* functions do FuncEntry/Exit using caller PC and then use current PC (pointing to __tsan_atomic* itself) during memory access handling. As the result the top function in reports involving atomics is __tsan_atomic* and the next frame points to user code. Remove FuncEntry/Exit in atomic functions and use caller PC during memory access handling. This removes __tsan_atomic* from the top of report stacks, so that they point right to user code. The motivation for this is performance. Some atomic operations are very hot (mostly loads), so removing FuncEntry/Exit is beneficial. This also reduces thread trace consumption (1 event instead of 3). __tsan_atomic* at the top of the stack is not necessary and does not add any new information. We already say "atomic write of size 4", "__tsan_atomic32_store" does not add anything new. It also makes reports consistent between atomic and non-atomic accesses. For normal accesses we say "previous write" and point to user code; for atomics we say "previous atomic write" and now also point to user code. Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D106966 * c-c++-common/tsan/atomic_stack.c: Don't expect print out from __tsan_atomic32_fetch_add.
2021-10-01c++: cv-qualified ref introduced by typedef [PR101783]qingzhe huang2-1/+13
The root cause of this bug is that it considers reference with cv-qualifiers as an error by generating value for variable "bad_quals". However, this is not correct for case of typedef. Here I quote spec [dcl.ref]/1 : "Cv-qualified references are ill-formed except when the cv-qualifiers are introduced through the use of a typedef-name ([dcl.typedef], [temp.param]) or decltype-specifier ([dcl.type.decltype]), in which case the cv-qualifiers are ignored." 2021-09-30 qingzhe huang <nickhuang99@hotmail.com> gcc/cp/ChangeLog: PR c++/101783 * tree.c (cp_build_qualified_type_real): Exclude typedef from error. gcc/testsuite/ChangeLog: PR c++/101783 * g++.dg/parse/pr101783.C: New test.
2021-10-01options: fix concat of options.Martin Liska1-2/+3
PR target/102552 gcc/c-family/ChangeLog: * c-common.c (parse_optimize_options): decoded_options[0] is used for program name, so merged_decoded_options should also respect that.
2021-10-01aarch64: fix AARCH64_FL_V9 flag valuePrzemyslaw Wirkus1-2/+3
Patch is fixing AARCH64_FL_V9 flag value which is now wrongly set due to merge error. gcc/ChangeLog: * config/aarch64/aarch64.h (AARCH64_FL_V9): Update value.
2021-10-01Remove shadowed oracle field.Aldy Hernandez2-3/+2
The m_oracle field in the path solver was shadowing the base class. This was causing subtle problems while calculating outgoing edges between blocks, because the query object being passed did not have an oracle set. This should further improve our solving ability. Tested on x86-64 Linux. gcc/ChangeLog: * gimple-range-path.cc (path_range_query::compute_ranges): Use get_path_oracle. * gimple-range-path.h (class path_range_query): Remove shadowed m_oracle field. (path_range_query::get_path_oracle): New.
2021-10-01ubsan: Move INT_MIN / -1 instrumentation from ↵Jakub Jelinek11-18/+174
-fsanitize=integer-divide-by-zero to -fsanitize=signed-integer-overflow [PR102515] As noted by Richi, in clang INT_MIN / -1 is instrumented under -fsanitize=signed-integer-overflow rather than -fsanitize=integer-divide-by-zero as we did and doing it in the former makes more sense, as it is overflow during division rather than division by zero. I've verified on godbolt that clang behaved that way since 3.2-ish times or so when sanitizers were added. Furthermore, we've been using -f{,no-}sanitize-recover=integer-divide-by-zero to decide on the float -fsanitize=float-divide-by-zero instrumentation _abort suffix. The case where INT_MIN / -1 is instrumented by one sanitizer and x / 0 by another one when both are enabled is slightly harder if the -f{,no-}sanitize-recover={integer-divide-by-zero,signed-integer-overflow} flags differ, then we need to emit both __ubsan_handle_divrem_overflow and __ubsan_handle_divrem_overflow_abort calls guarded by their respective checks rather than one guarded by check1 || check2. 2021-10-01 Jakub Jelinek <jakub@redhat.com> Richard Biener <rguenther@suse.de> PR sanitizer/102515 gcc/ * doc/invoke.texi (-fsanitize=integer-divide-by-zero): Remove INT_MIN / -1 division detection from here ... (-fsanitize=signed-integer-overflow): ... and add it here. gcc/c-family/ * c-ubsan.c (ubsan_instrument_division): Check the right flag_sanitize_recover bit, depending on which sanitization is done. Sanitize INT_MIN / -1 under SANITIZE_SI_OVERFLOW rather than SANITIZE_DIVIDE. If both SANITIZE_SI_OVERFLOW and SANITIZE_DIVIDE is enabled, neither check is known to be false and flag_sanitize_recover bits for those two aren't the same, emit both __ubsan_handle_divrem_overflow and __ubsan_handle_divrem_overflow_abort calls. gcc/c/ * c-typeck.c (build_binary_op): Call ubsan_instrument_division for division even for SANITIZE_SI_OVERFLOW. gcc/cp/ * typeck.c (cp_build_binary_op): Call ubsan_instrument_division for division even for SANITIZE_SI_OVERFLOW. gcc/testsuite/ * c-c++-common/ubsan/div-by-zero-3.c: Use -fsanitize=signed-integer-overflow instead of -fsanitize=integer-divide-by-zero. * c-c++-common/ubsan/div-by-zero-5.c: Likewise. * c-c++-common/ubsan/div-by-zero-4.c: Likewise. Add -fsanitize-undefined-trap-on-error. * c-c++-common/ubsan/float-div-by-zero-2.c: New test. * c-c++-common/ubsan/overflow-div-1.c: New test. * c-c++-common/ubsan/overflow-div-2.c: New test. * c-c++-common/ubsan/overflow-div-3.c: New test.
2021-10-01aarch64: Fix cpymem-size.c test for ILP32Kyrylo Tkachov1-2/+2
gcc/testsuite/ * gcc.target/aarch64/cpymem-size.c: Adjust scan for ilp32.
2021-10-01aarch64: add armv9-a to -marchPrzemyslaw Wirkus3-1/+9
gcc/ChangeLog: * config/aarch64/aarch64-arches.def (AARCH64_ARCH): Added armv9-a. * config/aarch64/aarch64.h (AARCH64_FL_V9): New. (AARCH64_FL_FOR_ARCH9): New flags for Armv9-A. (AARCH64_ISA_V9): New ISA flag. * doc/invoke.texi: Update docs.
2021-10-01Fix bb-slp-pr97709.c after computed goto changeAndrew Pinski1-1/+1
Looks like I tested the change for bb-slp-pr97709.c on an older tree which did not have the error message so I had missed one more place where the change was needed. Anyways committed after testing to make sure the testcase passes now. gcc/testsuite/ChangeLog: * gcc.dg/vect/bb-slp-pr97709.c: Fix for computed goto pointers.
2021-10-01Append target/optimize attr to the current cmdline.Martin Liska7-6/+56
gcc/c-family/ChangeLog: * c-common.c (parse_optimize_options): Combine optimize options with what was provided on the command line. gcc/ChangeLog: * toplev.c (toplev::main): Save decoded optimization options. * toplev.h (save_opt_decoded_options): New. * doc/extend.texi: Be more clear about optimize and target attributes. gcc/testsuite/ChangeLog: * gcc.target/i386/avx512er-vrsqrt28ps-3.c: Disable fast math. * gcc.target/i386/avx512er-vrsqrt28ps-5.c: Likewise. * gcc.target/i386/attr-optimize.c: New test.
2021-10-01Fix ICE with stack checking emulation at -O2Eric Botcazou1-1/+8
On bare-metal platforms, the Ada compiler emulates stack checking (it is required by the language and tested by ACATS) in the runtime via the stack_check_libfunc hook of the RTL middle-end. Calls to the function are generated as libcalls but they now require a proper function type at -O2 or above. gcc/ * explow.c: Include langhooks.h. (set_stack_check_libfunc): Build a proper function type.
2021-10-01Fix PR c++/64697 at -O1 or aboveEric Botcazou1-13/+8
The BFD fix eliminates the link failure and working code is generated at -O0, but _not_ when optimization is enabled because the optimizer changes: movq .refptr._ZTH1s(%rip), %rax testq %rax, %rax je .L2 call _ZTH1s into: leaq _ZTH1s(%rip), %rax testq %rax, %rax je .L2 call _ZTH1s and the leaq now also gets the relocation overflow. So the fix is to teach legitimate_pic_address_disp_p to reject the transformation when the symbol is an external weak function, which yields: cmpq $0, .refptr._ZTH1s(%rip) je .L2 call _ZTH1s and the cmpq keeps a relocation that does not overflow. gcc/ PR c++/64697 * config/i386/i386.c (legitimate_pic_address_disp_p): For PE-COFF do not return true for external weak function symbols in medium model.
2021-10-01openmp: Differentiate between order(concurrent) and ↵Jakub Jelinek11-10/+53
order(reproducible:concurrent) While OpenMP 5.1 implies order(concurrent) is the same thing as order(reproducible:concurrent), this is going to change in OpenMP 5.2, where essentially order(concurrent) means nothing is stated on whether it is reproducible or unconstrained (and is determined by other means, e.g. for/do with schedule static or runtime with static being selected is implicitly reproducible, distribute with dist_schedule static is implicitly reproducible, loop is implicitly reproducible) and when the modifier is specified explicitly, it overrides the implicit behavior either way. And, when order(reproducible:concurrent) is used with e.g. schedule(dynamic) or some other schedule that is by definition not reproducible, it is implementation's duty to ensure it is reproducible, either by remembering how it scheduled some loop and then replaying the same schedule when seeing loops with the same directive/schedule/number of iterations, or by overriding the schedule to some reproducible one. This patch doesn't implement the 5.2 wording just yet, but in the FEs differentiates between the 3 states - no explicit modifier, explicit reproducible or explicit unconstrainted, so that the middle-end can easily switch any time. Instead it follows the 5.1 wording where both order(concurrent) (implicit or explicit) or order(reproducible:concurrent) imply reproducibility. And, it implements the easier method, when for/do should be reproducible, it just chooses static schedule. order(concurrent) implies no OpenMP APIs in the loop body nor threadprivate vars, so the exact scheduling isn't (easily at least) observable. 2021-10-01 Jakub Jelinek <jakub@redhat.com> gcc/ * tree.h (OMP_CLAUSE_ORDER_REPRODUCIBLE): Define. * tree-pretty-print.c (dump_omp_clause) <case OMP_CLAUSE_ORDER>: Print reproducible: for OMP_CLAUSE_ORDER_REPRODUCIBLE. * omp-general.c (omp_extract_for_data): If OMP_CLAUSE_ORDER is seen without OMP_CLAUSE_ORDER_UNCONSTRAINED, overwrite sched_kind to OMP_CLAUSE_SCHEDULE_STATIC. gcc/c-family/ * c-omp.c (c_omp_split_clauses): Also copy OMP_CLAUSE_ORDER_REPRODUCIBLE. gcc/c/ * c-parser.c (c_parser_omp_clause_order): Set OMP_CLAUSE_ORDER_REPRODUCIBLE for explicit reproducible: modifier. gcc/cp/ * parser.c (cp_parser_omp_clause_order): Set OMP_CLAUSE_ORDER_REPRODUCIBLE for explicit reproducible: modifier. gcc/fortran/ * gfortran.h (gfc_omp_clauses): Add order_reproducible bitfield. * dump-parse-tree.c (show_omp_clauses): Print REPRODUCIBLE: for it. * openmp.c (gfc_match_omp_clauses): Set order_reproducible for explicit reproducible: modifier. * trans-openmp.c (gfc_trans_omp_clauses): Set OMP_CLAUSE_ORDER_REPRODUCIBLE for order_reproducible. (gfc_split_omp_clauses): Also copy order_reproducible. gcc/testsuite/ * gfortran.dg/gomp/order-5.f90: Adjust scan-tree-dump-times regexps. libgomp/ * testsuite/libgomp.c-c++-common/order-reproducible-1.c: New test. * testsuite/libgomp.c-c++-common/order-reproducible-2.c: New test.
2021-10-01c++: Fix handling of __thread/thread_local extern vars declared at function ↵Jakub Jelinek3-1/+32
scope [PR102496] The introduction of push_local_extern_decl_alias in r11-3699-g4e62aca0e0520e4ed2532f2d8153581190621c1a broke tls vars, while the decl they are created for has the tls model set properly, nothing sets it for the alias that is actually used, so accesses to it are done as if they were normal variables. This is then diagnosed at link time if the definition of the extern vars is __thread/thread_local. 2021-10-01 Jakub Jelinek <jakub@redhat.com> PR c++/102496 * name-lookup.c (push_local_extern_decl_alias): Return early even for tls vars with non-dependent type when processing_template_decl. For CP_DECL_THREAD_LOCAL_P vars call set_decl_tls_model on alias. * g++.dg/tls/pr102496-1.C: New test. * g++.dg/tls/pr102496-2.C: New test.
2021-10-01middle-end/102518 - avoid invalid GIMPLE during inliningRichard Biener2-1/+17
When inlining we have to avoid mapping a non-lvalue parameter value into a context that prevents the parameter to be a register. Formerly the register were TREE_ADDRESSABLE but now it can be just DECL_NOT_GIMPLE_REG_P. 2021-09-30 Richard Biener <rguenther@suse.de> PR middle-end/102518 * tree-inline.c (setup_one_parameter): Avoid substituting an invariant into contexts where a GIMPLE register is not valid. * gcc.dg/torture/pr102518.c: New testcase.
2021-10-01[Ada] Subprogram_Variant in ignored ghost codeBob Duff1-0/+1
gcc/ada/ * exp_ch6.adb (Expand_Call_Helper): Do not call Check_Subprogram_Variant if the subprogram is an ignored ghost entity. Otherwise the compiler crashes (in debug builds) or gives strange error messages (in production builds).
2021-10-01[Ada] Empty CUDA_Global procedures when compiling for hostGhjuvan Lacambre1-14/+78
gcc/ada/ * gnat_cuda.adb (Empty_CUDA_Global_Subprograms): New procedure. (Expand_CUDA_Package): Call Empty_CUDA_Global_Subprograms.
2021-10-01[Ada] Improved checking for invalid index values when accessing array elementsSteve Baird3-11/+189
gcc/ada/ * checks.ads: Define a type Dimension_Set. Add an out-mode parameter of this new type to Generate_Index_Checks so that callers can know for which dimensions a check was generated. Add an in-mode parameter of this new type to Apply_Subscript_Validity_Checks so that callers can indicate that no check is needed for certain dimensions. * checks.adb (Generate_Index_Checks): Implement new Checks_Generated parameter. (Apply_Subscript_Validity_Checks): Implement new No_Check_Needed parameter. * exp_ch4.adb (Expand_N_Indexed_Component): Call Apply_Subscript_Validity_Checks in more cases than before. This includes declaring two new local functions, (Is_Renamed_Variable_Name, Type_Requires_Subscript_Validity_Checks_For_Reads): To help in deciding whether to call Apply_Subscript_Validity_Checks. Adjust to parameter profile changes in Generate_Index_Checks and Apply_Subscript_Validity_Checks.
2021-10-01[Ada] Document rounding mode assumed for dynamic floating-point computationsEric Botcazou2-13/+13
gcc/ada/ * doc/gnat_rm/implementation_defined_characteristics.rst: Document the rounding mode assumed for dynamic computations as per 3.5.7(16). * gnat_rm.texi: Regenerate.
2021-10-01[Ada] More work on efficiency improvementsBob Duff11-361/+590
gcc/ada/ * table.ads (Table_Type): Remove "aliased"; no longer needed by Atree. Besides it contradicted the comment a few lines above, "-- Note: We do not make the table components aliased...". * types.ads: Move type Slot to Atree. * atree.ads: Move type Slot fromt Types to here. Move type Node_Header from Seinfo to here. * atree.adb: Avoid the need for aliased components of the Slots table. Instead of 'Access, use a getter and setter. Misc cleanups. (Print_Statistics): Print statistics about node and entity kind frequencies. Give 3 digit fractions instead of percentages. * (Get_Original_Node_Count, Set_Original_Node_Count): Statistics for calls to Original_Node and Set_Original_Node. (Original_Node, Set_Original_Node): Gather statistics by calling the above. (Print_Field_Statistics): Print Original_Node statistics. (Update_Kind_Statistics): Remove, and put all statistics gathering under "if Atree_Statistics_Enabled", which is a flag generated in Seinfo by Gen_IL. * gen_il-gen.adb (Compute_Field_Offsets): Choose offsets of Nkind, Ekind, and Homonym first. This causes a slight efficiency improvement. Misc cleanups. Do not generate Node_Header; it is now hand-written in Atree. When choosing the order in which to assign offsets, weight by the frequency of the node type, so the more common nodes get their field offsets assigned earlier. Add more special cases. (Compute_Type_Sizes): Remove this and related things. There was a comment: "At some point we can instrument Atree to print out accurate size statistics, and remove this code." We have Atree statistics, so we now remove this code. (Put_Seinfo): Generate Atree_Statistics_Enabled, which is equal to Statistics_Enabled. This allows Atree to say "if Atree_Statistics_Enabled then <gather statistics>" for efficiency. When Atree_Statistics_Enabled is False, the "if ..." will be optimized away. * gen_il-internals.ads (Type_Frequency): New table of kind frequencies. * gen_il-internals.adb: Minor comment improvement. * gen_il-fields.ads: Remove unused subtypes. Suppress style checks in the Type_Frequency table. If we regenerate this table (see -gnatd.A) we don't want to have to fiddle with casing. * impunit.adb: Minor. * sinfo-utils.adb: Minor. * debug.adb: Minor comment improvement.
2021-10-01[Ada] Add missing guard before call to Interface_Present_In_AncestorEric Botcazou1-1/+2
gcc/ada/ * sem_type.adb (Specific_Type): Check that the type is tagged before calling Interface_Present_In_Ancestor on it.
2021-10-01[Ada] Add new debug switch -gnatd.8Eric Botcazou2-1/+7
gcc/ada/ * debug.adb (d.8): Document usage. * fe.h (Debug_Flag_Dot_8): Declare.
2021-10-01[Ada] Spurious warning about hiding in generic instantiationGary Dismukes1-0/+4
gcc/ada/ * sem_util.adb (Enter_Name): Suppress hiding warning when in an instance.
2021-10-01[Ada] Crash on improper use of GNAT attribute Type_KeyEd Schonberg2-1/+10
gcc/ada/ * sem_attr.adb (Analyze_Attribute, case Type_Key): Attribute can be applied to a formal type. * sem_ch5.adb (Analyze_Case_Statement): If Extensions_Allowed is not enabled, verify that the type of the expression is discrete.
2021-10-01[Ada] Crash on renaming within declare expressionJustin Squirek1-1/+3
gcc/ada/ * exp_dbug.adb (Debug_Renaming_Declaration): Add check for Entity present for Ren to prevent looking at unanalyzed nodes
2021-10-01[Ada] Fix CodePeer warningsGhjuvan Lacambre2-0/+5
gcc/ada/ * atree.adb (Print_Statistics): Help CodePeer see Total as greater than zero. * gen_il-gen.adb (One_Comp): Annotate Field_Table as Modified.
2021-10-01[Ada] Add Evaluable_Kind and Global_Name_KindRichard Kenner2-0/+19
gcc/ada/ * gen_il-gen-gen_entities.adb (Evaluable_Kind, Global_Name_Kind): Add. * gen_il-types.ads (Evaluable_Kind, Global_Name_Kind): Likewise.
2021-10-01[Ada] Stub CUDA_Device aspectGhjuvan Lacambre7-5/+110
gcc/ada/ * aspects.ads: Add CUDA_Device aspect. * gnat_cuda.ads (Add_CUDA_Device_Entity): New subprogram. * gnat_cuda.adb: (Add_CUDA_Device_Entity): New subprogram. (CUDA_Device_Entities_Table): New hashmap for CUDA_Device entities. (Get_CUDA_Device_Entities): New internal subprogram. (Set_CUDA_Device_Entities): New internal subprogram. * par-prag.adb (Prag): Handle pragma id Pragma_CUDA_Device. * sem_prag.ads (Aspect_Specifying_Pragma): Mark CUDA_Device as being both aspect and pragma. * sem_prag.adb (Analyze_Pragma): Add CUDA_Device entities to list of CUDA_Entities belonging to package N. (Sig_Flags): Signal CUDA_Device entities as referenced. * snames.ads-tmpl: Create CUDA_Device names and pragmas.
2021-10-01[Ada] Assert_Failure on derived type with inherited Default_Initial_ConditionGary Dismukes1-44/+3
gcc/ada/ * exp_util.adb (Build_DIC_Procedure_Body): Remove inappropriate Assert pragma. Remove unneeded and dead code related to derived private types.
2021-10-01[Ada] Add more node unionsRichard Kenner3-13/+51
gcc/ada/ * gen_il-gen-gen_nodes.adb (N_Alternative, N_Is_Case_Choice): Add. (N_Is_Exception_Choice, N_Is_Range): Likewise. * gen_il-types.ads: Add above names. * gen_il-gen.adb (Put_Union_Membership): Write both declarations and definitions of union functions.
2021-10-01[Ada] Implementation of AI12-0212: iterator specs in array aggregates (II)Ed Schonberg1-6/+17
gcc/ada/ * exp_aggr.adb (Expand_Array_Aggregate, Two_Pass_Aggregate_Expansion): Increment index for element insertion within the loop, only if upper bound has not been reached.
2021-10-01[Ada] Ada2022: AI12-0195 overriding class-wide pre/postconditionsJavier Miranda26-974/+2804
gcc/ada/ * contracts.ads (Make_Class_Precondition_Subps): New subprogram. (Merge_Class_Conditions): New subprogram. (Process_Class_Conditions_At_Freeze_Point): New subprogram. * contracts.adb (Check_Class_Condition): New subprogram. (Set_Class_Condition): New subprogram. (Analyze_Contracts): Remove code analyzing class-wide-clone subprogram since it is no longer built. (Process_Spec_Postconditions): Avoid processing twice seen subprograms. (Process_Preconditions): Simplify its functionality to non-class-wide preconditions. (Process_Preconditions_For): No action needed for wrappers and helpers. (Make_Class_Precondition_Subps): New subprogram. (Process_Class_Conditions_At_Freeze_Point): New subprogram. (Merge_Class_Conditions): New subprogram. * exp_ch6.ads (Install_Class_Preconditions_Check): New subprogram. * exp_ch6.adb (Expand_Call_Helper): Install class-wide preconditions check on dispatching primitives that have or inherit class-wide preconditions. (Freeze_Subprogram): Remove code for null procedures with preconditions. (Install_Class_Preconditions_Check): New subprogram. * exp_util.ads (Build_Class_Wide_Expression): Lower the complexity of this subprogram; out-mode formal Needs_Wrapper since this functionality is now provided by a new subprogram. (Get_Mapped_Entity): New subprogram. (Map_Formals): New subprogram. * exp_util.adb (Build_Class_Wide_Expression): Lower the complexity of this subprogram. Its previous functionality is now provided by subprograms Needs_Wrapper and Check_Class_Condition. (Add_Parent_DICs): Map the overridden primitive to the overriding one. (Get_Mapped_Entity): New subprogram. (Map_Formals): New subprogram. (Update_Primitives_Mapping): Adding assertion. * freeze.ads (Check_Inherited_Conditions): Subprogram made public with added formal to support late overriding. * freeze.adb (Check_Inherited_Conditions): New implementation; builds the dispatch table wrapper required for class-wide pre/postconditions; added support for late overriding. (Needs_Wrapper): New subprogram. * sem.ads (Inside_Class_Condition_Preanalysis): New global variable. * sem_disp.ads (Covered_Interface_Primitives): New subprogram. * sem_disp.adb (Covered_Interface_Primitives): New subprogram. (Check_Dispatching_Context): Skip checking context of dispatching calls during preanalysis of class-wide conditions since at that stage the expression is not installed yet on its definite context. (Check_Dispatching_Call): Skip checking 6.1.1(18.2/5) by AI12-0412 on helpers and wrappers internally built for supporting class-wide conditions; for late-overriding subprograms call Check_Inherited_Conditions to build the dispatch-table wrapper (if required). (Propagate_Tag): Adding call to Install_Class_Preconditions_Check. * sem_util.ads (Build_Class_Wide_Clone_Body): Removed. (Build_Class_Wide_Clone_Call): Removed. (Build_Class_Wide_Clone_Decl): Removed. (Class_Condition): New subprogram. (Nearest_Class_Condition_Subprogram): New subprogram. * sem_util.adb (Build_Class_Wide_Clone_Body): Removed. (Build_Class_Wide_Clone_Call): Removed. (Build_Class_Wide_Clone_Decl): Removed. (Class_Condition): New subprogram. (Nearest_Class_Condition_Subprogram): New subprogram. (Eligible_For_Conditional_Evaluation): No need to evaluate class-wide conditions during preanalysis since the expression is not installed on its definite context. * einfo.ads (Class_Wide_Clone): Removed. (Class_Postconditions): New attribute. (Class_Preconditions): New attribute. (Class_Preconditions_Subprogram): New attribute. (Dynamic_Call_Helper): New attribute. (Ignored_Class_Postconditions): New attribute. (Ignored_Class_Preconditions): New attribute. (Indirect_Call_Wrapper): New attribute. (Is_Dispatch_Table_Wrapper): New attribute. (Static_Call_Helper): New attribute. * exp_attr.adb (Expand_N_Attribute_Reference): When the prefix is of an access-to-subprogram type that has class-wide preconditions and an indirect-call wrapper of such subprogram is available, replace the prefix by the wrapper. * exp_ch3.adb (Build_Class_Condition_Subprograms): New subprogram. (Register_Dispatch_Table_Wrappers): New subprogram. * exp_disp.adb (Build_Class_Wide_Check): Removed; class-wide precondition checks now rely on internally built helpers. * sem_ch13.adb (Analyze_Aspect_Specifications): Set initial value of attributes Class_Preconditions, Class_Postconditions, Ignored_Class_Preconditions and Ignored_Class_Postconditions. These values are later updated with the full pre/postcondition by Merge_Class_Conditions. (Freeze_Entity_Checks): Call Process_Class_Conditions_At_Freeze_Point. * sem_ch6.adb (Analyze_Subprogram_Body_Helper): Remove code building the body of the class-wide clone subprogram since it is no longer required. (Install_Entity): Adding assertion. * sem_prag.adb (Analyze_Pre_Post_Condition_In_Decl_Part): Remove code building and analyzing the class-wide clone subprogram; no longer required. (Build_Pragma_Check_Equivalent): Adjust call to Build_Class_Wide_Expression since the formal named Needs_Wrapper has been removed. * sem_attr.adb (Analyze_Attribute_Old_Result): Skip processing these attributes during preanalysis of class-wide conditions since at that stage the expression is not installed yet on its definite context. * sem_res.adb (Resolve_Actuals): Skip applying RM 3.9.2(9/1) and SPARK RM 6.1.7(3) on actuals of internal helpers and wrappers built to support class-wide preconditions. * sem_ch5.adb (Process_Bounds): Do not generate a constant declaration for the bounds when we are preanalyzing a class-wide condition. (Analyze_Loop_Parameter_Specification): Handle preanalysis of quantified expression placed in the outermost expression of a class-wide condition. * ghost.adb (Check_Ghost_Context): No check required during preanalysis of class-wide conditions. * gen_il-fields.ads (Opt_Field_Enum): Adding Class_Postconditions, Class_Preconditions, Class_Preconditions_Subprogram, Dynamic_Call_Helper, Ignored_Class_Postconditions, Ignored_Class_Preconditions, Indirect_Call_Wrapper, Is_Dispatch_Table_Wrapper, Static_Call_Helper. * gen_il-gen-gen_entities.adb (Is_Dispatch_Table_Wrapper): Adding semantic flag Is_Dispatch_Table_Wrapper; removing semantic field Class_Wide_Clone; adding semantic fields for Class_Postconditions, Class_Preconditions, Class_Preconditions_Subprogram, Dynamic_Call_Helper, Ignored_Class_Postconditions, Indirect_Call_Wrapper, Ignored_Class_Preconditions, and Static_Call_Helper.