- Jan 09, 2024
-
-
Jonathan Wakely authored
Fix some copy & pasted logic in __is_extended_pictographic. This function should yield false for the values before the first edge, not true. Also add a missing boundary condition check in __incb_property. Also Fix an off-by-one error in _Utf_iterator::operator++() that would make dereferencing a past-the-end iterator undefined (where the intended design is that the iterator is always incrementable and dereferenceable, for better memory safety). Also simplify the grapheme view iterator, which still contained some remnants of an earlier design I was experimenting with. Slightly tweak the gen_libstdcxx_unicode_data.py script so that the _Gcb_property enumerators are in the order we encounter them in the data file, instead of sorting them alphabetically. Start with the "Other" property at value 0, because that's the default property for anything not in the file. This makes no practical difference, but seems cleaner. It causes the values in the __gcb_edges table to change, so can only be done now before anybody is using this code yet. The enumerator values and table entries become ABI artefacts for the function using them. contrib/ChangeLog: * unicode/gen_libstdcxx_unicode_data.py: Print out Gcb_property enumerators in the order they're seen, not alphabetical order. libstdc++-v3/ChangeLog: * include/bits/unicode-data.h: Regenerate. * include/bits/unicode.h (_Utf_iterator::operator++()): Fix off by one error. (__incb_property): Add missing check for values before the first edge. (__is_extended_pictographic): Invert return values to fix copy&pasted logic. (_Grapheme_cluster_view::_Iterator): Remove second iterator member and find end of cluster lazily. * testsuite/ext/unicode/grapheme_view.cc: New test. * testsuite/ext/unicode/properties.cc: New test. * testsuite/ext/unicode/view.cc: New test.
-
Andreas Schwab authored
Tighten the regex to find the start of the .dynsym symtab in the readelf output to avoid matching the section symbol in the normal symtab. libstdc++-v3: * scripts/extract_symvers.in: Require final colon to only match .dsynsym in the header of the dynamic symtab.
-
Jason Merrill authored
In a couple of places in the xobj patch I noticed that is_this_parameter probably wanted to change to is_object_parameter; this implements that and does the additional adjustments needed to make the accessor fixits handle xobj parms. gcc/cp/ChangeLog: * semantics.cc (is_object_parameter): New. * cp-tree.h (is_object_parameter): Declare. * call.cc (maybe_warn_class_memaccess): Use it. * search.cc (field_access_p): Use it. (class_of_object_parm): New. (field_accessor_p): Adjust for explicit object parms. gcc/testsuite/ChangeLog: * g++.dg/torture/accessor-fixits-9-xobj.C: New test.
-
Jason Merrill authored
The FIXME in xobj_iobj_parameters_correspond was due to expecting TYPE_MAIN_VARIANT to be the same for all equivalent types, which is not the case. And I adjusted some comments that I disagree with; the iobj parameter adjustment only applies to overload resolution, we can handle that in cand_parms_match (and I have WIP for that). gcc/cp/ChangeLog: * call.cc (build_over_call): Refactor handle_arg lambda. * class.cc (xobj_iobj_parameters_correspond): Fix FIXME. * method.cc (defaulted_late_check): Adjust comments.
-
waffl3x authored
This adds support for defaulted comparison operators and copy/move assignment operators, as well as allowing user defined xobj copy/move assignment operators. It turns out defaulted comparison operators already worked though, so this just adds a test for them. Defaulted comparison operators were not so nice and required a bit of a hack. Should work fine though! The diagnostics leave something to be desired, and there are some things that could be improved with more extensive design changes. There are a few notes left indicating where I think we could make improvements. Aside from some small bugs, with this commit xobj member functions should be feature complete. PR c++/102609 gcc/cp/ChangeLog: PR c++/102609 C++23 P0847R7 (deducing this) - CWG2586. * decl.cc (copy_fn_p): Accept xobj copy assignment functions. (move_signature_fn_p): Accept xobj move assignment functions. * method.cc (do_build_copy_assign): Handle defaulted xobj member functions. (defaulted_late_check): Comment. (defaultable_fn_check): Comment. gcc/testsuite/ChangeLog: PR c++/102609 C++23 P0847R7 (deducing this) - CWG2586. * g++.dg/cpp23/explicit-obj-basic6.C: New test. * g++.dg/cpp23/explicit-obj-default1.C: New test. * g++.dg/cpp23/explicit-obj-default2.C: New test. Signed-off-by:
Waffl3x <waffl3x@protonmail.com>
-
waffl3x authored
This implements support for xobj lambdas. There are extensive tests included, but not exhaustive. Dependent lambdas should work and have been tested lightly, but we need more exhaustive tests for them. PR c++/102609 gcc/cp/ChangeLog: PR c++/102609 C++23 P0847R7 (deducing this) - xobj lambdas. * lambda.cc (build_capture_proxy): Don't fold direct object types. * parser.cc (cp_parser_lambda_declarator_opt): Handle xobj lambdas, diagnostics. Comments also updated. * pt.cc (tsubst_function_decl): Handle xobj lambdas. Check object type of xobj lambda call operator, diagnose incorrect types. (tsubst_lambda_expr): Update comment. * semantics.cc (finish_decltype_type): Also consider by-value object parameter qualifications. gcc/testsuite/ChangeLog: PR c++/102609 C++23 P0847R7 (deducing this) - xobj lambdas. * g++.dg/cpp23/explicit-obj-diagnostics8.C: New test. * g++.dg/cpp23/explicit-obj-lambda1.C: New test. * g++.dg/cpp23/explicit-obj-lambda10.C: New test. * g++.dg/cpp23/explicit-obj-lambda11.C: New test. * g++.dg/cpp23/explicit-obj-lambda12.C: New test. * g++.dg/cpp23/explicit-obj-lambda13.C: New test. * g++.dg/cpp23/explicit-obj-lambda2.C: New test. * g++.dg/cpp23/explicit-obj-lambda3.C: New test. * g++.dg/cpp23/explicit-obj-lambda4.C: New test. * g++.dg/cpp23/explicit-obj-lambda5.C: New test. * g++.dg/cpp23/explicit-obj-lambda6.C: New test. * g++.dg/cpp23/explicit-obj-lambda7.C: New test. * g++.dg/cpp23/explicit-obj-lambda8.C: New test. * g++.dg/cpp23/explicit-obj-lambda9.C: New test. Signed-off-by:
Waffl3x <waffl3x@protonmail.com>
-
waffl3x authored
Diagnostics for xobj member functions. Also includes some diagnostics for xobj lambdas which are not implemented here. CWG2554 is also implemented here, we explicitly error when an xobj member function overrides a virtual function. PR c++/102609 gcc/c-family/ChangeLog: PR c++/102609 C++23 P0847R7 (deducing this) - diagnostics. * c-cppbuiltin.cc (c_cpp_builtins): Define __cpp_explicit_this_parameter=202110L feature test macro. gcc/cp/ChangeLog: PR c++/102609 C++23 P0847R7 (deducing this) - diagnostics. * class.cc (resolve_address_of_overloaded_function): Diagnostics. * cp-tree.h (TFF_XOBJ_FUNC): Define. * decl.cc (grokfndecl): Diagnostics. (grokdeclarator): Diagnostics. * error.cc (dump_aggr_type): Pass TFF_XOBJ_FUNC. (dump_lambda_function): Formatting for xobj lambda. (dump_function_decl): Pass TFF_XOBJ_FUNC. (dump_parameters): Formatting for xobj member functions. (function_category): Formatting for xobj member functions. * parser.cc (cp_parser_decl_specifier_seq): Diagnostics. (cp_parser_parameter_declaration): Diagnostics. * search.cc (look_for_overrides_here): Make xobj member functions override. (look_for_overrides_r): Reject an overriding xobj member function and diagnose it. * semantics.cc (finish_this_expr): Diagnostics. * typeck.cc (cp_build_addr_expr_1): Diagnostics. gcc/testsuite/ChangeLog: PR c++/102609 C++23 P0847R7 (deducing this) - diagnostics. * g++.dg/cpp23/feat-cxx2b.C: Test existance and value of __cpp_explicit_this_parameter feature test macro. * g++.dg/cpp26/feat-cxx26.C: Likewise. * g++.dg/cpp23/explicit-obj-cxx-dialect-A.C: New test. * g++.dg/cpp23/explicit-obj-cxx-dialect-B.C: New test. * g++.dg/cpp23/explicit-obj-cxx-dialect-C.C: New test. * g++.dg/cpp23/explicit-obj-cxx-dialect-D.C: New test. * g++.dg/cpp23/explicit-obj-cxx-dialect-E.C: New test. * g++.dg/cpp23/explicit-obj-diagnostics1.C: New test. * g++.dg/cpp23/explicit-obj-diagnostics2.C: New test. * g++.dg/cpp23/explicit-obj-diagnostics3.C: New test. * g++.dg/cpp23/explicit-obj-diagnostics4.C: New test. * g++.dg/cpp23/explicit-obj-diagnostics5.C: New test. * g++.dg/cpp23/explicit-obj-diagnostics6.C: New test. * g++.dg/cpp23/explicit-obj-diagnostics7.C: New test. Signed-off-by:
Waffl3x <waffl3x@protonmail.com>
-
waffl3x authored
This implements the initial functionality for P0847R7. CWG2789 is implemented, but instead of "same type" for the object parameters we take correspondence into account instead. Without this alteration, the behavior here would be slightly different than the behavior with constrained member function templates, which I believe would be undesirable. There are a few outstanding issues related to xobj member functions overloading iobj member functions that are introduced by using declarations. Unfortunately, fixing this will be a little more involved and will have to be pushed back until later. Most diagnostics have been split out into another patch to improve its clarity and allow all the strictly functional changes to be more distinct. Explicit object lambdas and CWG2586 are addressed in a follow up patch. PR c++/102609 gcc/cp/ChangeLog: PR c++/102609 C++23 P0847R7 (deducing this) - initial functionality. * class.cc (xobj_iobj_parameters_correspond): New function, checks for corresponding object parameters between xobj and iobj member functions. (add_method): Handle object parameters of xobj member functions, use xobj_iobj_parameters_correspond. * call.cc (build_over_call): Refactor, handle xobj member functions. (cand_parms_match): Handle object parameters of xobj and iobj member functions, use xobj_iobj_parameters_correspond. * cp-tree.h (enum cp_decl_spec): Add ds_this, add comments. * decl.cc (grokfndecl): Add xobj_func_p parameter. For xobj member functions, Set xobj_flag, don't set static_function flag. (grokdeclarator): Handle xobj member functions, tell grokfndecl. (grok_op_properties): Don't error for xobj operators. * parser.cc (cp_parser_decl_specifier_seq): Handle this specifier. (cp_parser_parameter_declaration): Set default argument to "this_identifier" for xobj parameters. (set_and_check_decl_spec_loc): Add "this", add comments. * tree.cc (build_min_non_dep_op_overload): Handle xobj operators. * typeck.cc (cp_build_addr_expr_1): Handle address-of xobj member functions. gcc/testsuite/ChangeLog: PR c++/102609 C++23 P0847R7 (deducing this) - initial functionality. * g++.dg/cpp23/explicit-obj-basic1.C: New test. * g++.dg/cpp23/explicit-obj-basic2.C: New test. * g++.dg/cpp23/explicit-obj-basic3.C: New test. * g++.dg/cpp23/explicit-obj-basic4.C: New test. * g++.dg/cpp23/explicit-obj-basic5.C: New test. * g++.dg/cpp23/explicit-obj-by-value1.C: New test. * g++.dg/cpp23/explicit-obj-by-value2.C: New test. * g++.dg/cpp23/explicit-obj-by-value3.C: New test. * g++.dg/cpp23/explicit-obj-by-value4.C: New test. * g++.dg/cpp23/explicit-obj-constraints.C: New test. * g++.dg/cpp23/explicit-obj-constraints2.C: New test. * g++.dg/cpp23/explicit-obj-ops-mem-arrow.C: New test. * g++.dg/cpp23/explicit-obj-ops-mem-assignment.C: New test. * g++.dg/cpp23/explicit-obj-ops-mem-call.C: New test. * g++.dg/cpp23/explicit-obj-ops-mem-subscript.C: New test. * g++.dg/cpp23/explicit-obj-ops-non-mem-dep.C: New test. * g++.dg/cpp23/explicit-obj-ops-non-mem-non-dep.C: New test. * g++.dg/cpp23/explicit-obj-ops-non-mem.h: New test. * g++.dg/cpp23/explicit-obj-ops-requires-mem.C: New test. * g++.dg/cpp23/explicit-obj-ops-requires-non-mem.C: New test. * g++.dg/cpp23/explicit-obj-redecl.C: New test. * g++.dg/cpp23/explicit-obj-redecl2.C: New test. * g++.dg/cpp23/explicit-obj-redecl3.C: New test. * g++.dg/cpp23/explicit-obj-redecl4.C: New test. Signed-off-by:
Waffl3x <waffl3x@protonmail.com>
-
waffl3x authored
Adds the xobj_flag member to lang_decl_fn and a corresponding member access macro and predicate to support the addition of explicit object member functions. Additionally, since explicit object member functions are also non-static member functions, we need to change uses of DECL_NONSTATIC_MEMBER_FUNCTION_P to clarify whether they intend to include or exclude them. PR c++/102609 gcc/cp/ChangeLog: * cp-tree.h (struct lang_decl_fn): New data member. (DECL_NONSTATIC_MEMBER_FUNCTION_P): Poison. (DECL_IOBJ_MEMBER_FUNCTION_P): Define. (DECL_FUNCTION_XOBJ_FLAG): Define. (DECL_XOBJ_MEMBER_FUNCTION_P): Define. (DECL_OBJECT_MEMBER_FUNCTION_P): Define. (DECL_FUNCTION_MEMBER_P): Don't use DECL_NONSTATIC_MEMBER_FUNCTION_P. (DECL_CONST_MEMFUNC_P): Likewise. (DECL_VOLATILE_MEMFUNC_P): Likewise. (DECL_NONSTATIC_MEMBER_P): Likewise. * module.cc (trees_out::lang_decl_bools): Handle xobj_flag. (trees_in::lang_decl_bools): Handle xobj_flag. * call.cc (build_this_conversion) (add_function_candidate) (add_template_candidate_real) (add_candidates) (maybe_warn_class_memaccess) (cand_parms_match) (joust) (do_warn_dangling_reference) * class.cc (finalize_literal_type_property) (finish_struct) (resolve_address_of_overloaded_function) * constexpr.cc (is_valid_constexpr_fn) (cxx_bind_parameters_in_call) * contracts.cc (build_contract_condition_function) * cp-objcp-common.cc (cp_decl_dwarf_attribute) * cxx-pretty-print.cc (cxx_pretty_printer::postfix_expression) (cxx_pretty_printer::declaration_specifiers) (cxx_pretty_printer::direct_declarator) * decl.cc (cp_finish_decl) (grok_special_member_properties) (start_preparsed_function) (record_key_method_defined) * decl2.cc (cp_handle_deprecated_or_unavailable) * init.cc (find_uninit_fields_r) (build_offset_ref) * lambda.cc (lambda_expr_this_capture) (maybe_generic_this_capture) (nonlambda_method_basetype) * mangle.cc (write_nested_name) * method.cc (early_check_defaulted_comparison) (skip_artificial_parms_for) (num_artificial_parms_for) * pt.cc (is_specialization_of_friend) (determine_specialization) (copy_default_args_to_explicit_spec) (check_explicit_specialization) (tsubst_contract_attribute) (check_non_deducible_conversions) (more_specialized_fn) (maybe_instantiate_noexcept) (register_parameter_specializations) (value_dependent_expression_p) * search.cc (shared_member_p) (lookup_member) (field_access_p) * semantics.cc (finish_omp_declare_simd_methods) * tree.cc (lvalue_kind) * typeck.cc (invalid_nonstatic_memfn_p): Don't use DECL_NONSTATIC_MEMBER_FUNCTION_P. libcc1/ChangeLog: * libcp1plugin.cc (plugin_pragma_push_user_expression): Don't use DECL_NONSTATIC_MEMBER_FUNCTION_P. Signed-off-by:
Waffl3x <waffl3x@protonmail.com> Co-authored-by:
Jason Merrill <jason@redhat.com>
-
Jeff Law authored
xstormy16 has failed since the c99 transition due to a missing prototype for __clzhi2 in the implementation of stormy16_count_leading_zeros. This fixes the missing prototype. Pushed to the trunk. include/ * longlong.h (__stormy16_count_leading_zeros): Add prototype for __clzhi2.
-
Jonathan Wakely authored
I don't remember exactly why I made these bits of code reserve space in a COW string and append to it, rather than just use the string returned from std::format (which will undergo copy elision). The _Str_sink type used by std::format means the string only performs a single allocation for the formatted output, and the returned string's reference count will be one, so won't reallocate when indexing into it. We can remove these non-optimizations. libstdc++-v3/ChangeLog: * include/bits/chrono_io.h (__formatter_chrono::_M_F): Simplify handling of string returned from std::format. (__formatter_chrono::_M_R_T): Likewise.
-
Jeff Law authored
So I consider this port dead as it semi-randomly fails in reload due to unrelated changes earlier in the gimple and RTL pipelines. Regardless Richard S's late-combine work did show a very obvious error in the port that we should go ahead and fix as long as the port is in-tree. The epiphany add-with-immediate instruction allows an 11 bit signed immediate. That gives the instruction an immediate range of -1024..1023. The port actually allowed -8192..8191 due to the uber-weird constraint definition. I've simplified the constraint to match the hardware documentation I was able to find. That was enough to get the epiphany port to build libgcc/newlib with Richard S's late-combine work. The testsuite is so flakey on that port (due to the reload failures) that my tester doesn't run it. So no comparisons are available. gcc/ * config/epiphany/constraints.md (Car): Allow -1024..1023, no more, no less.
-
Richard Sandiford authored
Richard Sandiford debugged a failure on the mn103 port with his late-combine patches down to the subdi3 pattern not specifying the isa on alternatives which required newer variants of the chip family. This patch adds the missing isa attribute and the port now works with his late-combine patch. I'm pushing this to the trunk on his behalf. gcc/ * config/mn10300/mn10300.md (subdi3_degenerate): Add isa attribute.
-
Tamar Christina authored
It looks like the previous patch had an unused variable. It's odd that my bootstrap didn't catch it (I'm assuming -Werror is still on for O3 bootstraps) but this fixes it. gcc/ChangeLog: * tree-vect-loop.cc (vectorizable_live_operation_1): Drop unused restart_loop. (vectorizable_live_operation): Likewise.
-
Siddhesh Poyarekar authored
The "exploitable vulnerability" may lead to a misunderstanding that missed hardening issues are considered vulnerabilities, just that they're not exploitable. This is not true, since while hardening bugs may be security-relevant, the absence of hardening does not make a program any more vulnerable to exploits than without. Drop the "exploitable" word to make it clear that missed hardening is not considered a vulnerability. Signed-off-by:
Siddhesh Poyarekar <siddhesh@gotplt.org> ChangeLog: * SECURITY.txt: Drop "exploitable" in the hardening section.
-
Tom Tromey authored
When I enable cgen rebuilding in the binutils-gdb tree, the default is to run cgen using 'guile'. However, on my host, guile is guile 2.2, which doesn't work for me -- I have to use guile3.0. This patch arranges to pass "GUILE" down to subdirectories, so I can use 'make GUILE=guile3.0'. * Makefile.in: Rebuild. * Makefile.tpl (BASE_EXPORTS): Add GUILE. (GUILE): New variable. * Makefile.def (flags_to_pass): Add GUILE.
-
Jakub Jelinek authored
The copy attributes is allowed on decls as well as types and even has checks whether decl (set to *node) is DECL_P or TYPE_P, but for diagnostics unconditionally uses DECL_SOURCE_LOCATION (decl), which obviously only works if it applies to a decl. 2024-01-09 Jakub Jelinek <jakub@redhat.com> PR c/113262 * c-attribs.cc (handle_copy_attribute): Don't use DECL_SOURCE_LOCATION (decl) if decl is not DECL_P, use input_location instead. Formatting fixes. * gcc.dg/pr113262.c: New test.
-
Tamar Christina authored
I was generating the vector reverse mask without checking if the target actually supported such an operation. This patch changes it to if the bitstart is 0 then use BIT_FIELD_REF instead to extract the first element since this is supported by all targets. This is good for now since masks always come from whilelo. But in the future when masks can come from other sources we will need the old code back. gcc/ChangeLog: PR tree-optimization/113199 * tree-vect-loop.cc (vectorizable_live_operation_1): Use BIT_FIELD_REF. gcc/testsuite/ChangeLog: PR tree-optimization/113199 * gcc.target/gcn/pr113199.c: New test.
-
Gaius Mulley authored
This patch contains a fix to gcc/m2/gm2-compiler/M2GCCDeclare.mod. The fix introduces a group of sets which can be compared. The resolver will loop until there is no change in all sets within the group. Since symbols migrate from set to set without ever looping this will never hang. Previously only the number of elements in a set were compared which resulted in a infinite spin. gcc/m2/ChangeLog: PR modula2/112920 * gm2-compiler/M2GCCDeclare.mod (Group): New declaration. Import MakeSubrange, MakeConstVar, MakeConstLit and DivTrunc. (FreeGroup): New declaration. (GlobalGroup): New declaration. (ToBeSolvedByQuads): Remove. (NilTypedArrays): Remove. (PartiallyDeclared): Remove. (HeldByAlignment): Remove. (FinishedAlignment): Remove. (ToDoList): Remove. (DebugSet): Re-format. (DebugNumber): Re-format. (DebugSetNumbers): Reference sets using GlobalGroup. (AddSymToWatch): Re-format. (WatchIncludeList): Reference sets using GlobalGroup. (WatchRemoveList): Reference sets using GlobalGroup. (NewGroup): New procedure. (DisposeGroup): New procedure. (InitGroup): New procedure. (KillGroup): New procedure. (DupGroup): New procedure. (EqualGroup): New procedure. (LookupSet): New procedure. (CanDeclareTypePartially): Reference sets using GlobalGroup. (CompletelyResolved): Reference sets using GlobalGroup. (IsNilTypedArrays): Reference sets using GlobalGroup. (IsFullyDeclared): Reference sets using GlobalGroup. (IsPartiallyDeclared): Reference sets using GlobalGroup. (IsPartiallyOrFullyDeclared): Reference sets using GlobalGroup. (DeclareTypeConstFully): Reference sets using GlobalGroup. (bodyl): Remove. (Body): Use bodyt and to lookup the required set. (ForeachTryDeclare): Remove parameter l. Lookup set instead. (DeclareOutstandingTypes): Add new rules setarraynul and setfully. Reference sets using GlobalGroup. (ActivateWatch): New procedure. (DeclareTypesConstantsProceduresInRange): Re-written to check group change. (DeclareTypesConstantsProcedures): Re-written to check group change. (DeclareBoolean): Reference sets using GlobalGroup. (DeclarePackedBoolean): Ditto. (DeclareDefaultConstants): Ditto. (FreeGroup): Initialized. (GlobalGroup): Ditto. * gm2-compiler/Sets.def (EqualSet): New procedure function. Remove export qualified list of identifiers. * gm2-compiler/Sets.mod (EqualSet): New procedure function. Signed-off-by:
Gaius Mulley <gaiusmod2@gmail.com>
-
Tamar Christina authored
The tests I recently added for early break fail in thumb mode because in thumb mode `cbz/cbnz` exist and so the cmp+branch is fused. This updates the testcases to accept either output. gcc/testsuite/ChangeLog: * gcc.target/arm/vect-early-break-cbranch.c: Accept thumb output.
-
Eric Botcazou authored
This occurs because the access element type is not its own TYPE_CANONICAL, which creates a discrepancy between the aliasing support code, which deals with types directly, and the middle-end which looks at TYPE_CANONICAL only. gcc/ada/ * gcc-interface/decl.cc (gnat_to_gnu_entity) <E_Array_Type>: Use the TYPE_CANONICAL of types when it comes to aliasing. * gcc-interface/utils.cc (relate_alias_sets): Likewise.
-
Eric Botcazou authored
This declares an explicit temporary for the fields of the fat pointer type in gnat_to_gnu_entity and removes the GNU_ prefix of the parameters of the relate_alias_sets routine for the sake of brevity. No functional changes. gcc/ada/ * gcc-interface/decl.cc (gnat_to_gnu_entity) <E_Array_Type>: Use a separate FLD local variable to hold the first field of the fat pointer type being built. * gcc-interface/gigi.h (relate_alias_sets): Remove GNU_ prefix on the first two parameters. * gcc-interface/utils.cc (relate_alias_sets): Likewise and adjust.
-
Viljar Indus authored
In some extended code we generate comparisons between the Addresses of some variables. This causes those variables to be considered modified. Whereas in this particular scenario the variables are just referenced. gcc/ada/ * sem_attr.adb: avoid marking a use of the Address attribute as a modification of its prefix.
-
Gary Dismukes authored
Fixing two places flagged by gnatcheck to use "No" instead of "not Present". gcc/ada/ * exp_aggr.adb (Expand_Container_Aggregate): Change "not Present" tests to tests using "No" (in two places).
-
Bob Duff authored
It is legal to pass a private type, or a type with a component whose type is private, as a generic actual type if the formal is a generic formal incomplete type. This patch fixes a bug in which the compiler would give an error in some such cases. Also misc cleanup. gcc/ada/ * sem_ch12.adb (Instantiate_Type): Make the relevant error message conditional upon "Ekind (A_Gen_T) /= E_Incomplete_Type". Misc cleanup.
-
Gary Dismukes authored
In the case of an indexed aggregate of a container type with both Add_Unnamed and New_Indexed specified in the Aggregate aspect of the type (such as for the Vector type in Ada.Containers.Vectors), in cases where a component association is given by an iterator_specification, the compiler could end up generating a call to the New_Indexed operation rather than the Empty operation. For example, in the case of a Vector type, this could result in allocating a container of the size of the defaulted Capacity formal of the New_Vector function (with uninitialized components), and elements added in the aggregate would append to that preallocated Vector. The compiler is corrected so that the Empty function is called to initialize the implicit aggregate object, rather than the New_Indexed function. gcc/ada/ * exp_aggr.adb (Expand_Container_Aggregate): Add code to determine whether the aggregate is an indexed aggregate, setting a flag (Is_Indexed_Aggregate), which is tested to have proper separation of treatment for the Add_Unnamed (for positional aggregates) and New_Indexed (for indexed aggregates) cases. In the code generating associations for indexed aggregates, remove the code for Expressions cases entirely, since the code for indexed aggregates is governed by the presence of Component_Associations, and add an assertion that Expressions must be Empty. Also, exclude empty aggregates from entering that code.
-
Eric Botcazou authored
The compiler has not generated direct attachments for a long time. gcc/ada/ * rtsfind.ads (RE_Id): Remove RE_Attach. (RE_Unit_Table): Likewise. * libgnat/s-finmas.ads (Attach): Delete. * libgnat/s-finmas.adb (Attach): Likewise.
-
Tucker Taft authored
Check_Scil failed due to not handling a type that came from a package that was mentioned in a limited-with clause. Also, an aggregate with an uninitialized component was not being pretty-printed properly. gcc/ada/ * pprint.adb (List_Name): Check for "Box_Present" when displaying a list, and emit "<>" if returns True. * sem_scil.adb (Check_SCIL_Node): Handle case when the type of a parameter is from a package that was mentioned in a limited with clause, and make no further checks, since this check routine does not have all the logic to check such a usage.
-
Eric Botcazou authored
The problem is that the freeze node for the class-wide subtype built for the expression of the allocator escapes from the dependent expression instead of being stored in its list of actions. gcc/ada/ * freeze.adb (Freeze_Expression.Has_Decl_In_List): Deal specifically with itypes that are class-wide subtypes.
-
Eric Botcazou authored
This is modeled on the existing binding for __atomic_load_n. gcc/ada/ * libgnat/s-atopri.ads (Atomic_Store): New generic procedure. (Atomic_Store_8): New instantiated procedure. (Atomic_Store_16): Likewise. (Atomic_Store_32): Likewise. (Atomic_Store_64): Likewise. * libgnat/s-atopri__32.ads (Atomic_Store): New generic procedure. (Atomic_Store_8): New instantiated procedure. (Atomic_Store_16): Likewise. (Atomic_Store_32): Likewise. * gcc-interface/decl.cc (gnat_to_gnu_subprog_type): Implement the support for __atomic_store_n and __sync_bool_compare_and_swap_n. * gcc-interface/gigi.h (list_second): New inline function.
-
Javier Miranda authored
Add missing support for RM 9.5.4(5.6/4): the target of a requeue statement may be a procedure when its name denotes a renaming of an entry. gcc/ada/ * sem_ch6.adb (Analyze_Subprogram_Specification): Do not replace the type of the formals with its corresponding record in init-procs. * sem_ch9.adb (Analyze_Requeue): Add missing support to requeue to a procedure that denotes a renaming of an entry.
-
Piotr Trojanek authored
In GNATprove mode the removal of side effects is only needed in certain syntactic contexts, which include subtype declarations. Now this removal is limited to genuine subtype declarations and not to itypes coming from expressions where side effects are not expected. gcc/ada/ * exp_util.adb (Possible_Side_Effect_In_SPARK): Refine handling of itype declarations.
-
Piotr Trojanek authored
Previously if a subprogram call could not be inlined in GNATprove mode, then all subsequent calls to the same subprogram were not inlined either (because a failed attempt to inline clears flag Is_Inlined_Always and we tested this flag when attempting to inline subsequent calls). Now a failure in inlining of a particular call does not prevent inlining of subsequent calls to the same subprogram, except when inlining failed because the subprogram was detected to be recursive (which clears the Is_Inlined flag that we now examine). This change allows more checks to be proved and reduces interactions between inlining and SPARK legality checks. gcc/ada/ * sem_ch6.adb (Analyze_Subprogram_Specification): Set Is_Inlined flag by default in GNATprove mode. * sem_res.adb (Resolve_Call): Only look at flag which is cleared when inlined subprogram is detected to be recursive.
-
Piotr Trojanek authored
Inlining of subprogram calls happens in routine Expand_Inlined_Call which calls Establish_Actual_Mapping_For_Inlined_Call. Both routines had detection of recursive calls. The detection in the second routine was dead code. gcc/ada/ * inline.adb (Establish_Actual_Mapping_For_Inlined_Call): Remove detection of recursive calls.
-
Piotr Trojanek authored
Removed code was dead because it could only be executed when Back_End_Inlining is True and that flag is always false in GNATprove_Mode. gcc/ada/ * inline.adb (Cannot_Inline): Cleanup use of 'Length; remove dead code.
-
Piotr Trojanek authored
Fix style violation reported by GNATcheck. gcc/ada/ * sem_aggr.adb (Resolve_Container_Aggregate): Use "No". * sem_ch8.adb (Find_Direct_Name): Likewise.
-
Steve Baird authored
Fix Sem_Util.Enclosing_Declaration to not return an N_Subprogram_Specification node. Remove code in various places that was formerly needed to cope with this misbehavior. gcc/ada/ * sem_util.adb (Enclosing_Declaration): Instead of returning a subprogram specification node, return its parent (which is presumably a subprogram declaration). * contracts.adb (Insert_Stable_Property_Check): Remove code formerly needed to compensate for incorrect behavior of Sem_Util.Enclosing_Declaration. * exp_attr.adb (In_Available_Context): Remove code formerly needed to compensate for incorrect behavior of Sem_Util.Enclosing_Declaration. * sem_ch8.adb (Is_Actual_Subp_Of_Inst): Remove code formerly needed to compensate for incorrect behavior of Sem_Util.Enclosing_Declaration.
-
Steve Baird authored
In some cases the compiler would crash or generate spurious errors compiling a legal object renaming declaration that lacks a subtype mark. In addition to fixing the immediate problem, change Atree.Copy_Slots so that attempts to modify either the Empty or the Error nodes (e.g., by passing one of them as the target in a call to Rewrite) are ineffective. Cope with the consequences of this. gcc/ada/ * sem_ch8.adb (Check_Constrained_Object): Before updating the subtype mark of an object renaming declaration by calling Rewrite, first check whether the destination of the Rewrite call exists. * atree.adb (Copy_Slots): Return without performing any updates if Destination equals Empty or Error, or if Source equals Empty. Any of those conditions indicates an error case. * sem_ch12.adb (Analyze_Formal_Derived_Type): Avoid cascading errors. * sem_ch3.adb (Analyze_Number_Declaration): In an error case, do not pass Error as destination in a call to Rewrite. (Find_Type_Of_Subtype_Indic): In an error case, do not pass Error or Empty as destination in a call to Rewrite.
-
Joffrey Huguet authored
The precondition of both Update procedures in Interfaces.C.Strings were incorrect. This patch fixes this. gcc/ada/ * libgnat/i-cstrin.ads (Update): Fix precondition.
-
Eric Botcazou authored
The only functions using the BIP protocol are now those returning a limited type: Is_Build_In_Place_Result_Type => Is_Inherently_Limited_Type. gcc/ada/ * sem_aggr.adb (Resolve_Extension_Aggregate): Remove the unreachable call to Transform_BIP_Assignment as well as the procedure.
-