- Jun 01, 2022
-
-
Julien Bortolussi authored
Correction of a typo regarding indexes. gcc/ada/ * libgnat/a-cfdlli.adb ("="): Make the function properly loop over the right list.
-
Marc Poulhiès authored
When subtype predicate checks are added for object declarations, it could lead to a compiler crash or to an incorrect check. When the subtype for the object being declared is built later by Analyze_Object_Declaration, the predicate check can't be applied on the object instead of a copy as the call will be incorrect after the subtype has been built. When subtypes for LHS and RHS do not statically match, only checking the predicate on the object after it has been initialized may miss a failing predicate on the RHS. In both cases, skip the optimization and check the predicate on a copy. Rename Should_Build_Subtype into Build_Default_Subtype_OK and move it out of sem_ch3 to make it available to other part of the compiler (in particular to checks.adb). gcc/ada/ * checks.adb (Apply_Predicate_Check): Refine condition for applying optimization. * sem_ch3.adb (Analyze_Component_Declaration): Adjust calls to Should_Build_Subtype. (Analyze_Object_Declaration): Likewise. (Should_Build_Subtype): Rename/move to ... * sem_util.ads (Build_Default_Subtype_OK): ... this. * sem_util.adb (Build_Default_Subtype_OK): Moved from sem_ch3.adb.
-
Doug Rupp authored
Bump the pc +3 total for Thumb mode, the same calculation that as is done for arm-linux. gcc/ada/ * init.c (__gnat_adjust_context_for_raise) [QNX][__thumb2__]: Bump the pc an extra byte.
-
Ghjuvan Lacambre authored
This commit makes GNAT use absolute paths in -fdiagnostics-format=json's output when -gnatef is present on the command line. This makes life easier for tools that ingest GNAT's output. gcc/ada/ * doc/gnat_ugn/building_executable_programs_with_gnat.rst: Document new behavior. * errout.adb (Write_JSON_Location): Output absolute paths when needed. * switch-c.adb (Scan_Front_End_Switches): Update -gnatef comment. * usage.adb (Usage): Update description of -gnatef. * gnat_ugn.texi: Regenerate.
-
Eric Botcazou authored
The combination of pragma/aspect Inline_Always and -gnateV -gnata runs afoul of the handling of inlining across units by gigi, which does not inline a subprogram that calls nested subprograms if these subprograms are not themselves inlined. This condition does not apply to internally generated subprograms but the special _postconditions procedure has Debug_Info_Needed set so it is not considered as such and, as a consequence, triggers an error if the enclosing subprogram requires inlining by means of Inline_Always. The _postconditions procedure is already marked inlined when generating C code so it makes sense to mark it inlined in the general case as well. gcc/ada/ * contracts.adb (Build_Postconditions_Procedure): Set Is_Inlined unconditionnally on the procedure entity.
-
Piotr Trojanek authored
When analyzing an array or record type declaration whose component has a constrained access type, e.g.: type Buffer_Acc is not null access all String; type Buffer_Rec is record Data : Buffer_Acc (1 .. 10); end record; type Buffer_Arr is array (Boolean) of Buffer_Acc (1 .. 10); we propagated various properties of the unconstrained access type (e.g. the designated type, access-to-constant flag), but forgot to propagate the null-exclusion. For GNAT it didn't make a big difference, because the (anonymous) component type was never subject to legality checks. The "value tracking" optimisation machinery, which also deals with null values, only works for entire objects and doesn't care about components. However, GNATprove uses this flag when an access-to-component object is dereferenced. gcc/ada/ * sem_ch3.adb (Constrain_Access): Propagate null-exclusion flag from parent type.
-
Eric Botcazou authored
gcc/ada/ * sem_ch5.adb (Analyze_Loop_Statement): Add a comment about a finalization issue.
-
Eric Botcazou authored
The initial work didn't change anything for limited types because they use a specific return mechanism for functions called build-in-place where there is no anonymous return object, so the secondary stack was used only for the sake of consistency with the nonlimited case. This change aligns the limited case with the nonlimited case, i.e. either they both use the primary stack or they both use the secondary stack. gcc/ada/ * exp_ch6.adb (Caller_Known_Size): Call Returns_On_Secondary_Stack instead of Requires_Transient_Scope and tidy up. (Needs_BIP_Alloc_Form): Likewise. * exp_util.adb (Initialized_By_Aliased_BIP_Func_Call): Also return true if the build-in-place function call has no BIPalloc parameter. (Is_Finalizable_Transient): Remove redundant test.
-
Alexandre Oliva authored
Some features haven't got customer feedback or made upstream yet. gcc/ada/ * doc/gnat_rm/security_hardening_features.rst: Note that hardening features are experimental. * gnat_rm.texi: Regenerate.
-
Steve Baird authored
Avoid improperly suppressing checks for the wrapper subprogram that is built when a null type extension inherits (and does not override) a function with a controlling result. This is a follow-up to other changes already made on this ticket. gcc/ada/ * exp_ch3.adb (Make_Controlling_Function_Wrappers): Set the Corresponding_Spec field of a wrapper subprogram body before analyzing the subprogram body; the field will be set (again) during analysis, but we need it to be set earlier. * exp_ch13.adb (Expand_N_Freeze_Entity): Add wrapper subprogram bodies to the list of declarations for which we do not want to suppress checks.
-
Eric Botcazou authored
This is needed after the creation of Returns_On_Secondary_Stack from the original Requires_Transient_Scope. gcc/ada/ * sem_util.adb (Indirect_Temp_Needed): Adjust reference in comment.
-
Doug Rupp authored
Shared libraries now fully supported on arm-qnx. gcc/ada/ * Makefile.rtl (GNATLIB_SHARED): Revert disablement for arm-qnx.
-
Eric Botcazou authored
Having components that need to be returned on the secondary stack would not always force a record type to be returned on the secondary stack itself. gcc/ada/ * sem_util.adb (Returns_On_Secondary_Stack.Caller_Known_Size_Record): Directly check the dependence on discriminants for the variant part, if any, instead of calling the Is_Definite_Subtype predicate.
-
Ghjuvan Lacambre authored
gcc/ada/ * sem_warn.adb (Warn_On_Unreferenced_Entity): Fix warning tag.
-
Ghjuvan Lacambre authored
This makes tagging more accurate. gcc/ada/ * sem_warn.adb (Check_References): Adjust conditions under which warning messages should be emitted and their tags as well.
-
Eric Botcazou authored
No functional changes. gcc/ada/ * exp_disp.ads (Expand_Interface_Thunk): Change type of Prim. * exp_disp.adb (Expand_Interface_Thunk): Declare Is_Predef_Op earlier, do not initialize Iface_Formal, use No idiom and tweaks comments. (Register_Primitive): Declare L earlier and tweak comments. * sem_disp.adb (Check_Dispatching_Operation): Move tests out of loop.
-
Steve Baird authored
In some cases, the compiler would incorrectly fail to generate discriminant checks when accessing fields declared in a variant part. Correct some such cases; detect the remaining cases and flag them as unsupported. The formerly-problematic cases that are now handled correctly involve component references occurring in a predicate expression (e.g., the expression of a Dynamic_Predicate aspect specification) for a type declaration (not for a subtype declaration). The cases which are now flagged as unsupported involve expression functions declared before the discriminated type in question has been frozen. gcc/ada/ * exp_ch3.ads: Replace visible Build_Discr_Checking_Funcs (which did not need to be visible - it was not referenced outside this package) with Build_Or_Copy_Discr_Checking_Funcs. * exp_ch3.adb: Refactor existing code into 3 procedures - Build_Discr_Checking_Funcs, Copy_Discr_Checking_Funcs, and Build_Or_Copy_Discr_Checking_Funcs. This refactoring is intended to be semantics-preserving. * exp_ch4.adb (Expand_N_Selected_Component): Detect case where a call should be generated to the Discriminant_Checking_Func for the component in question, but that subprogram does not yet exist. * sem_ch13.adb (Freeze_Entity_Checks): Immediately before calling Build_Predicate_Function, add a call to Exp_Ch3.Build_Or_Copy_Discr_Checking_Funcs in order to ensure that Discriminant_Checking_Func attributes are already set when Build_Predicate_Function is called. * sem_ch6.adb (Analyze_Expression_Function): If the expression of a static expression function has been transformed into an N_Raise_xxx_Error node, then we need to copy the original expression in order to check the requirement that the expression must be a potentially static expression. We also want to set aside a copy the untransformed expression for later use in checking calls to the expression function via Inline_Static_Function_Call. So introduce a new function, Make_Expr_Copy, for use in these situations. * sem_res.adb (Preanalyze_And_Resolve): When analyzing certain expressions (e.g., a default parameter expression in a subprogram declaration) we want to suppress checks. However, we do not want to suppress checks for the expression of an expression function.
-
Bob Duff authored
This patch makes the search for Get_Element_Access, Step (Next/Prev), Reference_Control_Type, and Pseudo_Reference (for optimized "for ... of" loops) more robust. In particular, we have a new Next procedure in Ada 2022, and we need to pick the right one. We have not yet added the new Next and other subprograms. gcc/ada/ * exp_ch5.adb (Expand_Iterator_Loop_Over_Container): For each subprogram found, assert that the variable is Empty, so we can detect bugs where we find two or more things with the same name. Without this patch, that bug would happen when we add the new Next procedure. For Step, make sure we pick the right one, by checking name and number of parameters. For Get_Element_Access, check that we're picking a function. That's not really necessary, because there is no procedure with that name, but it seems cleaner this way. * rtsfind.ads: Minor comment improvement. It seems kind of odd to say "under no circumstances", and then immediately contradict that with "The one exception is...".
-
Doug Rupp authored
The usual increment of the pc to pc+2 for ARM is needed. gcc/ada/ * init.c (QNX): __gnat_adjust_context_for_raise: New implementation for arm-qnx.
-
Julien Bortolussi authored
This patch adds reference counting to dynamically allocated pointers on arrays and elements used by the functional container. This is done by making both the arrays and the elements controlled. gcc/ada/ * libgnat/a-cofuba.ads, libgnat/a-cofuba.adb: Add reference counting.
-
Yannick Moy authored
Augment the warnings issued with switch -gnatwh, so that a warning is also issued when an entity from the package of a use_clause ends up hidden due to an existing visible homonym. gcc/ada/ * sem_ch8.adb (Use_One_Package): Possibly warn. * sem_util.adb (Enter_Name): Factor out warning on hidden entity. (Warn_On_Hiding_Entity): Extract warning logic from Enter_Name and generalize it to be applied also on use_clause. * sem_util.ads (Warn_On_Hiding_Entity): Add new procedure.
-
Yannick Moy authored
Various cases of out-of-order keywords in the definition of a record were already detected. This adds a similar detection after NULL and RECORD keywords. gcc/ada/ * par-ch3.adb (P_Known_Discriminant_Part_Opt): Reword error message to benefit from existing codefix. (P_Record_Definition): Detect out-of-order keywords in record definition and issue appropriate messages. Other cases are already caught at appropriate places.
-
Eric Botcazou authored
This case was missed in the previous change. gcc/ada/ * exp_ch6.adb (Freeze_Subprogram.Register_Predefined_DT_Entry): Put the actions into the Actions field of the freeze node instead of inserting them after it.
-
Marc Poulhiès authored
Both flags were added when square brackets for array/container aggregates have been enabled with -gnat2022 without their corresponding inline documentation. This change adds the missing documention. gcc/ada/ * sinfo.ads: Add inline documention for Is_Parenthesis_Aggregate and Is_Enum_Array_Aggregate.
-
Bob Duff authored
This patch fixes a bug where the compiler generates incorrect code for a call via an object with convention C, whose type is an anonymous access-to-function type. gcc/ada/ * einfo-utils.adb (Set_Convention): Call Set_Convention recursively, so that Set_Can_Use_Internal_Rep is called (if appropriate) on the anonymous access type of the object, and its designated subprogram type. * sem_ch3.adb (Access_Definition): Remove redundant call to Set_Can_Use_Internal_Rep.
-
Bob Duff authored
For a membership test "X in A .. B", the compiler used to warn if it could prove that X is within one of the bounds. For example, if we know at compile time that X >= A, then the above could be replaced by "X <= B". This patch suppresses that warning, because there is really nothing wrong with the membership test, and programmers sometimes find it annoying. gcc/ada/ * exp_ch4.adb (Expand_N_In): Do not warn in the above-mentioned cases. * fe.h (Assume_No_Invalid_Values): Remove from fe.h, because this is not used in gigi. * opt.ads (Assume_No_Invalid_Values): Improve the comment. We don't need to "clearly prove"; we can just "prove". Remove the comment about fe.h, which is no longer true.
-
Richard Biener authored
In unswitching we use ranger to simplify switch statements so we have to avoid doing anything for abnormals. 2022-05-30 Richard Biener <rguenther@suse.de> PR tree-optimization/105763 * tree-ssa-loop-unswitch.cc (find_unswitching_predicates_for_bb): Check gimple_range_ssa_p. * gcc.dg/pr105763.c: New testcase.
-
GCC Administrator authored
-
- May 31, 2022
-
-
Patrick Palka authored
Here the out-of-line definition of Z<T>::z causes duplicate_decls to change z's type from using the primary template type Z<T> (which is also the type of the injected class name) to the implicit instantiation Z<T>, and this latter type lacks a TYPE_BINFO (although its TYPE_CANONICAL was set by a special case in lookup_template_class to point to the former). Later, when processing the non-dependent call z->foo(0), build_over_call relies on the object argument's TYPE_BINFO to build the templated form for this call, which fails because the object argument type has empty TYPE_BINFO due to the above. It seems weird that the implicit instantiation Z<T> doesn't have the same TYPE_BINFO as the primary template type Z<T>, despite them being proclaimed equivalent via TYPE_CANONICAL. So I tried also setting TYPE_BINFO in the special case in lookup_template_class, but that led to some problems with constrained partial specializations of the form Z<T>. I'm not sure what, if anything, we ought to do about the subtle differences between these two versions of the same type. Fortunately it seems we don't need to rely on TYPE_BINFO at all in build_over_call here -- the z_candidate struct already contains the exact binfos we need to rebuild the BASELINK for the templated form. PR c++/105758 gcc/cp/ChangeLog: * call.cc (build_over_call): Use z_candidate::conversion_path and ::access_path instead of TYPE_BINFO when building the BASELINK for the templated form. gcc/testsuite/ChangeLog: * g++.dg/template/non-dependent24.C: New test.
-
Patrick Palka authored
r12-5487-g9bf69a8558638c replaced uses of timevar_cond_push/pop with auto_cond_timevar and removed now unnecessary wrapper functions. This patch does the same with timevar_push/pop and auto_timevar. gcc/cp/ChangeLog: * parser.cc: Use auto_timevar instead of timevar_push/pop. Remove wrapper functions. * pt.cc: Likewise.
-
Patrick Palka authored
This combines the two differently named versions of the same function into a single function utilizing a default argument. gcc/cp/ChangeLog: * cp-tree.h (cp_build_qualified_type_real): Rename to ... (cp_build_qualified_type): ... this. Give its last parameter a default argument. Remove macro of the same name. * decl.cc (grokdeclarator): Adjust accordingly. * pt.cc (tsubst_aggr_type): Likewise. (rebuild_function_or_method_type): Likewise. (tsubst): Likewise. (maybe_dependent_member_ref): Likewise. (unify): Likewise. * tree.cc (cp_build_qualified_type_real): Rename to ... (cp_build_qualified_type): ... this. Adjust accordingly.
-
Jason Merrill authored
A few globs missed in the .c -> .cc transition. Some targets were looking at both *.c and *.cc, but there are no longer any .c files to scan. gcc/ChangeLog: * Makefile.in (TAGS): Look at libcpp/*.cc. gcc/c/ChangeLog: * Make-lang.in (c.tags): Look at *.cc. gcc/cp/ChangeLog: * Make-lang.in (c++.tags): Just look at *.cc. gcc/d/ChangeLog: * Make-lang.in (d.tags): Just look at *.cc. gcc/fortran/ChangeLog: * Make-lang.in (fortran.tags): Look at *.cc. gcc/go/ChangeLog: * Make-lang.in (go.tags): Look at *.cc. gcc/objc/ChangeLog: * Make-lang.in (objc.tags): Look at *.cc. gcc/objcp/ChangeLog: * Make-lang.in (obj-c++.tags): Look at *.cc.
-
Iain Buclaw authored
As of gdc-12, the lexer expects there 4 bytes of zero padding at the end of the source buffer to mark the end of input. Sometimes when reading from stdin, the data at the end of input is garbage rather than zeroes. Fix that by explicitly calling memset past the end of the buffer. PR d/105544 gcc/d/ChangeLog: * d-lang.cc (d_parse_file): Zero padding past the end of the stdin buffer so the D lexer has a sentinel to stop parsing at.
-
Christophe Lyon authored
My r13-680-g0dc8e1e7026d9b commit to add support for Decimal Floating Point introduced: case SDmode: case DDmode: case TDmode: which are rejected by gcc-4.8 as build compiler. This patch replaces them with E_SDmode, E_DDmode and E_TD_mode. Committed as obvious. * config/aarch64/aarch64.cc (aarch64_gimplify_va_arg_expr): Prefix mode names with E_.
-
Alan Modra authored
include/ * dwarf2.def: Correct spelling of DW_AT_namelist_item. gcc/ * dwarf2out.cc (gen_namelist_decl): Adjust to suit correct spelling of DW_AT_namelist_item.
-
Patrick Palka authored
In passing, use bool for its return type. gcc/cp/ChangeLog: * cp-tree.h (comp_template_args): Change return type to bool. * pt.cc (comp_template_args): Document default arguments. Change return type to bool and adjust returns accordingly.
-
Patrick Palka authored
gcc/cp/ChangeLog: * decl.cc (grokvardecl): Use current_template_constraints. (grokdeclarator): Likewise. (xref_tag): Likewise. * semantics.cc (finish_template_template_parm): Likewise.
-
Jakub Jelinek authored
OpenMP 5.2 adds support for firstprivate and allocate clauses on the scope construct and this patch adds that support to GCC. 5.2 unfortunately (IMNSHO mistakenly) marked scope construct as worksharing, which implies that it isn't possible to nest inside of it other scope, worksharing loop, sections, explicit barriers, single etc. which would make scope far less useful. I'm not implementing that part, keeping the 5.1 behavior here, and will file an issue to revert that for OpenMP 6.0. But, for firstprivate it keeps the restriction that is now implied from worksharing construct that listed var can't be private in outer context, where for reduction 5.1 had similar restriction explicit even for scope and 5.2 has it implicitly through worksharing construct. 2022-05-31 Jakub Jelinek <jakub@redhat.com> gcc/ * omp-low.cc (build_outer_var_ref): For code == OMP_CLAUSE_ALLOCATE allow var to be private in the outer context. (lower_private_allocate): Pass OMP_CLAUSE_ALLOCATE as last argument to build_outer_var_ref. gcc/c/ * c-parser.cc (OMP_SCOPE_CLAUSE_MASK): Add firstprivate and allocate clauses. gcc/cp/ * parser.cc (OMP_SCOPE_CLAUSE_MASK): Add firstprivate and allocate clauses. gcc/testsuite/ * c-c++-common/gomp/scope-5.c: New test. * c-c++-common/gomp/scope-6.c: New test. * g++.dg/gomp/attrs-1.C (bar): Add firstprivate and allocate clauses to scope construct. * g++.dg/gomp/attrs-2.C (bar): Likewise. libgomp/ * testsuite/libgomp.c-c++-common/allocate-1.c (foo): Add testcase for scope construct with allocate clause. * testsuite/libgomp.c-c++-common/allocate-3.c (foo): Likewise. * testsuite/libgomp.c-c++-common/scope-2.c: New test.
-
GCC Administrator authored
-
- May 30, 2022
-
-
Marek Polacek authored
As discussed here: <https://gcc.gnu.org/pipermail/gcc-patches/2021-February/564629.html>, type_dependent_expression_p should not be called with a type argument. I promised I'd add an assert so here it is. One place needed adjusting. PR c++/99080 gcc/cp/ChangeLog: * pt.cc (type_dependent_expression_p): Assert !TYPE_P. * semantics.cc (finish_id_expression_1): Handle UNBOUND_CLASS_TEMPLATE specifically.
-