aboutsummaryrefslogtreecommitdiff
path: root/gcc
AgeCommit message (Collapse)AuthorFilesLines
2023-05-23ada: Sync different variants of interrupt handler registrationPiotr Trojanek4-70/+56
This patch propagates the apparently cleanest solutions between various variants of the runtime units for interrupt handler registration. In particular, the unnecessary default expressions for list cells with interrupt handler addresses are removed, the list is changed from doubly-linked to singly-linked, and assertion preventing registration of null addresses now appears in all runtimes. Effectively, it is just a code cleanup and minor optimization; behavior of the runtime unit is unaffected. gcc/ada/ * libgnarl/s-interr.adb (Registered_Handler): Remove default expression. (Registered_Handlers): Switch to singly-linked list. (Bind_Interrupt_To_Entry): Sync whitespace with other unit variants. (Is_Registered): Use singly-linked list. (Register_Interrupt_Handler): Use singly-linked list and initialized allocator; sync assertion with other unit variants. * libgnarl/s-interr__sigaction.adb: Likewise. * libgnarl/s-interr__vxworks.adb: Likewise. * libgnarl/s-interr__hwint.adb: Likewise. (Is_Registered): Remove repeated declaration.
2023-05-23ada: Revert to old pretty-printing of internal entities for CodePeerPiotr Trojanek1-3/+19
Add some defensive code to get pretty-printed CodePeer outputs for ACATS back to shape. At least some of this code appears to be redundant and perhaps unnecessary, but we can this up later. Expression pretty-printer should not be called with N_Defining_Identifier nodes at all, since they are not expressions. However, for those that come not from source, CodePeer expects that the Ident_Image routine will convert the internal names like "xL" to their corresponding human-readable representation like "x'Accesibility_Level". gcc/ada/ * pprint.adb (Expression_Image): Restore some of the old pretty-printing for CodePeer.
2023-05-23ada: Ignore accessibility actuals in expression pretty-printerPiotr Trojanek1-0/+18
Extra actual parameters for accessibility checks are confusing for the expression pretty-printer that is used by CodePeer. It seems that nodes created for the accessibility checks should use the Sloc of the source expression of accessibility checks, not the target. However, this is problematic to achieve with the current implementation of accessibility checks, so with this patch we will simply ignore the accessibility actuals when computing Slocs for expression pretty-printing. gcc/ada/ * errout.adb (First_And_Last_Nodes): Ignore accessibility parameters.
2023-05-23ada: Remove special-case for parentheses in expansion for GNATprovePiotr Trojanek1-8/+0
When expanding of inequality operators for GNAT we were adding extra parens, supposedly to "fix Sprint output" (source print); for GNATprove we didn't, as these extra parens were leading to wrong columns for check messages. Adding these extra parens couldn't be a right, because Sprint should produce reasonable output regardless of the parens, especially since we don't care about parens when creating AST in expansion. Avoiding them for GNATprove couldn't be right either, because source printing should work regardless of the GNAT/GNATprove mode. The proper fix for GNAT is rather to not add parens at all and tune source printing, if necessary. The proper fix for GNATprove is not have them either, as it confuses the heuristic in First_Sloc, which is then used by Compute_Sloc. gcc/ada/ * exp_ch4.adb (Expand_N_Op_Ne): Simply don't add extra parens.
2023-05-23ada: Transfer fix for pretty-printed parentheses from GNATprove to GNATPiotr Trojanek1-1/+69
Expressions with parentheses are notoriously problematic to pretty-print. In GNATprove we had a post-processing fix for them, but it is better to have this fix in the GNAT frontend repository and apply it for CodePeer as well. gcc/ada/ * pprint.adb (Expression_Image): Move Count_Parentheses and Fix_Parentheses routines from GNATprove and apply them before returning the slice of a source code buffer.
2023-05-23ada: Fix expression pretty-printer for SPARK counterexamplesPiotr Trojanek3-335/+146
The expression pretty-printer that is used for SPARK counterexamples was essentially duplicating the logic of First_Node/Last_Node and First_Sloc/Last_Sloc routines. Now it simply reuses those routines. gcc/ada/ * errout.adb (Paren_Required): New subsidiary routine for better handling of parentheses in First_Node/Last_Node. (First_Sloc, Last_Sloc): Use Get_Source_File_Index to correctly handle generic instances and inlined subprograms; tune handling of parentheses; improve handling of literals. * pprint.adb (Expression_Image): Simplify using First_Sloc/Last_Sloc. * sem_ch6.adb (Analyze_Expression_Function): Remove parenthesis when relocating expression from expression function to simple return statement.
2023-05-23ada: Suppress warning about Subprogram_Variant failing at run timePiotr Trojanek1-0/+7
Warning about check failing at run time is likely spurious for mutually recursive subprograms with multiple variant clauses. These will be non-trivial to detect, so we simply suppress the warning altogether for all subprogram variants. gcc/ada/ * exp_prag.adb (Expand_Pragma_Check): Suppress warning for checks of subprogram variants.
2023-05-23ada: Small code cleanupEric Botcazou1-13/+8
This just merges two conditional blocks depending on the same condition. gcc/ada/ * frontend.adb (Frontend): Merge two conditional blocks and adjust.
2023-05-23ada: Minor fix typo in commentPiotr Trojanek1-1/+1
Spotted while reviewing a patch with a similar typo. gcc/ada/ * libgnat/s-mmap.adb (Mapped_Region_Record): Fix typo in comment.
2023-05-23ada: Remove duplicate commentRonan Desplanques1-4/+0
gcc/ada/ * sem_ch7.adb: Remove duplicate comment.
2023-05-23ada: Crash on dispatching primitive referencing limited-with typeJavier Miranda1-0/+158
The compiler crashes processing a compilation unit has limited-with context clauses, and the profile of some dispatching primitive references a type visible through a limited-with clause, and the dispatching primitive has class-wide preconditions. gcc/ada/ * sem_ch10.adb (Analyze_Required_Limited_With_Units): New subprogram. (Depends_On_Limited_Views): New subprogram. (Has_Limited_With_Clauses): New subprogram. (Analyze_Compilation_Unit): Call the new subprogram that performs the full analysis of required limited-with units.
2023-05-23Use delete[] in int_range destructor [PR109920]Aldy Hernandez1-1/+1
gcc/ChangeLog: PR tree-optimization/109920 * value-range.h (RESIZABLE>::~int_range): Use delete[].
2023-05-23Fortran: Fix assumed length chars and len inquiry [PR103716]Paul Thomas3-1/+20
2023-05-23 Paul Thomas <pault@gcc.gnu.org> gcc/fortran PR fortran/103716 * resolve.cc (gfc_resolve_ref): Conversion of array_ref into an element should be done for all characters without a len expr, not just deferred lens, and for integer expressions. * trans-expr.cc (conv_inquiry): For len and kind inquiry refs, set the se string_length to NULL_TREE. gcc/testsuite/ PR fortran/103716 * gfortran.dg/pr103716.f90 : New test.
2023-05-23Fortran: Allow declaration of finalizable DT in a submodule [PR97122]Paul Thomas2-33/+48
2023-05-23 Paul Thomas <pault@gcc.gnu.org> Steven G. Kargl <kargl@gcc.gnu.org> gcc/fortran PR fortran/97122 * decl.cc (variable_decl): Clean up white space issues. (gfc_match_final_decl): Declaration of finalizable derived type is allowed in a submodule. gcc/testsuite/ PR fortran/97122 * gfortran.dg/finalize_8.f03 : Replace testcase that checks declaration of finalizable derived types in submodules works.
2023-05-23Daily bump.GCC Administrator4-1/+439
2023-05-22i386: Adjust emulated integer vector mode shift costsUros Bizjak2-36/+66
Returned integer vector mode costs of emulated instructions in ix86_shift_rotate_cost are wrong and do not reflect generated instruction sequences. Rewrite handling of different integer vector modes and different target ABIs to return real instruction counts in order to calcuate better costs of various emulated modes. Also add the cost of a memory read, when the instruction in the sequence reads memory. gcc/ChangeLog: * config/i386/i386.cc (ix86_shift_rotate_cost): Correct calcuation of integer vector mode costs to reflect generated instruction sequences of different integer vector modes and different target ABIs. Remove "speed" function argument. (ix86_rtx_costs): Update call for removed function argument. (ix86_vector_costs::add_stmt_cost): Ditto. gcc/testsuite/ChangeLog: * gcc.target/i386/sse2-shiftqihi-constant-1.c: Remove XFAILs.
2023-05-22Implement some miscellaneous zero accessors for Value_Range.Aldy Hernandez1-0/+3
This adds some missing accessors to the type agnostic Value_Range class. They'll be used in the upcoming IPA work. gcc/ChangeLog: * value-range.h (class Value_Range): Implement set_zero, set_nonzero, and nonzero_p.
2023-05-22testsuite/52641: Fix more of implicit int=32 assumption fallout.Georg-Johann Lay31-24/+68
gcc/testsuite/ PR testsuite/52641 * gcc.c-torture/compile/pr108892.c: Require int32. * gcc.c-torture/compile/pr98199.c: Require int32plus. * gcc.dg/analyzer/call-summaries-pr107072.c: Same. * gcc.dg/analyzer/null-deref-pr105755.c: Same. * gcc.dg/tree-ssa/pr102232.c: Same. * gcc.dg/tree-ssa/pr105860.c: Same. * gcc.dg/tree-ssa/pr96730.c: Same. * gcc.dg/tree-ssa/pr96779-disabled.c: Same. * gcc.dg/tree-ssa/pr96779.c: Same. * gcc.dg/tree-ssa/pr98513.c: Same. * gcc.dg/tree-ssa/ssa-sink-18.c * gcc.dg/analyzer/coreutils-cksum-pr108664.c: Require int32plus, size24plus. * gcc.dg/analyzer/doom-s_sound-pr108867.c: Require size32plus. * gcc.dg/analyzer/malloc-CWE-590-examples.c: Same. * gcc.dg/debug/btf/btf-bitfields-4.c: Same. * gcc.dg/tree-ssa/pr93435.c: Same. * gcc.dg/analyzer/null-deref-pr102671-1.c: Require ptr_eq_long: * gcc.dg/analyzer/null-deref-pr102671-2.c: Same. * gcc.dg/analyzer/null-deref-pr108251-smp_fetch_ssl_fc_has_early-O2.c: Same. * gcc.dg/analyzer/null-deref-pr108251-smp_fetch_ssl_fc_has_early.c: Same. * gcc.dg/tree-ssa/pr103345.c: Use uint32_t. * gcc.dg/tree-ssa/ssa-ccp-41.c [sizeof(int)==2]: Same. * gcc.dg/tree-ssa/pr109031-1.c: Use uint16_t, uint32_t. * gcc.dg/tree-ssa/pr109031-2.c: Same. * gcc.dg/Warray-bounds-49.c (dg-warning): Discriminate int != short. * gcc.dg/Warray-bounds-52.c (dg-warning): Discriminate avr. * gcc.dg/Warray-bounds-33.c: Skip target avr. * gcc.dg/analyzer/fd-access-mode-target-headers.c: Same. * gcc.dg/analyzer/flex-with-call-summaries.c: Same. * gcc.dg/analyzer/isatty-1.c: Same. * gcc.dg/analyzer/pipe-glibc.c: Same.
2023-05-22testsuite/52641: Fix tests that fail for 16-bit int / pointer targets.Georg-Johann Lay15-2/+18
gcc/testsuite/ PR testsuite/52641 * c-c++-common/pr19807-2.c: Use __SIZEOF_INT__ instead of 4. * gcc.c-torture/compile/pr103813.c: Require size32plus. * gcc.c-torture/execute/pr108498-2.c: Same. * gcc.c-torture/compile/pr96426.c: Condition on __SIZEOF_LONG_LONG__ == __SIZEOF_DOUBLE__. * gcc.c-torture/execute/pr103417.c: Require int32plus. * gcc.dg/pr104198.c: Same. * gcc.dg/pr21137.c: Same. * gcc.dg/pr88905.c: Same. * gcc.dg/pr90838.c: Same. * gcc.dg/pr97317.c: Same. * gcc.dg/pr100292.c: Require int32. * gcc.dg/pr101008.c: Same. * gcc.dg/pr96542.c: Same. * gcc.dg/pr96674.c: Same. * gcc.dg/pr97750.c: Require ptr_eq_long.
2023-05-22i386: Account for the memory read in V*QImode multiplication sequencesUros Bizjak1-8/+23
Add the cost of a memory read to the cost of V*QImode vector mult sequences. gcc/ChangeLog: * config/i386/i386.cc (ix86_multiplication_cost): Add the cost of a memory read to the cost of V?QImode sequences.
2023-05-22Skip some tests that won't work for target AVR.Georg-Johann Lay21-1/+22
gcc/testsuite/ * lib/target-supports.exp (check_effective_target_lra) [avr]: Return 0. * gcc.dg/pr19402-2.c: Skip for avr. * gcc.dg/pr86124.c: Same. * gcc.dg/pr94291.c: Same. * gcc.dg/torture/builtin-complex-1.c: Same. * gcc.dg/torture/fp-int-convert-float32x-timode.c: Same. * gcc.dg/torture/fp-int-convert-float32x.c: Same. * gcc.dg/torture/fp-int-convert-float64-timode.c: Same. * gcc.dg/torture/fp-int-convert-float64.c: Same. * gcc.dg/torture/fp-int-convert-long-double.c: Same. * gcc.dg/torture/fp-int-convert-timode.c: Same. * c-c++-common/torture/builtin-convertvector-1.c: Same. * c-c++-common/torture/complex-sign-add.c: Same. * c-c++-common/torture/complex-sign-mixed-add.c: Same. * c-c++-common/torture/complex-sign-mixed-div.c: Same. * c-c++-common/torture/complex-sign-mixed-mul.c: Same. * c-c++-common/torture/complex-sign-mixed-sub.c: Same. * c-c++-common/torture/complex-sign-mul-minus-one.c: Same. * c-c++-common/torture/complex-sign-mul-one.c: Same. * c-c++-common/torture/complex-sign-mul.c: Same. * c-c++-common/torture/complex-sign-sub.c: Same.
2023-05-22RISC-V: Add "m_" prefix for private memberJuzhe-Zhong1-12/+12
Since the current framework is hard to maintain and hard to be used in the future possible auto-vectorization patterns. We will need to keep adding more helpers and arguments during the auto-vectorization supporting. We should refactor the framework now for the future use since the we don't support too much auto-vectorization patterns for now. Start with this simple patch, this patch is adding "m_" prefix for private the members. gcc/ChangeLog: * config/riscv/riscv-v.cc: Add "m_" prefix. Signed-off-by: Juzhe-Zhong <juzhe.zhong@rivai.ai>
2023-05-22RISC-V: Fix typo of multiple_rgroup-2.hJuzhe-Zhong1-1/+1
Just notice this following fail in the regression: FAIL: gcc.target/riscv/rvv/autovec/partial/multiple_rgroup-2.c (test for excess errors) FAIL: gcc.target/riscv/rvv/autovec/partial/multiple_rgroup_run-2.c (test for excess errors) Signed-off-by: Juzhe-Zhong <juzhe.zhong@rivai.ai> gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/partial/multiple_rgroup-2.h: Fix typo
2023-05-22ada: Reuse idiomatic procedure in CStandRonan Desplanques1-2/+1
This change replaces a call to Set_Name_Entity_Id with a call to the higher-level Set_Current_Entity. gcc/ada/ * cstand.adb: Use more idiomatic procedure.
2023-05-22ada: Avoid repeated calls when looking for first/last slocs of a nodePiotr Trojanek1-16/+18
gcc/ada/ * errout.adb (First_Loc): Avoid repeated calls. (Last_Loc): Likewise.
2023-05-22ada: Small cleanup in support for protected subprogramsEric Botcazou2-59/+49
This moves the propagation of the Uses_Sec_Stack flag, from the original to the rewritten subprogram, to the point where the latter is expanded, along with the propagation of the Has_Nested_Subprogram flag, as well as addresses a ??? comment in the same block of code. No functional changes. gcc/ada/ * inline.adb (Cleanup_Scopes): Do not propagate the Uses_Sec_Stack flag from original to rewritten protected subprograms here... * exp_ch9.adb (Expand_N_Protected_Body) <N_Subprogram_Body>: ...but here instead. Add local variables and remove a useless test.
2023-05-22ada: Use idiomatic construct in Expand_N_Package_BodyEric Botcazou1-10/+1
gcc/ada/ * exp_ch7.adb (Expand_N_Package_Body): Call Defining_Entity to get the entity of the body.
2023-05-22ada: Fix source location for crashes in expanded Loop_Entry attributesPiotr Trojanek1-6/+4
Historically, Loop_Entry attributes were expanded while expanding their corresponding loops, so it was easier to use location of these loops for expanded code. Now, these attributes are expanded where they appear, so we can easily use the location of the attribute reference for expanded code. This matters when there is a crash in the expanded code, e.g. because of a stack overflow in the declaration of an constant object that captures the Loop_Entry prefix. Now backtrace will point to the source location of the attribute, which is more helpful than the location of the loop. gcc/ada/ * exp_attr.adb (Expand_Loop_Entry_Attribute): Use location of the attribute reference, not of the loop statement.
2023-05-22ada: Add missing word in commentRonan Desplanques1-1/+1
gcc/ada/ * par-ch3.adb: Add missing word in comment.
2023-05-22ada: Incorrect constant folding in postcondition involving 'OldJustin Squirek1-1/+12
The following patch fixes an issue in the compiler whereby certain flavors of access comparisons may be incorrectly constant-folded out of contract expressions - notably in postcondition expressions featuring a reference to 'Old. gcc/ada/ * checks.adb (Install_Null_Excluding_Check): Avoid non-null optimizations when assertions are enabled.
2023-05-22ada: Fix crash caused by incorrect expansion of iterated componentMarc Poulhiès2-2/+13
The way iterated component are expanded could lead to inconsistent tree. This change fixes 2 issues: - in an early step during Pre_Analyze, the loop variable still has Any_Type and the compiler must not emit an error. A later full Analyze is supposed to correctly set the Etype, and only then should the compiler emit an error if Any_Type is still used. - when expanding into a loop with assignments statement, the expression is analyzed in an early context (where the loop variable still has Any_Type Etype) and then copied. The compiler would crash because this Any_Type is never changed because the expression node has its Analyzed flag set. Resetting the flag ensures the later Analyze call also analyzes these nodes and set Etype correctly. gcc/ada/ * exp_aggr.adb (Process_Transient_Component): Reset Analyzed flag for the copy of the initialization expression. * sem_attr.adb (Validate_Non_Static_Attribute_Function_Call): Skip error emission during Pre_Analyze.
2023-05-22ada: Fix missing finalization in separate package bodyEric Botcazou1-22/+37
This directly comes from a loophole in the implementation. gcc/ada/ * exp_ch7.adb (Process_Package_Body): New procedure taken from... (Build_Finalizer.Process_Declarations): ...here. Call the above procedure to deal with both package bodies and package body stubs.
2023-05-22ada: Remove outdated part of commentRonan Desplanques1-2/+1
The concept of extended nodes was retired with the introduction of variable-sized node types, but a reference to that concept was left over in a comment. This change removes that reference. gcc/ada/ * atree.ads: Remove outdated part of comment.
2023-05-22ada: Fix missing finalization in library-unit instance specEric Botcazou3-13/+34
This fixes the missing finalization of objects declared in the spec of package instances that are library units (and only them, i.e. not all library-level package instances) when the instances have a package body. The finalization is done when there is no package body, and supporting this case precisely broke the other case because of a thinko or a typo. This also requires a small adjustment to the routine writing ALI files. gcc/ada/ * exp_ch7.adb (Build_Finalizer): Reverse the test comparing the instantiation and declaration nodes of a package instance, and therefore bail out only when they are equal. Adjust comments. (Expand_N_Package_Declaration): Do not clear the Finalizer field. * lib-writ.adb: Add with and use clauses for Sem_Util. (Write_Unit_Information): Look at unit nodes to find finalizers. * sem_ch12.adb (Analyze_Package_Instantiation): Beef up the comment about the rewriting of the instantiation node into a declaration.
2023-05-22ada: Rename Is_Past_Self_Hiding_Point flag to be Is_Not_Self_HiddenBob Duff13-27/+27
...which seems clearer. Still work in progress. gcc/ada/ * cstand.adb (Is_Past_Self_Hiding_Point): Rename to be Is_Not_Self_Hidden. * einfo.ads: Likewise. * exp_aggr.adb: Likewise. * gen_il-fields.ads: Likewise. * gen_il-gen-gen_entities.adb: Likewise. * sem.adb: Likewise. * sem_aggr.adb: Likewise. * sem_ch11.adb: Likewise. * sem_ch12.adb: Likewise. * sem_ch5.adb: Likewise. * sem_ch6.adb: Likewise. * sem_ch7.adb: Likewise. * sem_prag.adb: Likewise.
2023-05-22ada: Fix spurious freezing error on nonabstract null extensionEric Botcazou1-3/+5
This prevents the wrapper function created for each nonoverridden inherited function with a controlling result of nonabstract null extensions of tagged types from causing premature freezing of types referenced in its profile. gcc/ada/ * exp_ch3.adb (Make_Controlling_Function_Wrappers): Create the body as the expanded body of an expression function.
2023-05-22ada: Further fixes to GNATprove and CodePeer expression pretty-printerPiotr Trojanek1-128/+198
The expression pretty-printer still crashes on several tests, but already gives much better outputs for many previously unsupported constructs. gcc/ada/ * pprint.adb (Expression_Image): Handle several previously unsupported constructs.
2023-05-22ada: Cleanup redundant condition in resolution of entity namesPiotr Trojanek1-6/+4
Code cleanup related to new contract for SPARK; semantics is unaffected. gcc/ada/ * sem_res.adb (Resolve_Entity_Name): Combine two IF statements that execute code only for references that come from source.
2023-05-22ada: Add Is_Past_Self_Hiding_Point flagBob Duff16-25/+89
This patch adds a flag Is_Past_Self_Hiding_Point. When False, this will replace E_Void as the indicator for a premature use of a declaration within itself -- for example, "X : T := X;". One might think this flag should be called something like Is_Hidden_From_All_Visibility, reversing the sense of Is_Past_Self_Hiding_Point. We don't do that because we want Is_Past_Self_Hiding_Point to be initially False by default (and we have no mechanism for defaulting to True), and because it doesn't exactly match the RM definition of "hidden from all visibility" (for example, for record components). This is work in progress; more changes are needed before we can remove all Mutate_Ekind(..., E_Void). gcc/ada/ * einfo.ads (Is_Past_Self_Hiding_Point): Document. * gen_il-fields.ads (Is_Past_Self_Hiding_Point): Add to list of fields. * gen_il-gen-gen_entities.adb (Is_Past_Self_Hiding_Point): Declare in all entities. * exp_aggr.adb: Set Is_Past_Self_Hiding_Point as appropriate. * sem.adb: Likewise. * sem_aggr.adb: Likewise. * sem_ch11.adb: Likewise. * sem_ch12.adb: Likewise. * sem_ch5.adb: Likewise. * sem_ch7.adb: Likewise. * sem_prag.adb: Likewise. * sem_ch6.adb: Likewise. (Set_Formal_Mode): Minor cleanup: Move from spec. * sem_ch6.ads: (Set_Formal_Mode): Minor cleanup: Move to body. * cstand.adb: Call Set_Is_Past_Self_Hiding_Point on all entities as soon as they are created. * comperr.adb (Compiler_Abort): Minor cleanup -- use 'in' instead of 'or else'. * debug.adb: Minor comment cleanups.
2023-05-22ada: Accept Assert pragmas in expression functionsSteve Baird1-1/+18
gcc/ada/ * sem_ch4.adb (Analyze_Expression_With_Actions.Check_Action_Ok): Accept an executable pragma occuring in a declare expression as per AI22-0045. This means Assert and Inspection_Point pragmas as well as any implementation-defined pragmas that the implementation chooses to categorize as executable. Currently Assume and Debug are the only such pragmas.
2023-05-22ada: Add warning on frontend inlining of Subprogram_VariantPiotr Trojanek1-3/+9
We already warned when contracts like pre/postcondition appear together with pragma Inline_Always and they are ignored by the frontend inlining. For consistency we now also warn for Subprogram_Variant, which is similarly ignored even though this contract is only meaningful for recursive subprograms and those can't be inlined anyway (but error about this might only be emitted when full compilation is done). gcc/ada/ * sem_prag.adb (Check_Postcondition_Use_In_Inlined_Subprogram): Mention Subprogram_Variant in the comment. (Analyze_Subprogram_Variant_In_Decl_Part): Warn when contract is ignored because of pragma Inline_Always and frontend inlining.
2023-05-22ada: Fix spurious warning on Inline_Always and contractsPiotr Trojanek1-1/+2
Warnings about pre/postconditions being ignored with Inline_Always were only true for the obsolete frontend inlining. With the current backend pre/postconditions work fine with Inline_Always. gcc/ada/ * sem_prag.adb (Check_Postcondition_Use_In_Inlined_Subprogram): Only emit warning when frontend inlining is enabled.
2023-05-22ada: Improve -gnatyx style checkArnaud Charlet6-23/+65
Check redundant parentheses in many more places, for now only under -gnatdQ, while pending violations are fixed. gcc/ada/ * par-ch3.adb, sem_ch4.adb (P_Discrete_Range, Analyze_Logical_Op, Analyze_Short_Circuit): Add calls to Check_Xtra_Parentheses. * par-ch5.adb (P_Condition): Move logic to Check_Xtra_Parentheses. * style.ads, styleg.adb, styleg.ads (Check_Xtra_Parens): Move logic related to expressions requiring parentheses here.
2023-05-22ada: Remove extra parenthesesArnaud Charlet63-187/+183
In preparation of enhancing -gnatyx to check for these automatically. gcc/ada/ * ali-util.adb, par-endh.adb, par-prag.adb, par-ch2.adb, checks.adb, fmap.adb, libgnat/a-nbnbig.ads, libgnat/g-dynhta.adb, libgnat/s-carun8.adb, libgnat/s-strcom.adb, libgnat/a-dhfina.adb, libgnat/a-direct.adb, libgnat/a-rbtgbo.adb, libgnat/a-strsea.adb, libgnat/a-ststio.adb, libgnat/a-suenco.adb, libgnat/a-costso.adb, libgnat/a-strmap.adb, libgnat/g-alleve.adb, libgnat/g-debpoo.adb, libgnat/g-sercom__linux.adb, libgnat/s-genbig.adb, libgnat/s-mmap.adb, libgnat/s-regpat.adb, par-ch5.adb, sem_case.adb, sem_ch12.adb, sem_ch13.adb, sem_ch8.adb, sem_eval.adb, sem_prag.adb, sem_type.adb, exp_ch11.adb, exp_ch2.adb, exp_ch3.adb, exp_ch4.adb, exp_ch5.adb, exp_ch6.adb, exp_ch9.adb, exp_put_image.adb, freeze.adb, live.adb, sem_aggr.adb, sem_cat.adb, sem_ch10.adb, sem_ch3.adb, sem_ch6.adb, sem_ch9.adb, sem_disp.adb, sem_elab.adb, sem_res.adb, sem_util.adb, sinput.adb, uintp.adb, bcheck.adb, binde.adb, binderr.adb, einfo-utils.adb, clean.adb, sem_ch4.adb, gnatls.adb, gprep.adb, sem_ch11.adb: Remove extra parentheses.
2023-05-22ada: Remove a remaining reference to ?Arnaud Charlet1-1/+1
We should no longer use ? anywhere when emitting warnings. gcc/ada/ * sem_aggr.adb (Get_Value): Use ?? instead of ?.
2023-05-22ada: Remove redundant protection against empty listsPiotr Trojanek4-22/+14
Calls to List_Length on No_List intentionally return 0 (and likewise call to First on No_List intentionally return Empty), so explicit guards against No_List are unnecessary. Code cleanup; semantics is unaffected. gcc/ada/ * exp_aggr.adb (Aggregate_Size): Remove redundant calls to Present. * exp_ch5.adb (Expand_N_If_Statement): Likewise. * sem_prag.adb (Analyze_Pragma): Likewise. * sem_warn.adb (Find_Var): Likewise.
2023-05-22ada: Support calls through dereferences in Find_ActualClaire Dross1-8/+38
Return the corresponding formal in the designated subprogram profile in that case. gcc/ada/ * sem_util.adb (Find_Actual): On calls through dereferences, return the corresponding formal in the designated subprogram profile.
2023-05-22ada: Remove unreferenced utility routine Is_Actual_Tagged_ParameterPiotr Trojanek2-16/+0
Routine Is_Actual_Tagged_Parameter was added to detect unsupported SPARK 2005 constructs, but this feature was deconstructed in favor of SPARK 2014 and its SPARK_Mode aspects. gcc/ada/ * sem_util.ads (Is_Actual_Tagged_Parameter): Remove spec. * sem_util.adb (Is_Actual_Tagged_Parameter): Remove body.
2023-05-22ada: Add contracts to Ada.Strings.Unbounded libraryJoffrey Huguet2-10/+22
This patch adds contracts to the conversions between Unbounded_String and String, the Element function and the equality between two Unbounded_String, or between Unbounded_String and String. This patch also disallows the use of a function in SPARK, because it returns an uninitialized Unbounded_String. gcc/ada/ * libgnat/a-strunb.ads, libgnat/a-strunb__shared.ads (To_Unbounded_String): Add postcondition. Add aspect SPARK_Mode Off on the version that takes a Natural as parameter. (To_String): Complete postcondition. (Set_Unbounded_String): Add postcondition. (Element): Likewise. ("="): Likewise.
2023-05-22ada: Fix crash on Ada.Containers with No_Dispatching_Calls restrictionEric Botcazou1-1/+5
This makes it so that the compiler does not crash and flags the underlying violation of the restriction instead. gcc/ada/ * exp_ch3.adb (Freeze_Type): Do not associate the Finalize_Address routine for a class-wide type if restriction No_Dispatching_Calls is in effect.