aboutsummaryrefslogtreecommitdiff
path: root/gcc
AgeCommit message (Collapse)AuthorFilesLines
2023-10-14Daily bump.GCC Administrator2-1/+7
2023-10-13Do not add partial equivalences with no uses.Andrew MacLeod1-0/+9
PR tree-optimization/111622 * value-relation.cc (equiv_oracle::add_partial_equiv): Do not register a partial equivalence if an operand has no uses.
2023-10-13Daily bump.GCC Administrator1-1/+1
2023-10-12Daily bump.GCC Administrator3-1/+40
2023-10-11Ensure float equivalences include + and - zero.Andrew MacLeod4-0/+44
A floating point equivalence may not properly reflect both signs of zero, so be pessimsitic and ensure both signs are included. PR tree-optimization/111694 gcc/ * gimple-range-cache.cc (ranger_cache::fill_block_cache): Adjust equivalence range. * value-relation.cc (adjust_equivalence_range): New. * value-relation.h (adjust_equivalence_range): New prototype. gcc/testsuite/ * gcc.dg/pr111694.c: New.
2023-10-11tree-ssa-strlen: optimization skips clobbering store [PR111519]Jakub Jelinek2-22/+79
The following testcase is miscompiled, because count_nonzero_bytes incorrectly uses get_strinfo information on a pointer from which an earlier instruction loads SSA_NAME stored at the current instruction. get_strinfo shows a state right before the current store though, so if there are some stores in between the current store and the load, the string length information might have changed. The patch passes around gimple_vuse from the store and punts instead of using strinfo on loads from MEM_REF which have different gimple_vuse from that. 2023-10-11 Richard Biener <rguenther@suse.de> Jakub Jelinek <jakub@redhat.com> PR tree-optimization/111519 * tree-ssa-strlen.cc (strlen_pass::count_nonzero_bytes): Add vuse argument and pass it through to recursive calls and count_nonzero_bytes_addr calls. Don't shadow the stmt argument, but change stmt for gimple_assign_single_p statements for which we don't immediately punt. (strlen_pass::count_nonzero_bytes_addr): Add vuse argument and pass it through to recursive calls and count_nonzero_bytes calls. Don't use get_strinfo if gimple_vuse (stmt) is different from vuse. Don't shadow the stmt argument. * gcc.dg/torture/pr111519.c: New testcase. (cherry picked from commit e75bf1985fdc9a5d3a307882a9251d8fd6e93def)
2023-10-11Daily bump.GCC Administrator2-1/+16
2023-10-10ada: Fix infinite loop with multiple limited with clausesEric Botcazou1-63/+107
This occurs when one of the types has an incomplete declaration in addition to its full declaration in its package. In this case AI05-129 says that the incomplete type is not part of the limited view of the package, i.e. only the full view is. Now, in the GNAT implementation, it's the opposite in the regular view of the package, i.e. the incomplete type is the visible one. That's why the implementation needs to also swap the types on the visibility chain while it is swapping the views when the clauses are either installed or removed. This works correctly for the installation, but does not for the removal, so this change rewrites the code doing the latter. gcc/ada/ PR ada/111434 * sem_ch10.adb (Replace): New procedure to replace an entity with another on the homonym chain. (Install_Limited_With_Clause): Rename Non_Lim_View to Typ for the sake of consistency. Call Replace to do the replacements and split the code into the regular and the special cases. Add debuggging output controlled by -gnatdi. (Install_With_Clause): Print the Parent_With and Implicit_With flags in the debugging output controlled by -gnatdi. (Remove_Limited_With_Unit.Restore_Chain_For_Shadow (Shadow)): Rewrite using a direct replacement of E4 by E2. Call Replace to do the replacements. Add debuggging output controlled by -gnatdi.
2023-10-10Daily bump.GCC Administrator1-1/+1
2023-10-09Fortran/OpenMP: Fix handling of strictly structured blocksTobias Burnus4-6/+104
For strictly structured blocks, a BLOCK was created but the code was placed after the block the outer structured block. Additionally, labelled blocks were mishandled. As the code is now properly in a BLOCK, it solves additional issues. gcc/fortran/ChangeLog: * parse.cc (parse_omp_structured_block): Make the user code end up inside of BLOCK construct for strictly structured blocks; fix fallout for 'section' and 'teams'. * openmp.cc (resolve_omp_target): Fix changed BLOCK handling for teams in target checking. libgomp/ChangeLog: * testsuite/libgomp.fortran/strictly-structured-block-1.f90: New test. gcc/testsuite/ChangeLog: * gfortran.dg/block_17.f90: New test. * gfortran.dg/gomp/strictly-structured-block-5.f90: New test. (cherry picked from commit 6a8edd50a149f10621b59798c887c24c81c8b9ea)
2023-10-09Daily bump.GCC Administrator1-1/+1
2023-10-08Daily bump.GCC Administrator3-1/+18
2023-10-07MATCH: Fix infinite loop between `vec_cond(vec_cond(a,b,0), c, d)` and `a & b`Andrew Pinski2-0/+12
Match has a pattern which converts `vec_cond(vec_cond(a,b,0), c, d)` into `vec_cond(a & b, c, d)` but since in this case a is a comparison fold will change `a & b` back into `vec_cond(a,b,0)` which causes an infinite loop. The best way to fix this is to enable the patterns for vec_cond(*,vec_cond,*) only for GIMPLE so we don't get an infinite loop for fold any more. Note this is a latent bug since these patterns were added in r11-2577-g229752afe3156a and was exposed by r14-3350-g47b833a9abe1 where now able to remove a VIEW_CONVERT_EXPR. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. PR middle-end/111699 gcc/ChangeLog: * match.pd ((c ? a : b) op d, (c ? a : b) op (c ? d : e), (v ? w : 0) ? a : b, c1 ? c2 ? a : b : b): Enable only for GIMPLE. gcc/testsuite/ChangeLog: * gcc.c-torture/compile/pr111699-1.c: New test. (cherry picked from commit e77428a9a336f57e3efe3eff95f2b491d7e9be14)
2023-10-07Daily bump.GCC Administrator1-1/+1
2023-10-06Merge branch 'releases/gcc-13' into devel/omp/gcc-13Tobias Burnus25-39/+396
Merge up to r13-7936-g7c47e03df2a77f2e25e23887734a5e818aeca3f5 (6th Oct 2023)
2023-10-06Daily bump.GCC Administrator1-1/+1
2023-10-05Daily bump.GCC Administrator3-1/+22
2023-10-04Fortran: Alloc comp of non-finalizable type not finalized [PR111674]Paul Thomas3-2/+18
2023-10-04 Paul Thomas <pault@gcc.gnu.org> gcc/fortran PR fortran/37336 PR fortran/111674 * trans-expr.cc (gfc_trans_scalar_assign): Finalize components on deallocation if derived type is not finalizable. gcc/testsuite/ PR fortran/37336 PR fortran/111674 * gfortran.dg/allocate_with_source_25.f90: Final count in tree dump reverts from 4 to original 6. * gfortran.dg/finalize_38.f90: Add test for fix of PR111674. (cherry picked from commit 84284e1c490e9235fca5cb85269ecfcb87eef4f1)
2023-10-04Daily bump.GCC Administrator1-1/+1
2023-10-03Daily bump.GCC Administrator3-1/+26
2023-10-02Disable generation of scalar modulo instructions.Pat Haugen8-29/+72
It was recently discovered that the scalar modulo instructions can suffer noticeable performance issues for certain input values. This patch disables their generation since the equivalent div/mul/sub sequence does not suffer the same problem. gcc/ * config/rs6000/rs6000.cc (rs6000_rtx_costs): Check whether the modulo instruction is disabled. * config/rs6000/rs6000.h (RS6000_DISABLE_SCALAR_MODULO): New. * config/rs6000/rs6000.md (mod<mode>3, *mod<mode>3): Check it. (define_expand umod<mode>3): New. (define_insn umod<mode>3): Rename to *umod<mode>3 and check if the modulo instruction is disabled. (umodti3, modti3): Check if the modulo instruction is disabled. gcc/testsuite/ * gcc.target/powerpc/clone1.c: Add xfails. * gcc.target/powerpc/clone3.c: Likewise. * gcc.target/powerpc/mod-1.c: Update scan strings and add xfails. * gcc.target/powerpc/mod-2.c: Likewise. * gcc.target/powerpc/p10-vdivq-vmodq.c: Add xfails. (cherry picked from commit 58ab38213b979811d314f68e3f455c28a1d44140)
2023-10-02Daily bump.GCC Administrator3-1/+38
2023-10-01Fix PR 111331: wrong code for `a > 28 ? MIN<a, 28> : 29`Andrew Pinski4-4/+55
The problem here is after r6-7425-ga9fee7cdc3c62d0e51730, the comparison to see if the transformation could be done was using the wrong value. Instead of see if the inner was LE (for MIN and GE for MAX) the outer value, it was comparing the inner to the value used in the comparison which was wrong. Committed to GCC 13 branch after bootstrapped and tested on x86_64-linux-gnu. gcc/ChangeLog: PR tree-optimization/111331 * tree-ssa-phiopt.cc (minmax_replacement): Fix the LE/GE comparison for the `(a CMP CST1) ? max<a,CST2> : a` optimization. gcc/testsuite/ChangeLog: PR tree-optimization/111331 * gcc.c-torture/execute/pr111331-1.c: New test. * gcc.c-torture/execute/pr111331-2.c: New test. * gcc.c-torture/execute/pr111331-3.c: New test. (cherry picked from commit 30e6ee074588bacefd2dfe745b188bb20c81fe5e)
2023-10-01Fix PR 110386: backprop vs ABSU_EXPRAndrew Pinski3-1/+20
The issue here is that when backprop tries to go and strip sign ops, it skips over ABSU_EXPR but ABSU_EXPR not only does an ABS, it also changes the type to unsigned. Since strip_sign_op_1 is only supposed to strip off sign changing operands and not ones that change types, removing ABSU_EXPR here is correct. We don't handle nop conversions so this does cause any missed optimizations either. Committed to the GCC 13 branch after bootstrapped and tested on x86_64-linux-gnu with no regressions. PR tree-optimization/110386 gcc/ChangeLog: * gimple-ssa-backprop.cc (strip_sign_op_1): Remove ABSU_EXPR. gcc/testsuite/ChangeLog: * gcc.c-torture/compile/pr110386-1.c: New test. * gcc.c-torture/compile/pr110386-2.c: New test. (cherry picked from commit 2bbac12ea7bd8a3eef5382e1b13f6019df4ec03f)
2023-10-01Daily bump.GCC Administrator2-1/+6
2023-09-30Fixup d9b3269bdc.Andre Vehreschild1-1/+1
Adapt to different parameter count in comparison to gcc-14. gcc/fortran/ChangeLog: * trans-array.cc (gfc_trans_deferred_array): Use correct position for statements to add to guarded block.
2023-09-30Daily bump.GCC Administrator4-1/+51
2023-09-29Fortran: Free alloc. comp. in allocated coarrays only.Andre Vehreschild3-2/+92
When freeing allocatable components of an allocatable coarray, add a check that the coarray is still allocated, before accessing the components. This patch adds to PR fortran/37336, but does not fix it completely. gcc/fortran/ChangeLog: PR fortran/37336 * trans-array.cc (structure_alloc_comps): Deref coarray. (gfc_trans_deferred_array): Add freeing of components after check for allocated coarray. gcc/testsuite/ChangeLog: PR fortran/37336 * gfortran.dg/coarray/alloc_comp_6.f90: New test. * gfortran.dg/coarray/alloc_comp_7.f90: New test. (cherry picked from commit 9a63a62dfd73e159f1956e9b04b555c445de4e78)
2023-09-29Merge branch 'releases/gcc-13' into devel/omp/gcc-13Tobias Burnus70-786/+2641
Merge up to r13-7922-gb5b98a2d055d967d1fc92859827839c83c9368d7 (29th Sep 2023)
2023-09-29AArch64: List official cores before codenamesWilco Dijkstra2-4/+4
List official cores first so that -mcpu=native does not show a codename with -v or in errors/warnings. gcc/ChangeLog: * config/aarch64/aarch64-cores.def (neoverse-n1): Place before ares. (neoverse-v1): Place before zeus. (neoverse-v2): Place before demeter. * config/aarch64/aarch64-tune.md: Regenerate. (cherry picked from commit 64d5bc35c8c2a66ac133a3e6ace820b0ad8a63fb)
2023-09-29AArch64: Fix memmove operand corruption [PR111121]Wilco Dijkstra4-18/+77
A MOPS memmove may corrupt registers since there is no copy of the input operands to temporary registers. Fix this by calling aarch64_expand_cpymem_mops. Reviewed-by: Richard Sandiford <richard.sandiford@arm.com> gcc/ChangeLog/ PR target/111121 * config/aarch64/aarch64.md (aarch64_movmemdi): Add new expander. (movmemdi): Call aarch64_expand_cpymem_mops for correct expansion. * config/aarch64/aarch64.cc (aarch64_expand_cpymem_mops): Add support for memmove. * config/aarch64/aarch64-protos.h (aarch64_expand_cpymem_mops): Add new function. gcc/testsuite/ChangeLog/ PR target/111121 * gcc.target/aarch64/mops_4.c: Add memmove testcases. (cherry picked from commit d8b56c95782aeeee79ec40932ca88d00fd9f2ee2)
2023-09-29Daily bump.GCC Administrator1-1/+1
2023-09-28Daily bump.GCC Administrator5-1/+489
2023-09-27ada: Fix missing call to Finalize_Protection for simple protected objectsEric Botcazou2-11/+40
There is a glitch in Exp_Ch7.Build_Finalizer causing the finalizer to do nothing for simple protected objects. The change also removes redundant calls to the Is_Simple_Protected_Type predicate and fixes a minor inconsistency between Requires_Cleanup_Actions and Build_Finalizer for this case. gcc/ada/ * exp_ch7.adb (Build_Finalizer.Process_Declarations): Remove call to Is_Simple_Protected_Type as redundant. (Build_Finalizer.Process_Object_Declaration): Do not retrieve the corresponding record type for simple protected objects. Make the flow of control more explicit in their specific processing. * exp_util.adb (Requires_Cleanup_Actions): Return false for simple protected objects present in library-level package bodies for the sake of consistency with Build_Finalizer and remove call to Is_Simple_Protected_Type as redundant.
2023-09-27ada: Fix missing finalization of extended return object on abnormal completionEric Botcazou4-12/+12
This happens in the case of a nonlimited return type and is a fallout of the optimization recently implemented for them. gcc/ada/ * einfo.ads (Status_Flag_Or_Transient_Decl): Remove ??? comment. * exp_ch6.adb (Expand_N_Extended_Return_Statement): Extend the handling of finalizable return objects to the non-BIP case. * exp_ch7.adb (Build_Finalizer.Process_Declarations): Adjust the comment accordingly. * exp_util.adb (Requires_Cleanup_Actions): Likewise.
2023-09-27ada: Fix minor glitch in finish_record_typeEric Botcazou1-1/+1
The size needs to be rounded up to the storage unit in all cases. gcc/ada/ * gcc-interface/utils.cc (finish_record_type): Round the size in the padding case as well.
2023-09-27ada: Fix wrong optimization of extended return for discriminated record typeEric Botcazou1-0/+1
This happens when the discriminants of the record type have default values. gcc/ada/ChangeLog: * inline.adb (Expand_Inlined_Call): In the case of a function call that returns an unconstrained type and initializes an object, set the No_Initialization flag on the new declaration of the object.
2023-09-27ada: Fix internal error on aggregate nested in container aggregateEric Botcazou1-7/+9
This handles the case where a component association is present. gcc/ada/ * exp_aggr.adb (Convert_To_Assignments): In the case of a component association, call Is_Container_Aggregate on the parent's parent. (Expand_Array_Aggregate): Likewise.
2023-09-27ada: Fix internal error on expression function with Refined_Post aspectEric Botcazou1-0/+3
This occurs when the expression function calls a protected function and the -gnata switch is specified, because the compiler wrongly freezes the called function when analyzing the expression function, a fallout of the wrapping scheme used for the Post and Refined_Post aspects. gcc/ada/ * sem_res.adb (Resolve_Call): When the target is an entity, do not freeze it if the current scope is the inner wrapper function built for an expression function with a Post or Refined_Post aspect.
2023-09-27ada: Fix late finalization for function call in delta aggregateEric Botcazou1-2/+6
The problem occurs at library level because the temporary created for the function call lives in the elaboration routine but is finalized only when the package itself is. It turns out that there is no need for this temporary, since the expansion of delta aggregates already creates a (properly finalized) temporary. gcc/ada/ * exp_ch6.adb (Expand_Ctrl_Function_Call): Also do nothing for the expression of a delta aggregate.
2023-09-27ada: Fix premature finalization in loop over limited iterable containerEric Botcazou1-40/+48
This happens when the iterable container is obtained as the result of a call to a function that is a subprogram parameter of a generic construct. gcc/ada/ * exp_util.adb (Initialized_By_Aliased_BIP_Func_Call): Make the name matching more robust.
2023-09-27ada: Elide the copy in extended returns for nonlimited by-reference typesEric Botcazou1-1/+1
gcc/ada/ * gcc-interface/trans.cc (gnat_to_gnu): Really test Storage_Pool on the simple return statement.
2023-09-27ada: Fix assertion failure on very peculiar enumeration typeEric Botcazou1-0/+14
The compiler currently does not support the combination of a representation clause on an enumeration type with a size clause whose value is greater than the size of the largest machine scalar supported by the target. Given that such a type would have little practical value, this change causes the compiler to give a proper error message instead of aborting. gcc/ada/ * freeze.adb (Freeze_Enumeration_Type): Give an error on a type with both representation clause and too large size.
2023-09-27ada: Fix spurious error on 'Input of private type with Type_Invariant aspectEric Botcazou1-4/+19
The problem is that it is necessary to break the privacy during the expansion of the Input attribute, which may introduce a view mismatch with the parameter of the routine checking the invariant of the type. gcc/ada/ * exp_util.adb (Make_Invariant_Call): Convert the expression to the type of the formal parameter if need be.
2023-09-27ada: Elide the copy in extended returns for nonlimited by-reference typesEric Botcazou1-3/+4
gcc/ada/ * gcc-interface/trans.cc (gnat_to_gnu): Restrict previous change to the case where the simple return statement has got no storage pool.
2023-09-27ada: Fix memory explosion on aggregate of nested packed array typeEric Botcazou1-1/+3
It occurs at compile time on an aggregate of a 2-dimensional packed array type whose component type is itself a packed array, because the compiler is trying to pack the intermediate aggregate and ends up rewriting a bunch of subcomponents. This optimization was originally devised for the case of a scalar component type so the change adds this restriction. gcc/ada/ * exp_aggr.adb (Is_Two_Dim_Packed_Array): Return true only if the component type of the array is scalar.
2023-09-27ada: Improve error message for ambiguous subprogram callEric Botcazou3-8/+21
This restores the full listing of the types for the interpretations. gcc/ada/ * sem_util.ads (Wrong_Type): Add Multiple parameter defaulting to False and document it. * sem_util.adb (Wrong_Type): Do not return early if an error has already been posted on Expr and Multiple is True. * sem_ch4.adb (Analyze_One_Call): Pass All_Errors_Mode as the actual parameter for Multiple to Wrong_Type.
2023-09-27ada: Fix assertion failure introduced by latest changeEric Botcazou1-4/+5
The new processing is not properly guarded. gcc/ada/ * sem_ch13.adb (Replace_Type_References_Generic.Visible_Component): In the case of private discriminated types, explicitly check that we have a private declaration before examining its discriminant part.
2023-09-27ada: Fix Valid_Scalars attribute applied to types from limited withEric Botcazou2-2/+9
The attribute is wrongly computed as always True because, unlike for e.g. private types, Validated_View does not look through the limited view. gcc/ada/ * sem_util.ads (Validated_View): Document enhanced behavior. * sem_util.adb (Validated_View): Return the nonlimited view, if any, of types coming from a limited with.
2023-09-27ada: Fix wrong resolution for hidden discriminant in predicateEric Botcazou1-7/+42
The problem occurs for hidden discriminants of private discriminated types. gcc/ada/ * sem_ch13.adb (Replace_Type_References_Generic.Visible_Component): In the case of private discriminated types, return a discriminant only if it is listed in the discriminant part of the declaration.