aboutsummaryrefslogtreecommitdiff
path: root/gcc
AgeCommit message (Collapse)AuthorFilesLines
2021-10-06Fortran: Fix deprecate warning with parameterTobias Burnus2-1/+23
Only warn with !GCC$ ATTRIBUTES DEPRECATED if deprecated PARMETERS are actually used. gcc/fortran/ChangeLog: * resolve.c (resolve_values): Only show deprecated warning if attr.referenced. gcc/testsuite/ChangeLog: * gfortran.dg/attr_deprecated-2.f90: New test.
2021-10-06[gimple-isel] Remove redundant if condition.prathamesh.kulkarni1-3/+0
gcc/ChangeLog: * gimple-isel.cc (gimple_expand_vec_cond_expr): Remove redundant if condition.
2021-10-05c++: defaulted <=> with bitfields [PR102490]Jakub Jelinek11-90/+328
The testcases in the patch are either miscompiled or ICE with checking, because the defaulted operator== is synthesized too early (but only if constexpr), when the corresponding class type is still incomplete type. The problem is that at that point the bitfield FIELD_DECLs still have as TREE_TYPE their underlying type rather than integral type with their precision and when layout_class_type is called for the class soon after that, it changes those types but the COMPONENT_REFs type stay the way that they were during the operator== synthesize_method type and the middle-end is then upset by the mismatch of types. As what exact type will be given isn't just a one liner but quite long code especially for over-sized bitfields, I think it is best to just not synthesize the comparison operators so early and call defaulted_late_check for them once again as soon as the class is complete. This is also a problem for virtual operator<=>, where we need to compare the noexcept-specifier to validate the override before the class is complete. Rather than try to defer that comparison, maybe_instantiate_noexcept now calls maybe_synthesize_method, which calls build_comparison_op in non-defining mode if the class isn't complete yet. In that situation we also might not have base fields yet, so we look in the binfo for the bases. Co-authored-by: Jason Merrill <jason@redhat.com> 2021-10-01 Jakub Jelinek <jakub@redhat.com> PR c++/98712 PR c++/102490 * cp-tree.h (maybe_synthesize_method): Declare. * method.c (genericize_spaceship): Use LOOKUP_NORMAL | LOOKUP_NONVIRTUAL | LOOKUP_DEFAULTED instead of LOOKUP_NORMAL for flags. (comp_info): Remove defining member. Add complain, code, retcat. (comp_info::comp_info): Adjust. (do_one_comp): Split out from build_comparison_op. Use LOOKUP_NORMAL | LOOKUP_NONVIRTUAL | LOOKUP_DEFAULTED instead of LOOKUP_NORMAL for flags. (build_comparison_op): Add defining argument. Adjust comp_info construction. Use defining instead of info.defining. Assert that if defining, ctype is a complete type. Walk base binfos. (synthesize_method, maybe_explain_implicit_delete, explain_implicit_non_constexpr): Adjust build_comparison_op callers. (maybe_synthesize_method): New function. * class.c (check_bases_and_members): Don't call defaulted_late_check for sfk_comparison. (finish_struct_1): Call it here instead after class has been completed. * pt.c (maybe_instantiate_noexcept): Call maybe_synthesize_method instead of synthesize_method. * g++.dg/cpp2a/spaceship-synth8.C (std::strong_ordering): Provide more complete definition. (std::strong_ordering::less, std::strong_ordering::equal, std::strong_ordering::greater): Define. * g++.dg/cpp2a/spaceship-synth12.C: New test. * g++.dg/cpp2a/spaceship-synth13.C: New test. * g++.dg/cpp2a/spaceship-synth14.C: New test. * g++.dg/cpp2a/spaceship-eq11.C: New test. * g++.dg/cpp2a/spaceship-eq12.C: New test. * g++.dg/cpp2a/spaceship-eq13.C: New test.
2021-10-06Daily bump.GCC Administrator7-1/+397
2021-10-05Not add initialization for variables been initialized by FEs [PR102359]qing zhao3-1/+34
C++ FE creates proxy variables, which have associated DECL_VALUE_EXPR and have been initialized by FE. For such auto variable, we should not add initialization when -ftrivial-auto-var-init presents. PR middle-end/102359 gcc/ChangeLog: 2021-10-05 qing zhao <qing.zhao@oracle.com> * gimplify.c (gimplify_decl_expr): Not add initialization for an auto variable when it has been initialized by frontend. gcc/testsuite/ChangeLog: 2021-10-05 qing zhao <qing.zhao@oracle.com> * g++.dg/pr102359_1.C: New test. * g++.dg/pr102359_2.C: New test.
2021-10-05compiler: workaround for C++ build template matching quirkThan McIntosh2-3/+3
Tweak a couple of places in the types code to use nullptr instead of NULL to work around a template matching quirk when using certain build compilers. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/354151
2021-10-05c++: Fix apply_identity_attributes [PR102548]Jakub Jelinek2-2/+14
The following testcase ICEs on x86_64-linux with -m32 due to a bug in apply_identity_attributes. The function is being smart and attempts not to duplicate the chain unnecessarily, if either there are no attributes that affect type identity or there is possibly empty set of attributes that do not affect type identity in the chain followed by attributes that do affect type identity, it reuses that attribute chain. The function mishandles the cases where in the chain an attribute affects type identity and is followed by one or more attributes that don't affect type identity (and then perhaps some further ones that do). There are two bugs. One is that when we notice first attribute that doesn't affect type identity after first attribute that does affect type identity (with perhaps some further such attributes in the chain after it), we want to put into the new chain just attributes starting from (inclusive) first_ident and up to (exclusive) the current attribute a, but the code puts into the chain all attributes starting with first_ident, including the ones that do not affect type identity and if e.g. we have doesn't0 affects1 doesn't2 affects3 affects4 sequence of attributes, the resulting sequence would have affects1 doesn't2 affects3 affects4 affects3 affects4 attributes, i.e. one attribute that shouldn't be there and two attributes duplicated. That is fixed by the a2 -> a2 != a change. The second one is that we ICE once we see second attribute that doesn't affect type identity after an attribute that affects it. That is because first_ident is set to error_mark_node after handling the first attribute that doesn't affect type identity (i.e. after we've copied the [first_ident, a) set of attributes to the new chain) to denote that from that time on, each attribute that affects type identity should be copied whenever it is seen (the if (as && as->affects_type_identity) code does that correctly). But that condition is false and first_ident is error_mark_node, we enter else if (first_ident) and use TREE_PURPOSE /TREE_VALUE/TREE_CHAIN on error_mark_node, which ICEs. When first_ident is error_mark_node and a doesn't affect type identity, we want to do nothing. So that is the && first_ident != error_mark_node chunk. 2021-10-05 Jakub Jelinek <jakub@redhat.com> PR c++/102548 * tree.c (apply_identity_attributes): Fix handling of the case where an attribute in the list doesn't affect type identity but some attribute before it does. * g++.target/i386/pr102548.C: New test.
2021-10-05Darwin, D: Fix bootstrap when target does not support -Bstatic/dynamic.Iain Sandoe1-0/+6
This fixes a bootstrap fail because saw_static_libcxx was unused for targets without support for -Bstatic/dynamic. The fix applied pushes the -static-libstdc++ back onto the command line, which allows a target to substitute a static version of the c++ standard library using specs. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> gcc/d/ChangeLog: * d-spec.cc (lang_specific_driver): Push the -static-libstdc++ option back onto the command line for targets without support for -Bstatic/dynamic.
2021-10-05c++: unifying equal NONTYPE_ARGUMENT_PACKs [PR102547]Patrick Palka3-0/+48
Here during partial ordering of the two partial specializations we end up in unify with parm=arg=NONTYPE_ARGUMENT_PACK<V0, V1>, and crash shortly thereafter because uses_template_parms(parms) calls potential_const_expr which doesn't handle NONTYPE_ARGUMENT_PACK. This patch fixes this by extending potential_constant_expression to handle NONTYPE_ARGUMENT_PACK appropriately. PR c++/102547 gcc/cp/ChangeLog: * constexpr.c (potential_constant_expression_1): Handle NONTYPE_ARGUMENT_PACK. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/variadic-partial2.C: New test. * g++.dg/cpp0x/variadic-partial2a.C: New test.
2021-10-05Loosen loop crossing restriction in threader.Aldy Hernandez2-11/+68
Crossing loops is generally discouraged from the threader, but we can make an exception when we don't cross the latch or enter another loop, since this is just an early exit out of the loop. In fact, the whole threaded path is logically outside the loop. This has nice secondary effects. For example, objects on the threaded path will no longer necessarily be live throughout the loop, so we can get register allocation improvements. The threaded path can physically move outside the loop resulting in better icache efficiency, etc. Tested on x86-64 Linux, and on a visium-elf cross making sure that the following tests do not have an abort in the final assembly: gcc.c-torture/execute/960218-1.c gcc.c-torture/execute/visium-pending-4.c gcc.c-torture/execute/pr58209.c gcc/ChangeLog: * tree-ssa-threadupdate.c (jt_path_registry::cancel_invalid_paths): Loosen restrictions gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/ssa-thread-valid.c: New test.
2021-10-05Mark argument as unusedJan-Benedict Glaw1-1/+2
The `loc` argument may or may not be used, depending on some #ifdefs. Mark it as ATTRIBUTE_UNUSED, though it might be worth polishing the whole target hook to not depend on the #ifdef'ed code at all. gcc/ChangeLog: * common/config/avr/avr-common.c (avr_handle_option): Mark argument as ATTRIBUTE_UNUSED.
2021-10-05Fix s390 test to have pointer type for computed gotoJeff Law1-1/+1
gcc/testsuite * gcc.target/s390/pr80725.c: Ensure computed goto is used on a pointer type.
2021-10-05Fix redefinition warningJan-Benedict Glaw1-0/+1
gcc/ChangeLog: * config/lm32/uclinux-elf.h (LINK_GCC_C_SEQUENCE_SPEC): Undefine before redefinition.
2021-10-05Allow more kinds of invariant addresses in GIMPLE FERichard Biener2-5/+32
The gimple FE is too restrictive in what it accepts as literals, the following makes it also accept &a[10] for example. 2021-10-05 Richard Biener <rguenther@suse.de> PR c/102605 gcc/c/ * gimple-parser.c (c_parser_gimple_postfix_expression): Accept more address _Literals. gcc/testsuite/ * gcc.dg/gimplefe-46.c: New testcase.
2021-10-05c++: templated static local var has value-dep addr [PR98930]Patrick Palka3-0/+35
Here uses_template_parms returns false for the dependent type A<&impl::i>, which causes tsubst_aggr_type to think it's non-dependent and not bother substituting into it, leading to breakage. This patch fixes this by making has_value_dependent_address also return true for templated static local variables. PR c++/98930 gcc/cp/ChangeLog: * pt.c (has_value_dependent_address): Return true for a static local variable from a function template. gcc/testsuite/ChangeLog: * g++.dg/cpp1z/nontype4.C: New test. * g++.dg/cpp1z/nontype4a.C: New test.
2021-10-05gfortran.dg/gomp/pr43711.f90: Change dg-* for XFAIL->PASSTobias Burnus1-4/+4
gcc/testsuite/ * gfortran.dg/gomp/pr43711.f90: Add dg-error + dg-prune-output, remove dg-excess-errors to change XFAIL to PASS.
2021-10-05Make flow of option processing more readily visibleRichard Biener1-24/+19
This moves calls to various option processing stages to one place, toplev::main. 2021-10-05 Richard Biener <rguenther@suse.de> * toplev.c (no_backend): Remove global var. (process_options): Pass in no_backend, move post_options langhook call to toplev::main. (do_compile): Pass in no_backend, move process_options call to toplev::main. (toplev::run_self_tests): Check no_backend at the caller. (toplev::main): Call post_options and process_options split out from do_compile, do self-tests only if no_backend is initialized.
2021-10-05Amend function names with UID when dumping with TDF_UIDRichard Biener2-4/+21
The following makes sure to amend more function names with the associated DECL_UID when dumping with TDF_UID, in particular function names printed as part of calls and in the function header. That allows one to more easily follow the call flow of PR102528 where coroutines cause three clones of the name 'test2' that are not distinguishable otherwise. 2021-10-05 Richard Biener <rguenther@suse.de> * tree-cfg.c (dump_function_to_file): Dump the UID of the function as part of the name when requested. * tree-pretty-print.c (dump_function_name): Dump the UID when requested and the langhook produced the actual name.
2021-10-05More .DEFERRED_INIT expansion reworkRichard Biener3-14/+17
This avoids looking at the type size and instead uses the size as passed to .DEFERRED_INIT to determine the size of the non-MEM to be initialized. It also arranges for possibly poly-int inits to always use zero-initialization rather than not initializing and when we need to pun puns the LHS instead of the constant value. That correctly initializes the variable-size typed array in the testcase for PR102285 and the SVE vector in PR102587 where for the testcase I needed to add a SVE capable -march as to not ICE later. 2021-10-05 Richard Biener <rguenther@suse.de> PR middle-end/102587 PR middle-end/102285 * internal-fn.c (expand_DEFERRED_INIT): Fall back to zero-initialization as last resort, use the constant size as given by the DEFERRED_INIT argument to build the initializer. * gcc.target/aarch64/sve/pr102587-1.c: Add -march=armv8.3-a+sve. * gcc.target/aarch64/sve/pr102587-2.c: Likewise.
2021-10-05[Ada] Plug small loophole with boolean valuesEric Botcazou1-0/+1
gcc/ada/ * gcc-interface/trans.c (gnat_to_gnu): Do not wrap boolean values referenced in pragmas.
2021-10-05[Ada] Do not unconditionally inline expression functions with -gnatd.8Eric Botcazou1-1/+1
gcc/ada/ * gcc-interface/trans.c (Subprogram_Body_to_gnu): Do not set the DECL_DISREGARD_INLINE_LIMITS flag if -gnatd.8 is specified.
2021-10-05[Ada] Fix latent bug in set_end_locus_from_nodeBob Duff1-1/+6
gcc/ada/ * gcc-interface/trans.c (set_end_locus_from_node): Check that Handled_Statement_Sequence is not Empty before calling End_Label, because the Empty node has no End_Label, and depending on the exact node layout chosen by gen_il, calling End_Label might crash, or might work OK by accident.
2021-10-05[Ada] Minor include directives placement adjustmentEric Botcazou2-2/+2
gcc/ada/ * gcc-interface/cuintp.c: Adjust placement of include directive. * gcc-interface/targtyps.c: Likewise.
2021-10-05[Ada] introduce stack scrub (strub) featureAlexandre Oliva10-851/+1178
gcc/ada/ * doc/gnat_rm.rst: Add... * doc/gnat_rm/security_hardening_features.rst: New. * doc/gnat_rm/about_this_guide.rst: Link to new chapter. * gnat_rm.texi: Regenerate. * gcc-interface/utils.c (handle_strub_attribute): New. (gnat_internal_attribute_table): Add strub. * libgnat/a-except.adb: Make Rcheck_CE_* strub-callable. * libgnat/a-except.ads (Raise_Exception): Likewise. (Raise_Exception_Always): Likewise. * libgnat/s-arit128.ads (Multiply_With_Ovflo_Check128): Likewise. * libgnat/s-arit64.ads (Multiply_With_Ovflo_Check64): Likewise. * libgnat/s-secsta.ads (SS_Allocate, SS_Mark, SS_Release): Likewise.
2021-10-05[Ada] Mark private component renaming as coming from sourceEric Botcazou1-6/+13
gcc/ada/ * exp_ch9.adb (Install_Private_Data_Declarations): Copy the Sloc of components for the local renamings as well as the Comes_From_Source flag, and also set Warnings_Off on them. Use Nam local variable.
2021-10-05[Ada] Add comments in Ada.Task_InitializationArnaud Charlet1-1/+5
gcc/ada/ * libgnarl/a-tasini.ads (Set_Initialization_Handler): Update comments.
2021-10-05[Ada] Include errno.h in QNX specific part of the signal handlingCorentin Gay1-0/+1
gcc/ada/ * init.c (QNX): Add #include errno.h.
2021-10-05[Ada] Remove left-overs of Unaligned_Valid attributeEric Botcazou2-3/+1
gcc/ada/ * exp_attr.adb (Expand_Fpt_Attribute): Likewise. * snames.ads-tmpl (Name_Unaligned_Valid): Delete.
2021-10-05[Ada] Forbids use of Compile_Time_(Error|Warning) as configuration pragmaEtienne Servais5-142/+130
gcc/ada/ * sem_prag.adb (Analyze_Pragma): Forbid use of Compile_Time_(Error|Warning) as configuration pragma. * doc/gnat_ugn/the_gnat_compilation_model.rst: Compile_Time_(Error|Warning) and Compiler_Unit(_Warning) are not configuration pragmas and shall not be listed as such. The following pragmas are either obsolete or undocumented: No_Run_Time, Propagate_Exceptions, Rational, Ravenscar, Restricted_Run_Time, Short_Descriptors, Universal_Data. Fix some typos (notably on Restriction_Warnings). * doc/gnat_rm/implementation_defined_pragmas.rst: Move Rename_Pragma documentation to alphabetical order. * gnat_rm.texi, gnat_ugn.texi: Regenerate.
2021-10-05[Ada] Add sys/time.h #include for QNXCorentin Gay1-0/+1
gcc/ada/ * adaint.c (QNX): Add #include for sys/time.h.
2021-10-05[Ada] Issue a proper error message when no format specifier foundPascal Obry1-1/+1
gcc/ada/ * libgnat/g-forstr.adb (Next_Format): When there is no more format specifier found issue a proper error message instead of raising a contraint error.
2021-10-05[Ada] Fix negative numbers formatted with leading zeroPascal Obry1-1/+1
gcc/ada/ * libgnat/g-forstr.adb (Get_Formatted): Fix computation of the number of zero to use in the formatted string. This was a wrong copy/paste.
2021-10-05[Ada] Minor code clean-upPascal Obry1-1/+1
gcc/ada/ * libgnat/g-forstr.adb (Get_Formatted): Minor code clean-up.
2021-10-05[Ada] Add missing functions to Wide_Wide_Characters HandlingEtienne Servais4-4/+90
gcc/ada/ * libgnat/a-zchhan.ads, libgnat/a-zchhan.adb (Character_Set_Version, Is_Basic, To_Basic): New. * libgnat/a-zchuni.ads, libgnat/a-zchuni.adb (Is_Basic, To_Basic): New.
2021-10-05[Ada] Improve error message on array aggregatesYannick Moy1-1/+1
gcc/ada/ * sem_aggr.adb (Resolve_Array_Aggregate): Improve error message.
2021-10-05[Ada] Front-end support for Storage_Model featureGary Dismukes9-5/+834
gcc/ada/ * aspects.ads (type Aspect_Id): Add Aspect_Designated_Storage_Model and Aspect_Storage_Model_Type. (Aspect_Argument): Add associations for the above new aspects. (Is_Representation_Aspect): Likewise. (Aspect_Names, Aspect_Delay): Likewise. * exp_ch4.adb (Expand_N_Allocator): Call Find_Storage_Op rather than Find_Prim_Op. * exp_intr.adb (Expand_Unc_Deallocation): Likewise. * exp_util.ads (Find_Storage_Op): New function that locates either a primitive operation of a storage pool or an operation of a storage-model type specified in its Storage_Model_Type aspect. * exp_util.adb (Find_Storage_Op): New function that calls either Find_Prim_Op or Get_Storage_Model_Type_Entity to locate a storage-related operation that is associated with a type. * sem_ch13.adb (Analyze_Aspects_At_Freeze_Point): Analyzes, resolves, and validates the arguments of aspect Designated_Storage_Model_Type. (Analyze_Aspect_Specifications): Sets delay-related flags on storage-model aspects when Delay_Required. Checks that aspect Designated_Storage_Model is only specified for an access type and that aspect Storage_Model_Type is only specified on an immutably limited type. Also records such aspects for their associated types. (Check_Aspect_At_Freeze_Point): Resolve each of the argument associations given for a Storage_Model_Type aspect. (Resolve_Storage_Model_Type_Argument): New procedure that resolves an argument given in the association for a given entity name associated with a type with aspect Storage_Model_Type, ensuring that it has the proper kind or profile. (Validate_Storage_Model_Type_Aspect): New procedure that checks the legality and completeness of the entity associations given in a Storage_Model_Type aspect. * sem_util.ads (package Storage_Model_Support): New nested package that encapsulates a set of convenient utility functions for retrieving entities, etc. associated with storage-model-related types and objects. (Get_Storage_Model_Type_Entity): New function to return a specified entity associated with a type that has aspect Storage_Model_Type. (Has_Designated_Storage_Model_Aspect): New function that returns whether a type has aspect Designated_Storage_Model. (Has_Storage_Model_Type_Aspect): New function that returns whether a type has aspect Storage_Model_Type. (Storage_Model_Object): New function that returns the object Entity_Id associated with a type's Designated_Storage_Model aspect. (Storage_Model_Type): New function that returns the type associated with a storage-model object (when the object's type specifies Storage_Model_Type). (Storage_Model_Address_Type): New function that returns the Address_Type associated with a type that has aspect Storage_Model_Type. (Storage_Model_Null_Address): New function that returns the Null_Address constant associated with a type that has aspect Storage_Model_Type. (Storage_Model_Allocate): New function that returns the Allocate procedure associated with a type that has aspect Storage_Model_Type. (Storage_Model_Deallocate): New function that returns the Deallocate procedure associated with a type that has aspect Storage_Model_Type. (Storage_Model_Copy_From): New function that returns the Copy_From procedure associated with a type that has aspect Storage_Model_Type. (Storage_Model_Copy_To): New function that returns the Copy_To procedure associated with a type that has aspect Storage_Model_Type. (Storage_Model_Storage_Size): New function that returns the Storage_Size function associated with a type that has aspect Storage_Model_Type. * sem_util.adb (package Storage_Model_Support): Body of new nested package that contains the implementations the utility functions declared in the spec of this package. * snames.ads-tmpl: Add new names Name_Designated_Storage_Pool, Name_Storage_Model, Name_Storage_Model_Type, Name_Address_Type, Name_Copy_From, Name_Copy_To, and Name_Null_Address for the new aspects and associated aspect arguments.
2021-10-05[Ada] Note that -gnatd_t is used in CCGRichard Kenner1-1/+5
gcc/ada/ * debug.adb: Add documentation for -gnatd_t.
2021-10-05[Ada] Add case to consider ENODEV a "file not found error"Corentin Gay1-0/+4
gcc/ada/ * sysdep.c (__gnat_is_file_not_found_error): Add else if case.
2021-10-05[Ada] Rewrite operator entity in derived class-wide expressionsPiotr Trojanek1-1/+1
gcc/ada/ * exp_util.adb (Build_Class_Wide_Expression): Replace entities of both identifiers and operator symbols.
2021-10-05[Ada] Propagate Ghost status from parent to derived subprogramsPiotr Trojanek1-0/+8
gcc/ada/ * sem_ch3.adb (Derive_Subprogram): Copy ghost status from parent to derived subprogram.
2021-10-05[Ada] Add Default_Initial_Condition to type Unbounded_StringJoffrey Huguet2-2/+4
gcc/ada/ * libgnat/a-strunb.ads, libgnat/a-strunb__shared.ads: Add Default_Initial_Condition to Unbounded_String.
2021-10-05[Ada] Disable contract cases on formal containersClaire Dross7-0/+7
gcc/ada/ * libgnat/a-cfdlli.ads: Use pragma Assertion_Policy to disable contract cases at execution. * libgnat/a-cfinve.ads: Idem. * libgnat/a-cofove.ads: Idem. * libgnat/a-cfhase.ads: Idem. * libgnat/a-cfhama.ads: Idem. * libgnat/a-cforse.ads: Idem. * libgnat/a-cforma.ads: Idem.
2021-10-05[Ada] Improve message on missing all/for in pre-Ada-2022 modesBob Duff2-44/+49
gcc/ada/ * par-ch4.adb (P_Iterated_Component_Association): Parse these features the same way in all language versions. Move the call to Error_Msg_Ada_2022_Feature into semantic analysis. * sem_aggr.adb (Resolve_Iterated_Component_Association, Resolve_Iterated_Association): Move the call to Error_Msg_Ada_2022_Feature here from par-ch4.adb.
2021-10-05[Ada] Improve error message on missing all/for in quantified expressionYannick Moy1-0/+18
gcc/ada/ * sem_res.adb (Resolve): Recognize specially that case.
2021-10-05[Ada] Proof of Ada.Strings.MapsYannick Moy2-38/+395
gcc/ada/ * libgnat/a-strmap.adb: Add ghost code for proof. (To_Range): This is the most involved proof, as it requires creating the result of the call to To_Domain as a ghost variable, and show the unicity of this result in order to prove the postcondition. * libgnat/a-strmap.ads: (SPARK_Proof_Sorted_Character_Sequence): New ghost function. (To_Domain): Add postcondition regarding sorting of result. (To_Range): Fix postcondition that should compare Length instead of Last for the results of To_Domain and To_Range, as the value of Last for an empty result is not specified in the Ada RM.
2021-10-05[Ada] Proof of Ada.Characters.HandlingYannick Moy3-84/+428
gcc/ada/ * libgnat/a-chahan.adb: Add loop invariants as needed to prove subprograms. Also use extended return statements where appropriate and not done already. Mark data with Relaxed_Initialization where needed for initialization by parts. Convert regular functions to expression functions where needed for proof. * libgnat/a-chahan.ads: Add postconditions. * libgnat/a-strmap.ads (Model): New ghost function to create a publicly visible model of the private data Character_Mapping, needed in order to prove subprograms in Ada.Characters.Handling.
2021-10-05Adjust gfortran.dg/predict-2.f90Richard Biener1-2/+2
After teaching VN to handle internal functions we now optimize the redundant inner loop preheader check of the testcase making the dump scanning fail because there's nothing to predict left. The following restores the inner preheader check by making it not redundant. 2021-10-05 Richard Biener <rguenther@suse.de> * gfortran.dg/predict-2.f90: Adjust to avoid redundant inner loop preheader checking code.
2021-10-05Daily bump.GCC Administrator9-1/+406
2021-10-04c-family: Implement -Warray-compare [PR97573]Marek Polacek8-3/+164
This patch addresses one of my leftovers from GCC 11. C++20 introduced [depr.array.comp]: "Equality and relational comparisons between two operands of array type are deprecated." so this patch adds -Warray-compare. Since the code in question is dubious (the comparison doesn't actually compare the array elements), I've added this warning for C too, and enabled it in all C++ modes. PR c++/97573 gcc/c-family/ChangeLog: * c-common.h (do_warn_array_compare): Declare. * c-warn.c (do_warn_array_compare): New. * c.opt (Warray-compare): New option. gcc/c/ChangeLog: * c-typeck.c (parser_build_binary_op): Call do_warn_array_compare. gcc/cp/ChangeLog: * typeck.c (cp_build_binary_op): Call do_warn_array_compare. gcc/ChangeLog: * doc/invoke.texi: Document -Warray-compare. gcc/testsuite/ChangeLog: * c-c++-common/Warray-compare-1.c: New test. * c-c++-common/Warray-compare-2.c: New test.
2021-10-04avoid hardreg autoinitRichard Biener2-0/+11
This avoids initializating "uninitialized" hardregs like SP. 2021-10-04 Richard Biener <rguenther@suse.de> * gimplify.c (is_var_need_auto_init): DECL_HARD_REGISTER variables are not to be initialized. * gcc.dg/auto-init-hardreg-1.c: New testcase.