aboutsummaryrefslogtreecommitdiff
path: root/gcc
AgeCommit message (Collapse)AuthorFilesLines
2020-10-21[Ada] Use index parameter for iterated_component_associationPiotr Trojanek1-7/+2
gcc/ada/ * sem_aggr.adb (Resolve_Iterated_Component_Association): Use existing defining identifier for index parameter.
2020-10-21[Ada] Wrong detection of potentially blocking call in protected objectJavier Miranda1-0/+12
gcc/ada/ * exp_ch9.adb (Build_Task_Activation_Call): Do not generate a call to activate tasks if we are within the scope of a protected type and pragma Detect_Blocking is active.
2020-10-21[Ada] Codepeer remarks take into accountLiaiss Merzougue14-16/+229
gcc/ada/ * libgnat/s-carsi8.adb (Compare_Array_S8): Add pragma Assert to avoid warning concerning Left_Len and RighLen value regarding Bytes_Compared_As_Words. * libgnat/s-carun8.adb (Compare_Array_U8): Likewise. * libgnat/s-geveop.adb (Binary_Operation, Unary_Operation): Add pragma Assert concerning divide by 0 warning. * libgnat/s-imgcha.adb (Image_Character): Code update to prevent constant operation warning. (Image_Character): Add pragma Assert concerning the unchecked String size. * libgnat/s-imgdec.adb (Round): Upate loop code to prevent warning concerning Digs'First access. (Round): Add pragma assert. (Set): Add pragma Assert for the unchecked string size. (Set_Digits): Add pragma Assert for the input range. (Set_Decimal_Digits): Add pragma Assert. (Set_Blank_And_Sign): Add pragma Assert for the input range. * libgnat/s-arit64.adb (DoubleDivide): Add pragma Assert concerning Du /= 0. (Multiply_With_Ovflo_Check): Add pragma Annotate to avoid warning concerning unsigned -> signed conversion. * libgnat/s-imguns.adb (Set_Image_Unsigned): Add pragma Assert to prevent overflow check warning. Add pragma Assert for controlling S'First = 1. * libgnat/s-imgrea.adb (Image_Floating_Point, Set, Set_Digs, Set_Special_Fill, Convert_Integer): Add pragma Annotate to prevent overflow check warning. (Set_Image_Real): Add pragma Annotate to avoid dead code warning on float check. Add pragma Assert to prevent overflow check warning. * libgnat/s-imgwiu.adb (Set_Digits, Set_Image_Width_Unsigned): Add pragma assert to prevent overflow check warning. * libgnat/s-imgllu.adb (Set_Image_Long_Long_Unsigned): Add pragma assert to prevent overflow check warning. * libgnat/s-imgint.adb (Set_Digits): Add Assert for input constraint and to prevent overflow check warning, create Non_Positive subtype, and change the T parameter as Non_Positive instead Integer. (Set_Image_Integer): Add pragma assert to prevent overflow check warning. * libgnat/s-imglli.adb (Set_Digits): Add Assert for input constraint and to prevent overflow check warning, create Non_Positive subtype, and change the T parameter as Non_Positive instead Integer. (Set_Image_Long_Long_Integer): Add pragma assert to prevent overflow check warning. * libgnat/s-fatgen.adb (Decompose, Pred, Succ): Add pragma Annotate to prevent dead code due to invalid float check. * libgnat/s-imenne.adb (Image_Enumeration_8, Image_Enumeration_16, Image_Enumeration_32): Add pragma Assert to prevent overflow check warning. Add Names_Index subtype for restricting Index_table content.
2020-10-21[Ada] Compiler crash on prefixed call to controlled function with invariant ↵Gary Dismukes1-0/+3
check gcc/ada/ * exp_ch6.adb (Insert_Post_Call_Actions): Test for N_Explicit_Dereference as part of the existing test for function calls.
2020-10-21[Ada] Fix bogus error for bit-packed array with volatile componentEric Botcazou1-1/+4
gcc/ada/ * freeze.adb (Check_Strict_Alignment): Do not set the flag for a bit-packed array type, even if it is a by-reference type.
2020-10-21[Ada] Improve precision of Ada.Directories.Modification_TimeDmitriy Anisimkov2-24/+115
gcc/ada/ * adaint.c (__gnat_file_time): New routine. (__gnat_copy_attribs): Copy timestamps in nanoseconds. * libgnat/a-direct.adb (C_Modification_Time): Bind to __gnat_file_time. (Modification_Time): Call to C_Modification_Time.
2020-10-21[Ada] Fix crash with iterated_component_association and -gnatcPiotr Trojanek1-1/+7
gcc/ada/ * sem_aggr.adb (Resolve_Iterated_Component_Association): Expression's copy and now has the same parent as the original expression. (Resolve_Array_Aggregate): Add ??? comment about a still existing minor issue that led to discovery of the above crash.
2020-10-21[Ada] Spurious error in current instance used as formal packageJavier Miranda1-132/+90
gcc/ada/ * sem_ch12.adb (Install_Parents_Of_Generic_Context): Simplify functionality; collect and install parents of generic child package. (Remove_Parents_Of_Generic_Context): Code cleanup. (Instantiate_Package_Body): Hide parents of generic context from visibility before installing the parent instance; restore their visibility when the instance is analyzed
2020-10-21[Ada] Remove -mthreads from Linker_Options pragma for x86-lynx178eDoug Rupp1-4/+0
gcc/ada/ * libgnarl/s-osinte__lynxos178e.ads: Remove -mthreads switch.
2020-10-21[Ada] Use VxWorks 7 APIs for accessing environment variables in kernel modePatrick Bernardi1-11/+20
gcc/ada/ * env.c (__gnat_setenv): call setenv for VxWorks 7 kernel mode. (__gnat_environ): envGet takes an int instead of a NULL pointer. (__gnat_unsetenv): call unsetenv for VxWorks 7 kernel mode. (__gnat_clearenv): use __gnat_unsetenv to clear environment variables.
2020-10-21[Ada] Use helper function in Freeze_Subprogram_BodyEric Botcazou1-12/+4
gcc/ada/ * sem_ch12.adb (Freeze_Subprogram_Body): Call Package_Freeze_Node to retrieve the freeze node for the enclosing body of the generic.
2020-10-21[Ada] Incorrect associations for extra accessibility parametersJustin Squirek1-12/+12
gcc/ada/ * exp_ch6.adb (Expand_Call_Helper): Modify calls to Add_Extra_Actual to use Extra_Accessibility instead of Get_Accessibility for the EF parameter.
2020-10-21[Ada] Make minimum accessibility level a constant objectPiotr Trojanek2-7/+8
gcc/ada/ * exp_ch6.adb (Expand_Actuals): Whitespace cleanup. * sem_ch6.adb (Analyze_Subprogram_Body_Helper): Make minimum accessibility a constant object.
2020-10-21[Ada] Simplify the VxWorks implementation of __gnat_environPatrick Bernardi1-21/+6
gcc/ada/ * env.c (__gnat_environ): For VxWorks kernel simply return the result of the envGet call. Do this for VxWorks 6 and 7 as they both support the same API.
2020-10-21[Ada] Disable warnings on entities when building finalizersGhjuvan Lacambre1-0/+8
gcc/ada/ * exp_ch7.adb (Build_Finalizer): Disable warnings on referenced entity.
2020-10-21[Ada] Fix typos and style in comments related to Default_Initial_ConditionPiotr Trojanek3-4/+4
gcc/ada/ * einfo.ads, sem_ch3.adb, sem_util.adb: Fix comments.
2020-10-21[Ada] Spurious error in taft ammendment derivation of CPP typeJavier Miranda1-0/+7
gcc/ada/ * sem_ch3.adb (Build_Derived_Type): Propagate convention of class-wide parent.
2020-10-21[Ada] Raise Capacity_Error on formal vector insertionClaire Dross1-2/+8
gcc/ada/ * libgnat/a-cofove.adb (Copy): Add explanation in case of Capacity_Error. (Insert_Space): Raise Capacity_Error if the new length is greater than the capacity. (Reserve_Capacity): Raise Capacity_Error instead of Constraint_Error.
2020-10-21aarch64: [testsuite] Fix typo in diagnostic messageAndrea Corallo1-1/+1
gcc/testsuite/ChangeLog 2020-10-21 Andrea Corallo <andrea.corallo@arm.com> * gcc.target/aarch64/advsimd-intrinsics/vstX_lane.c (CMT): Adopt the same style used in the rest of the file.
2020-10-21Fix discrepancy in Walloca test on 32-bit systems.Aldy Hernandez1-1/+1
There is a discrepancy in the way we report -Walloca-larger-than= errors on 32-bit versus 64-bit architectures, due to the nature of ranges derived from a cast operation. For the Walloca-1 tests on 64-bits we get: int num.0_1; long unsigned int _2; <bb 2> [local count: 1073741824]: num.0_1 = num; _2 = (long unsigned int) num.0_1; s_8 = __builtin_alloca (_2); Because of the cast of a 32-bit quantity into a 64-bit quantity in _2, ranger calculates its range as: long unsigned int [0, 2147483647][18446744071562067968, +INF] Thus excluding the numbers that can't exist in _2. This causes the Walloca pass to report that the argument to alloca may be too large. However, for -m32 on x86, the gimple is: int num.0_1; unsigned int num.1_2; <bb 2> [local count: 1073741824]: num.0_1 = num; num.1_2 = (unsigned int) num.0_1; s_8 = __builtin_alloca (num.1_2); Since num.0_1 and num.1_2 are of the same size, we cannot determine any useful range, so we return VARYING. In the Walloca pass, VARYING basically means "unbounded" (no known bounds for the alloca call argument). So on 32-bits, the error message issued is slightly different: warning: unbounded use of ‘alloca’ versus on 64-bits, where due to the cast, it is: warning: argument to ‘alloca’ may be too large In reality both versions of the IL show an unbounded call, but in one version (64-bits) we can exclude some values so we assume the range was provided, but it was out of bounds. I've mentioned various times that all these diagnostics passes (alloca, restrict, printf, etc), could benefit from less specific error messages since what we have can potentially confuse the user. However, no consensus has been reached on how to report these things. In the meantime, this patch adjusts the testcase to accept both variants. gcc/testsuite/ChangeLog: * gcc.dg/Walloca-1.c: Adjust for 32-bits.
2020-10-21Daily bump.GCC Administrator5-1/+645
2020-10-20Handle 16 bit targets in diagnostic pruningJeff Law1-1/+2
gcc/testsuite * gcc.dg/Wbuiltin-declaration-mismatch-9.c: Improve pruning of invalid scanf call messages.
2020-10-20Temporarily disable trap in in extract_range_builtin check.Andrew MacLeod2-0/+52
Until we figure out how to adjust ubsan for symbolics, disable the trap. gcc/ChangeLog: PR tree-optimization/97505 * vr-values.c (vr_values::extract_range_basic): Trap if vr_values version disagrees with range_of_builtin_call.
2020-10-20libgo: adjust NetBSD-specific types for stable syscall APINikhil Benesch1-1/+1
The backwards-compatibility guarantees of the syscall package require some munging of the C API inferred by mksysinfo.sh. Specifically, the RTM_RESOLVE constant must be added if it is missing, and the stat_t struct must use the suffix "timespec" rather than "tim" for its time-related fields. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/263519
2020-10-20rs6000: Allow -mabi=no-altivec override on command line for AIX.David Edelsohn1-1/+3
The override options machinery to set rs6000_altivec_abi for AIX doesn't check if the option is set on the command line. This patch checks for a command line option to not override it. gcc/ChangeLog: * config/rs6000/rs6000.c (rs6000_option_override_internal): Don't implcitly enable Altivec ABI if set on the command line.
2020-10-20c++: block-scope extern decl with default argsNathan Sidwell2-0/+59
In adding the DECL_LOCAL_DECL handling, I'd forgotten that the parm-decls also need cloning -- and resetting of their DECL_CONTEXT. Also, any default args need droping when adding an alias, as those are not propagated. The std's not totally clear on this latter point when there's no exising namespace decl, but that seems like the right thing and is what clang does. gcc/cp/ * name-lookup.c (push_local_extern_decl_alias): Reconstextualize alias' parm decls. Drop any default args. gcc/testsuite/ * g++.dg/lookup/local-extern.C: New.
2020-10-20Convert -Wrestrict pass to ranger.Aldy Hernandez6-41/+102
There is one adjustment to a C++ test which now gives a false positive. After talking with Martin Sebor, we've concluded this is expected. There is no way to communicate that libstdc++ allocated objects are always less than PTRDIFF_MAX. gcc/ChangeLog: * calls.c (get_size_range): Adjust to work with ranger. * calls.h (get_size_range): Add ranger argument to prototype. * gimple-ssa-warn-restrict.c (class wrestrict_dom_walker): Remove. (check_call): Pull out of wrestrict_dom_walker into a static function. (wrestrict_dom_walker::before_dom_children): Rename to... (wrestrict_walk): ...this. (pass_wrestrict::execute): Instantiate ranger. (class builtin_memref): Add stmt and query fields. (builtin_access::builtin_access): Add range_query field. (builtin_memref::builtin_memref): Same. (builtin_memref::extend_offset_range): Same. (builtin_access::builtin_access): Make work with ranger. (wrestrict_dom_walker::check_call): Pull out into... (check_call): ...here. (check_bounds_or_overlap): Add range_query argument. * gimple-ssa-warn-restrict.h (check_bounds_or_overlap): Add range_query and gimple stmt arguments. gcc/testsuite/ChangeLog: * gcc.dg/Wrestrict-22.c: New test. * g++.dg/torture/pr92421.C: Adjust for ranger. libstdc++-v3/ChangeLog: * testsuite/21_strings/basic_string/capacity/1.cc: Pass -Wno-stringop-overflow to test.
2020-10-20Convert -Walloca pass to ranger.Aldy Hernandez8-319/+51
gcc/ChangeLog: * gimple-ssa-warn-alloca.c (enum alloca_type): Remove ALLOCA_BOUND_UNKNOWN and ALLOCA_CAST_FROM_SIGNED. (warn_limit_specified_p): New. (alloca_call_type_by_arg): Remove. (cast_from_signed_p): Remove. (is_max): Remove. (alloca_call_type): Remove heuristics and replace with call into ranger. (pass_walloca::execute): Instantiate ranger. gcc/testsuite/ChangeLog: * gcc.dg/Walloca-1.c: Adjust for ranger. * gcc.dg/Walloca-12.c: Same. * gcc.dg/Walloca-13.c: Same. * gcc.dg/Walloca-2.c: Same. * gcc.dg/Walloca-3.c: Same. * gcc.dg/Walloca-6.c: Same. * gcc.dg/Wvla-larger-than-2.c: Same.
2020-10-20syscall: remove Sendfile on NetBSDNikhil Benesch1-1/+1
NetBSD does not support the sendfile syscall. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/263521
2020-10-20lto-wrapper: Fix -save-temps filename commitTobias Burnus2-13/+13
Fix for 'Improve -save-temps filename' patch, commit b3032d1b84b8ab683f2d7345b6a2d9f783fe946d gcc/ChangeLog * lto-wrapper.c (run_gcc): Use proper variable for %u.ltrans_args dump suffix. gcc/testsuite/ChangeLog * gcc.misc-tests/outputs.exp: Add ltrans_args dump files for 'lto save-temps'.
2020-10-20AArch64: Add FLAG for get/set reg intrinsics [PR94442]zhengnannan1-18/+18
2020-10-20 Zhiheng Xie <xiezhiheng@huawei.com> Nannan Zheng <zhengnannan@huawei.com> gcc/ChangeLog: * config/aarch64/aarch64-simd-builtins.def: Add proper FLAG for get/set reg intrinsics.
2020-10-20Refactor range handling of builtins in vr_values and ranger.Aldy Hernandez4-258/+293
This sets things up so we can share range handling of builtins between vr_values and ranger. It is meant to refactor the code so that we can verify that both implementations yield the same results. First, we abstract out gimple_ranger::range_of_builtin_call into an externally visible counterpart that can be called from vr_values. It will take a range_query since both ranger and vr_values inherit from this base class. Then we abstract out all the builtin handling in vr_values into a separate method that is easier to compare against. Finally, we call the ranger version from vr_values and compare it with the vr_values version. Since this proves both versions return the same, we can remove vr_values::extract_range_builtin in a follow-up patch. The vr_values::range_of_expr change brings the vr_values version up to par with the ranger version. It should've handled non-SSA's. This was a small oversight that went unnoticed because the vr_value version isn't stressed nearly as much as the ranger version. The change is needed because the ranger code handling builtins calls, may call it for integer arguments in range_of_builtin_ubsan_call. There should be no change in functionality. gcc/ChangeLog: * gimple-range.cc (gimple_ranger::range_of_builtin_ubsan_call): Make externally visble... (range_of_builtin_ubsan_call): ...here. Add range_query argument. (gimple_ranger::range_of_builtin_call): Make externally visible... (range_of_builtin_call): ...here. Add range_query argument. * gimple-range.h (range_of_builtin_call): Move out from class and make externally visible. * vr-values.c (vr_values::extract_range_basic): Abstract out builtin handling to... (vr_values::range_of_expr): Handle non SSAs. (vr_values::extract_range_builtin): ...here. * vr-values.h (class vr_values): Add extract_range_builtin. (range_of_expr): Rename NAME to EXPR.
2020-10-20Saturate overflows return from SCEV in ranger.Aldy Hernandez2-2/+16
bounds_of_var_in_loop is returning an overflowed int, which is causing us to create a range for which we can't compare the bounds causing an ICE in verify_range. Overflowed bounds cause compare_values() to return -2, which we don't handle in verify_range. We don't represent overflowed ranges in irange, so this patch just saturates any overflowed end-points to MIN or MAX. gcc/ChangeLog: PR tree-optimization/97501 * gimple-range.cc (gimple_ranger::range_of_ssa_name_with_loop_info): Saturate overflows returned from SCEV. gcc/testsuite/ChangeLog: * gcc.dg/pr97501.c: New test.
2020-10-20preprocessor: Further fix for EOF in macro args [PR97471]Nathan Sidwell4-2/+2
My previous attempt at fixing this was incorrect. The problem occurs earlier in that _cpp_lex_direct processes the unwinding EOF needs in collect_args mode. This patch changes it not to do that, in the same way as directive parsing works. Also collect_args shouldn't push_back such fake EOFs, and neither should funlike_invocation_p. libcpp/ * lex.c (_cpp_lex_direct): Do not complete EOF processing when parsing_args. * macro.c (collect_args): Do not unwind fake EOF. (funlike_invocation_p): Do not unwind fake EOF. (cpp_context): Replace abort with gcc_assert. gcc/testsuite/ * gcc.dg/cpp/endif.c: Move to ... * c-c++-common/cpp/endif.c: ... here. * gcc.dg/cpp/endif.h: Move to ... * c-c++-common/cpp/endif.h: ... here. * c-c++-common/cpp/eof-2.c: Adjust diagnostic. * c-c++-common/cpp/eof-3.c: Adjust diagnostic.
2020-10-20c++: Add fixed test [PR82239]Marek Polacek1-0/+14
This test was fixed by r256550 but that commit was fixing another issue, and just happened to fix this too. gcc/testsuite/ChangeLog: PR c++/82239 * g++.dg/cpp0x/static_assert16.C: New test.
2020-10-20Simplify and split irange::copy_legacy_range into two functions.Aldy Hernandez2-31/+44
copy_legacy_range was a small but complex function. It was tricky to understand, and easy to introduce bugs into it. It also did unnecessary work on some code paths. This patch splits the function into two functions that are more efficient and easier to read (copy_to_legacy and copy_legacy_to_multi_range). gcc/ChangeLog: * value-range.cc (irange::operator=): Split up call to copy_legacy_range into... (irange::copy_to_legacy): ...this. (irange::copy_legacy_to_multi_range): ...and this. (irange::copy_legacy_range): Remove. * value-range.h: Remove copoy_legacy_range. Add copy_legacy_to_multi_range and copy_to_legacy.
2020-10-20gcc/doc/invoke.texi: Fix @table syntaxTobias Burnus1-1/+1
gcc/ * doc/invoke.texi (NVPTX options): Use @item not @itemx.
2020-10-20Avoid changing PHIs in GIMPLE split_edgeRichard Biener1-33/+17
Previously I've changed gimple_split_edge to avoid PHI node re-allocation, but this introduced swapping of PHI arguments due to the way edge redirection works. This is now a problem for me and which can be solved with the following approach reducing the overhead of split_edge even more. We can simply pretend there are no PHI nodes if we can make sure the new fallthru will have the same dest_idx as the old edge into the destination. 2020-10-20 Richard Biener <rguenther@suse.de> * tree-cfg.c (reinstall_phi_args): Remove. (gimple_split_edge): Remove PHIs around the edge redirection to avoid touching them at all.
2020-10-20Fix latch PHI arg lookup in vectorizable_reduction for double-reductionRichard Biener1-2/+4
We were using the wrong loop to figure the latch arg of a double-reduction PHI. Which isn't a problem in case ->dest_idx match up with the outer loop edges - but that's of course not guaranteed. 2020-10-20 Richard Biener <rguenther@suse.de> * tree-vect-loop.c (vectorizable_reduction): Use the correct loops latch edge for the PHI arg lookup.
2020-10-20MSP430: Support a memory operand for op1 of andneghi3Jozef Lawrynowicz1-2/+2
This fixes an ICE caused by an unrecognizeable insn generated when compiling gcc.c-torture/execute/pr97386-1.c at -O0. gcc/ChangeLog: * config/msp430/msp430.md (andneghi3): Allow general operand for op1 and update output assembler template.
2020-10-20collect-utils.c, lto-wrapper + mkoffload: Improve -save-temps filenameTobias Burnus7-29/+43
gcc/ChangeLog: * collect-utils.c (collect_execute, fork_execute): Add at-file suffix argument. * collect-utils.h (collect_execute, fork_execute): Update prototype. * collect2.c (maybe_run_lto_and_relink, do_link, main, do_dsymutil): Update calls by passing NULL. * config/i386/intelmic-mkoffload.c (compile_for_target, generate_host_descr_file, prepare_target_image, main): Likewise. * config/gcn/mkoffload.c (compile_native, main): Pass at-file suffix. * config/nvptx/mkoffload.c (compile_native, main): Likewise. * lto-wrapper.c (compile_offload_image): Likewise.
2020-10-20Special case shifting by zero in operator_rshift::op1_range.Aldy Hernandez1-0/+5
gcc/ChangeLog: * range-op.cc (operator_rshift::op1_range): Special case shifting by zero.
2020-10-20[Ada] Refine type for type constraining routinesPiotr Trojanek1-10/+10
gcc/ada/ * sem_ch3.adb (Constrain_Decimal, Constrain_Enumeration, Constrain_Float, Constrain_Integer, Constrain_Ordinary_Fixed): Refine parameter type from Node_Id to Entity_Id.
2020-10-20[Ada] Prevent crashes when pretty-printing freeze nodes from gdbPiotr Trojanek1-2/+4
gcc/ada/ * sprint.adb (po): Set Dump_Freeze_Null to False; align colons. (ps): Likewise.
2020-10-20[Ada] AI12-0339: Empty function for Aggregate aspect of Ada containersEd Schonberg36-19/+248
gcc/ada/ * sinfo.ads, sinfo.adb: The flag Box_Present can appear in Iterated_Element_Association nodes. * sem_aggr.adb (Resolve_Aggregate): Call Resolve_Container_Aggregate when type of context has corresponding aspect. * sem_type.adb (Covers): In Ada_2020 an aggregate is compatible with a type that carries the corresponding aspect. * exp_ch3.adb (Make_Controlling_Function_Wrappers): Do not create declarations and bodies for inherited primitive functions of null extensions that dispatch on result, when current scope includes an immediately visible non-overloadable homonym of the function. * libgnat/a-cborse.adb, libgnat/a-cborse.ads, libgnat/a-cbhase.ads, libgnat/a-cbhase.adb, libgnat/a-cborma.adb, libgnat/a-cborma.ads, libgnat/a-cbhama.adb, libgnat/a-cbhama.ads, libgnat/a-cbdlli.adb, libgnat/a-cbdlli.ads, libgnat/a-convec.ads, libgnat/a-ciorse.ads, libgnat/a-cihase.ads, libgnat/a-cihase.adb, libgnat/a-ciorma.ads, libgnat/a-cihama.ads, libgnat/a-cihama.adb, libgnat/a-cidlli.ads, libgnat/a-cidlli.adb, libgnat/a-coinve.adb, libgnat/a-cobove.adb, libgnat/a-cobove.ads, libgnat/a-convec.adb, libgnat/a-coinve.ads, libgnat/a-coorse.ads, libgnat/a-cohase.adb, libgnat/a-cohase.ads, libgnat/a-coorma.ads, libgnat/a-cohama.adb, libgnat/a-cohama.ads, libgnat/a-cdlili.ads: Add primitive function Empty for use in aspect Aggregate, and add corresponding body or expression function.
2020-10-20[Ada] Add support for Unreferenced aspect on formal parametersArnaud Charlet8-17/+63
gcc/ada/ * aspects.adb (Has_Aspect_Specifications_Flag): Add N_Parameter_Specification. * par-ch13.adb (Aspect_Specifications_Present): Also handle case of an unknown aspect on the last formal parameter (terminated by a Tok_Right_Paren). Minor reformatting. * par-ch6.adb (P_Formal_Part): Scan aspects on formal parameters. * par.adb: Fix typos. * sem_ch6.adb (Process_Formals): Add processing of aspects and in particular Unreferenced aspect for now. * sinfo.ads: Allow ASPECT_SPECIFICATIONS on a PARAMETER_SPECIFICATION. * doc/gnat_rm/implementation_defined_aspects.rst (Aspect Unreferenced): Update documentation. * gnat_rm.texi: Regenerate.
2020-10-20[Ada] Refine result type of Get_AccessibilityPiotr Trojanek2-2/+2
gcc/ada/ * sem_util.ads, sem_util.adb (Get_Accessibility): Refine result type from Node_Id to Entity_Id.
2020-10-20[Ada] Replace low-level Ekind membership tests with high-level Is_FormalPiotr Trojanek4-5/+5
gcc/ada/ * einfo.adb, exp_attr.adb, sem_ch13.adb, sem_util.adb: Use Is_Formal where possible.
2020-10-20[Ada] Implement AI12-0280 Making 'Old more flexibleSteve Baird8-94/+1245
gcc/ada/ * sem_util.ads: Declare a new package, Old_Attr_Util, which in turn declares two more packages, Conditional_Evaluation and Indirect_Temps. Conditional_Evaluation provides a predicate for deciding whether a given 'Old attribute reference is eligible for conditional evaluation and, in the case where it is eligible, a function that constructs the Boolean-valued condition that is to be evaluated at run time in deciding whether to evaluate the attribute prefix. Indirect_Temps provides support for declaring a temporary which is only initialized conditionally; more specifically, an access type and a variable of that type are declared (unconditionally) and then the variable is (conditionally) initialized with an allocator. The existence of the access type and the pointer variable is hidden from clients, except that a predicate, Is_Access_Type_For_Indirect_Temp, is provided for identifying such access types. This is needed because we want such an access type to be treated like a "normal" access type (specifically with respect to finalization of allocated objects). Other parts of the compiler treat access types differently if Comes_From_Source is False, or if the secondary stack storage pool is used; this predicate is used to disable this special treatment. * sem_attr.adb (Uneval_Old_Msg): Improve message text to reflect Ada202x changes. (Analyze_Attribute): A previously-illegal 'Old attribute reference is accepted in Ada2020 if it is eligible for conditional evaluation. * sem_res.adb (Valid_Conversion): Do not treat a rewritten 'Old attribute like other rewrite substitutions. This makes a difference, for example, in the case where we are generating the expansion of a membership test of the form "Saooaaat'Old in Named_Access_Type"; in this case Valid_Conversion needs to return True (otherwise the expansion will be False - see the call site in exp_ch4.adb). * exp_attr.adb (Expand_N_Attribute_Reference): When expanding a 'Old attribute reference, test for the case where the reference is eligible for conditional evaluation. In that case, use the new "indirect temporary" mechanism provided by Sem_Util. * exp_prag.adb (Expand_Attributes_In_Consequence.Expand_Attributes): If Sem_Util.Indirect_Temp_Needed indicates that there could be correctness problems associated with the old expansion scheme for dealing with 'Old attributes in contract cases consequences, then we use the new "indirect temporary" mechanism provided by Sem_Util instead. We do not want to do this unconditionally. * sem_util.adb: Provide a body for the new Old_Attr_Util package. Further work is needed in several areas for correctness: - The function Is_Repeatedly_Evaluated does not deal with container aggregates yet. - The function Is_Known_On_Entry does not deal with interactions with the Global aspect. Each area where more work is needed is indicated with a "???" comment in the code; a more detailed description can be found there. Some optimization opportunties are similarly indicated with a "???" comment. * exp_ch3.adb (Freeze_Type): In deciding whether to generate expansion for the list controller of an access type, take the predicate Is_Access_Type_For_Indirect_Temp into account. If the predicate yields True, then generate the expansion. * exp_util.adb (Build_Allocate_Deallocate_Proc): We don't normally finalize allocated objects that are allocated on the secondary stack. Add an exception to this rule if the predicate Is_Access_Type_For_Indirect_Temp yields True. As a result of this exception, we have to deal with the fact that gigi expects a different parameter profile if we are using the secondary stack pool; the Pool and Alignment parameters must be omitted in this case.
2020-10-20[Ada] Spurious error in current instance used as formal packageJavier Miranda1-0/+175
gcc/ada/ * sem_ch12.adb (Install_Parents_Of_Generic_Context, Remove_Parents_Of_Generic_Context): New subprograms. (Instantiate_Package_Body): Adding assertions to ensure that installed parents are properly removed.