aboutsummaryrefslogtreecommitdiff
path: root/gcc
AgeCommit message (Collapse)AuthorFilesLines
2025-04-28ipa/119973 - IPA PTA issue with global initializersRichard Biener2-5/+44
For global initializers with IPA PTA we initialize them from the IPA reference data but that lacks references to the constant pool. The following conservatively considers the whole initializer. PR ipa/119973 * tree-ssa-structalias.cc (create_variable_info_for): Build constraints from DECL_INITIAL directly rather than the IPA reference list which is incomplete. * gcc.dg/torture/pr119973.c: New testcase.
2025-04-28lto/113207 - make fld_type_variant more pickyRichard Biener1-1/+6
The below adds additional verification to fld_type_variant that there's only one variant matching fld_type_variant_equal_p on the chain. The PR shows that variants built with build_qualified_type can be equal to others in that regard but not with regard to what build_qualified_type does. PR lto/113207 * ipa-free-lang-data.cc (fld_type_variant): Add extra checking.
2025-04-28tree-optimization/119044 - predcom fails to preserve alias infoRichard Biener1-0/+2
Predictive commoning fails to preserve alias info for the refs it creates. The following adds this to see whether it fixes the observed regression in 436.cactusADM after r15-7665. PR tree-optimization/119044 * tree-predcom.cc (ref_at_iteration): Copy alias info from the original ref.
2025-04-28tree-optimization/119103 - missed overwidening detection for shiftRichard Biener3-9/+40
When vectorizing a shift of u16 data by an amount that's known to be less than 16 we currently fail to emit a vector u16 shift. The first reason is that the promotion of the shift amount is hoisted only by PRE and that cannot preserve range info, the second reason is that pattern detection doesn't use range info when computing the precision required for an operation. The following addresses the first issue by making LIM hoist all expressions for the pass that runs right before PRE and the second issue by querying ranges for the shift amount. PR tree-optimization/119103 * tree-ssa-loop-im.cc (in_loop_pipeline): Globalize. (compute_invariantness): Override costing when we run right before PRE and PRE is enabled. (pass_lim::execute): Adjust. * tree-vect-patterns.cc (vect_determine_precisions_from_users): For variable shift amounts use range information. * gcc.target/i386/pr119103.c: New testcase.
2025-04-28middle-end/80342 - genmatch optimize outer conversionsRichard Biener2-51/+160
The following improves genmatch generated code so we avoid more spurious SSA assignments to be pushed to the GIMPLE sequence or simplifications rejected when we're not supposed to produce any for outer and intermediate conversions. * genmatch.cc (::gen_transform): Add in_place parameter. Assert it isn't set in unexpected places. (possible_noop_convert): New. (expr::gen_transform): Support in_place and emit code to compute a child in-place when the operation is a conversion. (dt_simplify::gen_1): Arrange for an outermost conversion to be elided by generating the transform of the operand in-place. * match.pd (__real cepxi (x) -> cos (x)): Use single_use.
2025-04-28middle-end/60779 - LTO vs. -fcx-fortran-rules and -fcx-limited-rangeRichard Biener7-29/+66
The following changes how flag_complex_method is managed towards being able to record that in the optimization set so we can stream and restore it per function. Currently -fcx-fortran-rules and -fcx-limited-range are separate recorded options but saving/restoring does not restore flag_complex_method which is later used in the middle-end. The solution is to make -fcx-fortran-rules and -fcx-limited-range aliases of a new -fcx-method= switch that represents flag_complex_method directly so we can save and restore it. PR middle-end/60779 * common.opt (fcx-method=): New, map to flag_complex_method. (Enum complex_method): New. (fcx-limited-range): Alias to -fcx-method=limited-range. (fcx-fortran-rules): Alias to -fcx-medhot=fortran. * ipa-inline-transform.cc (inline_call): Check flag_complex_method. * ipa-inline.cc (can_inline_edge_by_limits_p): Likewise. * opts.cc (finish_options): Adjust. (set_fast_math_flags): Likewise. * doc/invoke.texi (fcx-method=): Document. * gcc.dg/lto/pr60779_0.c: New testcase. * gcc.dg/lto/pr60779_1.c: Likewise.
2025-04-28middle-end/116083 - vectorizer slownessRichard Biener1-9/+14
Turns out SLP discovery can end up doing a lot of vector type builds from scalar types. Those are all ultimatively cached but end up built and layouted first. The latter is particularly expensive because it does tree node arithmetic to compute TYPE_SIZE and TYPE_SIZE_UNIT. The following replaces this with the appropriate poly-int arithmetic which speeds up the testcase by 50%. PR middle-end/116083 * stor-layout.cc (layout_type): Compute TYPE_SIZE and TYPE_SIZE_UNIT for vector types from the component mode sizes.
2025-04-28Prune non-SLP paths from vectorizer loop analysisRichard Biener1-109/+43
The following prunes non-SLP iteration and the parts of non-SLP stmt analysis that is no longer necessary - we need to keep the parts that bail on stmts not covered by SLP discovery or that failed SLP discovery. This will only go away when a we can build a fully covering single-lane SLP graph to fall back to. * tree-vect-loop.cc (vect_analyze_loop_operations): Prune all actual analysis and only fail when we discover a not SLP covered stmt. (vect_analyze_loop_2): Remove path trying without SLP.
2025-04-28Remove non-SLP vector loop transformRichard Biener2-288/+19
The following removes the stmt-based vectorization loop transform code. This also removes some debug stmt handling (that looked incomplete) which is also handled during peeling, and special-casing some stmts that should be killed off early and not left to DCE. Moving of dump from vect_transform_loop_stmt to vect_transform_stmt is to avoid regressing a few testcases. * tree-vect-loop.cc (vect_loop_kill_debug_uses): Remove. (maybe_set_vectorized_backedge_value): Likewise. (vect_transform_loop_stmt): Likewise. Move dump printing to vect_transform_stmt. (vect_transform_loop): Remove loop over loop stmts transforming them, but retain some DCE code still necessary. * tree-vect-stmts.cc (vect_transform_stmt): Dump that we're vectorizing a stmt.
2025-04-28Remove --param vect-force-slpRichard Biener4-9/+2
The following removes the ability to switch back to non SLP-only operation of the vectorizer - a requirement to start cleaning out non-SLP paths without risk of regressing that case. * params.opt (--param=vect-force-slp): Remove. * doc/invoke.texi (--param=vect-force-slp): Likewise. * tree-vect-loop.cc (vect_analyze_loop_2): Assume param_vect_force_slp is 1. * tree-vect-stmts.cc (vect_analyze_stmt): Likewise.
2025-04-28tailc: Improve tail recursion handling [PR119493]Jakub Jelinek1-2/+1
Here is a patch to improve the tail recursion handling also for non-musttail calls. 2025-04-28 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/119493 * tree-tailcall.cc (find_tail_calls): Handle non-gimple_reg_type arguments which aren't just passed through for tail recursions even for non-musttail calls.
2025-04-27c-family: Improve location for -Wunknown-pragmas in a _Pragma [PR118838]Lewis Hyatt5-18/+42
The warning for -Wunknown-pragmas is issued at the location provided by libcpp to the def_pragma() callback. This location is cpp_reader::directive_line, which is a location for the start of the line only; it is also not a valid location in case the unknown pragma was lexed from a _Pragma string. These factors make it impossible to suppress -Wunknown-pragmas via _Pragma("GCC diagnostic...") directives on the same source line, as in the PR and the test case. Address that by issuing the warning at a better location returned by cpp_get_diagnostic_override_loc(). libcpp already maintains this location to handle _Pragma-related diagnostics internally; it was needed also to make a publicly accessible version of it. gcc/c-family/ChangeLog: PR c/118838 * c-lex.cc (cb_def_pragma): Call cpp_get_diagnostic_override_loc() to get a valid location at which to issue -Wunknown-pragmas, in case it was triggered from a _Pragma. libcpp/ChangeLog: PR c/118838 * errors.cc (cpp_get_diagnostic_override_loc): New function. * include/cpplib.h (cpp_get_diagnostic_override_loc): Declare. gcc/testsuite/ChangeLog: PR c/118838 * c-c++-common/cpp/pragma-diagnostic-loc-2.c: New test. * g++.dg/gomp/macro-4.C: Adjust expected output. * gcc.dg/gomp/macro-4.c: Likewise. * gcc.dg/cpp/Wunknown-pragmas-1.c: Likewise.
2025-04-28gcc: For Windows x86-32, always attempt to realign stack regardless of SSELIU Hao1-1/+1
For Windows x86-32 targets, the Microsoft ABI only guarantees that the stack is aligned to 4-byte boundaries. GCC knows about the default alignment of the stack. However, before this commit, it did not realign the stack unless SSE was also enabled. When a stricter (larger) alignment is requested, it's always necessary to realign the stack, as what Solaris does. Reference: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111107#c14 Signed-off-by: LIU Hao <lh_mouse@126.com> Signed-off-by: Jonathan Yong <10walls@gmail.com> gcc/ChangeLog: PR target/111107 * config/i386/cygming.h (STACK_REALIGN_DEFAULT): Copy from sol2.h.
2025-04-28Fix size_t in id-15.c and infoleak-net-ethtool-ioctl.c for llp64Jonathan Yong2-3/+2
Use __SIZE_TYPE__ for size_t types so that it works for llp64. Signed-off-by: Jonathan Yong <10walls@gmail.com> gcc/testsuite/ChangeLog: * gcc.dg/graphite/id-15.c: Use __SIZE_TYPE__ instead of unsigned long. * gcc.dg/plugin/infoleak-net-ethtool-ioctl.c: ditto.
2025-04-28Daily bump.GCC Administrator6-1/+135
2025-04-27c++/modules: Ensure DECL_FRIEND_CONTEXT is streamed [PR119939]Nathaniel Shead3-2/+20
An instantiated friend function relies on DECL_FRIEND_CONTEXT being set to be able to recover the template arguments of the class that instantiated it, despite not being a template itself. This patch ensures that this data is streamed even when DECL_CLASS_SCOPE_P is not true. PR c++/119939 gcc/cp/ChangeLog: * module.cc (trees_out::lang_decl_vals): Also stream lang->u.fn.context when DECL_UNIQUE_FRIEND_P. (trees_in::lang_decl_vals): Likewise. gcc/testsuite/ChangeLog: * g++.dg/modules/concept-11_a.H: New test. * g++.dg/modules/concept-11_b.C: New test. Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
2025-04-27ssa-fre-4.c: Enable for all targets and adjust scan matchH.J. Lu1-4/+2
Since the C frontend no longer promotes char argument, enable ssa-fre-4.c for all targets and adjust scan match. PR middle-end/112877 * gcc.dg/tree-ssa/ssa-fre-4.c: Enable for all targets and adjust scan match. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-04-27scev-cast.c: Enable for all targets and adjust scan matchesH.J. Lu1-3/+2
Since the C frontend no longer promotes char argument, enable scev-cast.c for all targets and adjust scan matches. PR middle-end/112877 * gcc.dg/tree-ssa/scev-cast.c: Enable for all targets and adjust scan match. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-04-27vect-simd-clone-1[6-8][cd].c: Expect in-branch clones for x86H.J. Lu6-23/+6
Since the C frontend no longer promotes char and short arguments, expect in-branch clones for x86. PR middle-end/112877 * gcc.dg/vect/vect-simd-clone-16c.c: Expect in-branch clones for x86. * gcc.dg/vect/vect-simd-clone-16d.c: Likewise. * gcc.dg/vect/vect-simd-clone-17c.c: Likewise. * gcc.dg/vect/vect-simd-clone-17d.c: Likewise. * gcc.dg/vect/vect-simd-clone-18c.c: Likewise. * gcc.dg/vect/vect-simd-clone-18d.c: Likewise. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-04-27i386: Adjust apx-ndd.c for frontend promotion removalH.J. Lu1-6/+3
Since the C frontend no longer promotes integer argument smaller than int, the apx-ndd.c codgen is slightly different: apx-ndd.s (original) 2024-11-10 06:07:09.894876973 +0800 apx-ndd.s (updated) 2024-11-10 06:06:59.371860565 +0800 @@ -17,7 +17,7 @@ foo_add_char: foo1_add_char: .LFB1: .cfi_startproc - leal (%rsi,%rdi), %eax + leal (%rdi,%rsi), %eax ret .cfi_endproc .LFE1: @@ -50,7 +50,7 @@ foo_add_short: foo1_add_short: .LFB4: .cfi_startproc - leal (%rsi,%rdi), %eax + leal (%rdi,%rsi), %eax ret .cfi_endproc .LFE4: @@ -413,7 +413,7 @@ foo_and_char: foo1_and_char: .LFB37: .cfi_startproc - andl %edi, %esi, %eax + andl %esi, %edi, %eax ret .cfi_endproc .LFE37: @@ -435,7 +435,7 @@ foo_and_short: foo1_and_short: .LFB39: .cfi_startproc - andl %edi, %esi, %eax + andl %esi, %edi, %eax ret .cfi_endproc .LFE39: @@ -501,7 +501,7 @@ foo_or_char: foo1_or_char: .LFB45: .cfi_startproc - orl %edi, %esi, %eax + orl %esi, %edi, %eax ret .cfi_endproc .LFE45: @@ -523,7 +523,7 @@ foo_or_short: foo1_or_short: .LFB47: .cfi_startproc - orl %edi, %esi, %eax + orl %esi, %edi, %eax ret .cfi_endproc .LFE47: @@ -589,7 +589,7 @@ foo_xor_char: foo1_xor_char: .LFB53: .cfi_startproc - xorl %edi, %esi, %eax + xorl %esi, %edi, %eax ret .cfi_endproc .LFE53: @@ -611,7 +611,7 @@ foo_xor_short: foo1_xor_short: .LFB55: .cfi_startproc - xorl %edi, %esi, %eax + xorl %esi, %edi, %eax ret .cfi_endproc .LFE55: @@ -1018,7 +1018,7 @@ foo4_rol_uint64_t: foo1_imul_short: .LFB92: .cfi_startproc - imull %edi, %esi, %eax + imull %esi, %edi, %eax ret .cfi_endproc .LFE92: Adjust the assembler scans. PR middle-end/112877 * gcc.target/i386/apx-ndd.c: Adjusted. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-04-27Drop targetm.promote_prototypes from C, C++ and Ada frontendsH.J. Lu7-121/+9
Remove the targetm.calls.promote_prototypes call from C, C++ and Ada frontends. gcc/ PR c/48274 PR middle-end/112877 PR middle-end/118288 * gimple.cc (gimple_builtin_call_types_compatible_p): Remove the targetm.calls.promote_prototypes call. * tree.cc (tree_builtin_call_types_compatible_p): Likewise. gcc/ada/ PR middle-end/112877 * gcc-interface/utils.cc (create_param_decl): Remove the targetm.calls.promote_prototypes call. gcc/c/ PR c/48274 PR middle-end/112877 PR middle-end/118288 * c-decl.cc (start_decl): Remove the targetm.calls.promote_prototypes call. (store_parm_decls_oldstyle): Likewise. (finish_function): Likewise. * c-typeck.cc (convert_argument): Likewise. (c_safe_arg_type_equiv_p): Likewise. gcc/cp/ PR middle-end/112877 * call.cc (type_passed_as): Remove the targetm.calls.promote_prototypes call. (convert_for_arg_passing): Likewise. * typeck.cc (cxx_safe_arg_type_equiv_p): Likewise. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-04-27Honor TARGET_PROMOTE_PROTOTYPES during RTL expandH.J. Lu2-0/+26
Promote integer arguments smaller than int if TARGET_PROMOTE_PROTOTYPES returns true. gcc/ PR middle-end/112877 * calls.cc (initialize_argument_information): Promote small integer arguments if TARGET_PROMOTE_PROTOTYPES returns true. gcc/testsuite/ PR middle-end/112877 * gfortran.dg/pr112877-1.f90: New test. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-04-27RISC-V: Extract vector stepped for expand_const_vector [NFC]Pan Li1-291/+299
Consider the expand_const_vector is quit long (about 500 lines) and complicated, we would like to extract the different case into different functions. For example, the const vector stepped will be extracted into expand_const_vector_stepped. The below test suites are passed for this patch. * The rv64gcv fully regression test. gcc/ChangeLog: * config/riscv/riscv-v.cc (expand_const_vector): Extract const vector stepped into separated func. (expand_const_vector_single_step_npatterns): Add new func to take care of single step. (expand_const_vector_interleaved_stepped_npatterns): Add new func to take care of interleaved step. (expand_const_vector_stepped): Add new func to take care of const vector stepped. Signed-off-by: Pan Li <pan2.li@intel.com>
2025-04-27RISC-V: Extract vector duplicate for expand_const_vector [NFC]Pan Li1-76/+104
Consider the expand_const_vector is quit long (about 500 lines) and complicated, we would like to extract the different case into different functions. For example, the const vector duplicate will be extracted into expand_const_vector_duplicate, and then expand_const_vector_duplicate_repeating and expand_const_vector_duplicate_default for the underlying function. The below test suites are passed for this patch. * The rv64gcv fully regression test. gcc/ChangeLog: * config/riscv/riscv-v.cc (expand_const_vector_duplicate_repeating): Add new func to take care of vector duplicate with repeating. (expand_const_vector_duplicate_default): Add new func to take care of default const vector duplicate. (expand_const_vector_duplicate): Add new func to take care of all const vector duplicate. (expand_const_vector): Extract const vector duplicate into separated function. Signed-off-by: Pan Li <pan2.li@intel.com>
2025-04-27RISC-V: Extract vec_series for expand_const_vector [NFC]Pan Li1-7/+13
Consider the expand_const_vector is quit long (about 500 lines) and complicated, we would like to extract the different case into different functions. For example, the const vec_series will be extracted into expand_const_vec_series. The below test suites are passed for this patch. * The rv64gcv fully regression test. gcc/ChangeLog: * config/riscv/riscv-v.cc (expand_const_vec_series): Add new func to take care of the const vec_series. (expand_const_vector): Extract const vec_series into separated function. Signed-off-by: Pan Li <pan2.li@intel.com>
2025-04-27RISC-V: Extract vec_duplicate for expand_const_vector [NFC]Pan Li1-42/+50
Consider the expand_const_vector is quit long (about 500 lines) and complicated, we would like to extract the different case into different functions. For example, the const vec_duplicate will be extracted into expand_const_vec_duplicate. The below test suites are passed for this patch. * The rv64gcv fully regression test. gcc/ChangeLog: * config/riscv/riscv-v.cc (expand_const_vector): Extract const vec_duplicate into separated function. (expand_const_vec_duplicate): Add new func to take care of the const vec_duplicate. Signed-off-by: Pan Li <pan2.li@intel.com>
2025-04-26Refactor msse4 and mno-sse4.liuhongt3-23/+13
gcc/ChangeLog: PR target/119549 * common/config/i386/i386-common.cc (ix86_handle_option): Refactor msse4 and mno-sse4. * config/i386/i386.opt (msse4): Remove RejectNegative. (mno-sse4): Remove the entry. * config/i386/i386-options.cc (ix86_valid_target_attribute_inner_p): Remove special code which handles mno-sse4.
2025-04-27Daily bump.GCC Administrator2-1/+16
2025-04-26Fix i386 vectorizer cost of FP scalar MAX_EXPR and MIN_EXPRJan Hubicka1-2/+4
I introduced a bug by last minute cleanups unifying the scalar and vector SSE conditional. This patch fixes it and restores cost of 1 of SSE scalar MIN/MAX Bootstrapped/regtested x86_64-linux, comitted. gcc/ChangeLog: PR target/105275 * config/i386/i386.cc (ix86_vector_costs::add_stmt_cost): Fix cost of FP scalar MAX_EXPR and MIN_EXPR
2025-04-26Add m32c*-*-* to the list of obsolete targetsIain Buclaw1-0/+1
This patch marks m32c*-*-* targets obsolete in GCC 16. The target has not had a maintainer since GCC 9, and fails to compile even the simplest of functions since GCC 8 (reported in PR83670). contrib/ChangeLog: * config-list.mk: Add m32c*-*-* to the list of obsoleted targets. gcc/ChangeLog: * config.gcc (LIST): --enable-obsolete for m32c-elf.
2025-04-25simplify-rtx: Simplify `(zero_extend (and x CST))` -> (and (subreg x) CST)Andrew Pinski1-0/+11
This adds the simplification of a ZERO_EXTEND of an AND. This optimization was already handled in combine via combine_simplify_rtx and the handling there of compound_operations (ZERO_EXTRACT). Build and tested for aarch64-linux-gnu. Bootstrapped and tested on x86_64-linux-gnu. gcc/ChangeLog: * simplify-rtx.cc (simplify_context::simplify_unary_operation_1) <case ZERO_EXTEND>: Add simplifcation for and with a constant. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2025-04-26Daily bump.GCC Administrator6-1/+268
2025-04-25testsuite: Skip tests incompatible with generic thunk supportDimitar Dimitrov6-1/+39
Some backends do not define TARGET_ASM_OUTPUT_MI_THUNK. But the generic thunk support cannot emit code for calling variadic methods of multiple-inheritance classes. Example error for pru-unknown-elf: .../gcc/gcc/testsuite/g++.dg/ipa/pr83549.C:7:24: error: generic thunk code fails for method 'virtual void C::_ZThn4_N1C3fooEz(...)' which uses '...' Disable the affected tests for all targets which do not define TARGET_ASM_OUTPUT_MI_THUNK. Ensured that test results with and without this patch for x86_64-pc-linux-gnu are the same. gcc/ChangeLog: * doc/sourcebuild.texi: Document variadic_mi_thunk effective target check. gcc/testsuite/ChangeLog: * g++.dg/ipa/pr83549.C: Require effective target variadic_mi_thunk. * g++.dg/ipa/pr83667.C: Ditto. * g++.dg/torture/pr81812.C: Ditto. * g++.old-deja/g++.jason/thunk3.C: Ditto. * lib/target-supports.exp (check_effective_target_variadic_mi_thunk): New function. Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2025-04-25testsuite: Add require target for SJLJ exception implementationDimitar Dimitrov10-8/+23
Testcases for musttail call optimization fail on pru-unknown-elf: FAIL: c-c++-common/musttail14.c -std=gnu++17 (test for excess errors) Excess errors: .../gcc/gcc/testsuite/c-c++-common/musttail14.c:37:14: error: cannot tail-call: caller uses sjlj exceptions Silence these errors by disabling the tests if target uses SJLJ for implementing exceptions. Use a new effective target check for this. Ensured that test results with and without this patch for x86_64-pc-linux-gnu are the same. gcc/ChangeLog: * doc/sourcebuild.texi: Document effective target using_sjlj_exceptions. gcc/testsuite/ChangeLog: * c-c++-common/musttail14.c: Disable test if effective target using_sjlj_exceptions. * c-c++-common/musttail22.c: Ditto. * g++.dg/musttail8.C: Ditto. * g++.dg/musttail9.C: Ditto. * g++.dg/opt/musttail3.C: Ditto. * g++.dg/opt/musttail4.C: Ditto. * g++.dg/opt/musttail5.C: Ditto. * g++.dg/opt/pr119613.C: Ditto. * lib/target-supports.exp (check_effective_target_using_sjlj_exceptions): New check. Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2025-04-25match: Move `(cmp (cond @0 @1 @2) @3)` simplification after the bool compare ↵Andrew Pinski1-14/+17
simplifcation This moves the `(cmp (cond @0 @1 @2) @3)` simplifcation to be after the boolean comparison simplifcations so that we don't end up simplifing into the same thing for a GIMPLE_COND. gcc/ChangeLog: * match.pd: Move `(cmp (cond @0 @1 @2) @3)` simplifcation after the bool comparison simplifications. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2025-04-25gimple: Fix comment before gimple_cond_make_false/gimple_cond_make_trueAndrew Pinski1-3/+3
I noticed the comments and the code don't match. The correct form is: 'if (0 != 0)': false and 'if (1 != 0)': true That is always NE and always 0 as the second operand. Also there is a spello for statement in the comment in front of gimple_cond_true_p. Pushed as obvious. gcc/ChangeLog: * gimple.h (gimple_cond_make_false): Fix comment. (gimple_cond_make_true): Likewise. (gimple_cond_true_p): Fix spello for statement in comment. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2025-04-25Fortran: fix procedure pointer handling with -fcheck=pointer [PR102900]Harald Anlauf4-7/+46
PR fortran/102900 gcc/fortran/ChangeLog: * trans-decl.cc (gfc_generate_function_code): Use sym->result when generating fake result decl for functions returning allocatable or pointer results. * trans-expr.cc (gfc_conv_procedure_call): When checking the pointer status of an actual argument passed to a non-allocatable, non-pointer dummy which is of type CLASS, do not check the class container of the actual if it is just a procedure pointer. (gfc_trans_pointer_assignment): Fix treatment of assignment to NULL of a procedure pointer. gcc/testsuite/ChangeLog: * gfortran.dg/proc_ptr_52.f90: Add -fcheck=pointer to options. * gfortran.dg/proc_ptr_57.f90: New test.
2025-04-25c++: pruning non-captures in noexcept lambda [PR119764]Jason Merrill2-14/+37
The patch for PR87185 fixed the ICE without fixing the underlying problem, that we were failing to find the declaration of the capture proxy that we are trying to decide whether to prune. Fixed by looking at the right index in stmt_list_stack. Since this changes captures, it changes the ABI of noexcept lambdas; we haven't worked hard to maintain lambda capture ABI, but it's easy enough to control here. PR c++/119764 PR c++/87185 gcc/cp/ChangeLog: * lambda.cc (insert_capture_proxy): Handle noexcept lambda. (prune_lambda_captures): Likewise, in ABI v21. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/lambda/lambda-noexcept1.C: New test.
2025-04-25c++: add -fabi-version=21Jason Merrill3-4/+7
I'm about to add a bugfix that changes the ABI of noexcept lambdas, so first let's add the new ABI version. And I think it's time to update the compatibility version; let's bump to GCC 13, before the addition of concepts mangling. gcc/ChangeLog: * common.opt: Add ABI v21. gcc/c-family/ChangeLog: * c-opts.cc (c_common_post_options): Bump default ABI to 21 and compat ABI to 18. gcc/testsuite/ChangeLog: * g++.dg/abi/macro0.C: Update for -fabi-version=21.
2025-04-25icf: Remove unused constructors of sem_function and sem_variableAndrew Pinski2-19/+0
The constructors for sem_function and sem_variable that just passes the bitmap obstack and NOT the cgraph node was unused so let's remove it. gcc/ChangeLog: * ipa-icf.cc (sem_function::sem_function): Remove the obstack argument version one. (sem_variable::sem_variable): Likewise. * ipa-icf.h (sem_function): Remove ctor for obstack argument only one. (sem_variable): Likewise. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2025-04-25icf: Remove nop code from sem_function::init.Andrew Pinski1-1/+0
Here we had: node = node; Which does nothing so let's remove it. gcc/ChangeLog: * ipa-icf.cc (sem_function::init): Remove assignment of node from itself. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2025-04-25phiopt: Remove calls.h include [PR119811]Andrew Pinski1-1/+0
When the patch, https://gcc.gnu.org/pipermail/gcc-patches/2024-August/660807.html was rewroked into r15-3047-g404d947d8ddd3c, the include for calls.h was still included and missed that it was no longer needed. Pushed as obvious. PR tree-optimization/119811 gcc/ChangeLog: * tree-ssa-phiopt.cc: Remove calls.h include. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2025-04-25cobol: New testcases.Robert Dubner92-0/+4361
These testcases are derived from the cobolworx run_fundamental.at file. gcc/testsuite * cobol.dg/group2/88_level_with_FALSE_IS_clause.cob: New testcase. * cobol.dg/group2/88_level_with_FILLER.cob: Likewise. * cobol.dg/group2/88_level_with_THRU.cob: Likewise. * cobol.dg/group2/ADD_CORRESPONDING.cob: Likewise. * cobol.dg/group2/ADD_SUBTRACT_CORR_mixed_fix___float.cob: Likewise. * cobol.dg/group2/ALPHABETIC-LOWER_test.cob: Likewise. * cobol.dg/group2/ALPHABETIC_test.cob: Likewise. * cobol.dg/group2/ALPHABETIC-UPPER_test.cob: Likewise. * cobol.dg/group2/BLANK_WHEN_ZERO.cob: Likewise. * cobol.dg/group2/Check_for_equality_of_COMP-1___COMP-2.cob: Likewise. * cobol.dg/group2/Compare_COMP-2_with_floating-point_literal.cob: Likewise. * cobol.dg/group2/Contained_program_visibility__3_.cob: Likewise. * cobol.dg/group2/Contained_program_visibility__4_.cob: Likewise. * cobol.dg/group2/Context_sensitive_words__1_.cob: Likewise. * cobol.dg/group2/Context_sensitive_words__2_.cob: Likewise. * cobol.dg/group2/Context_sensitive_words__3_.cob: Likewise. * cobol.dg/group2/Context_sensitive_words__4_.cob: Likewise. * cobol.dg/group2/Context_sensitive_words__5_.cob: Likewise. * cobol.dg/group2/Context_sensitive_words__6_.cob: Likewise. * cobol.dg/group2/Context_sensitive_words__7_.cob: Likewise. * cobol.dg/group2/Context_sensitive_words__8_.cob: Likewise. * cobol.dg/group2/debugging_lines__not_active_.cob: Likewise. * cobol.dg/group2/debugging_lines__WITH_DEBUGGING_MODE_.cob: Likewise. * cobol.dg/group2/DEBUG_Line.cob: Likewise. * cobol.dg/group2/DISPLAY_and_assignment_NumericDisplay.cob: Likewise. * cobol.dg/group2/DISPLAY_data_items_with_MOVE_statement.cob: Likewise. * cobol.dg/group2/DISPLAY_data_items_with_VALUE_clause.cob: Likewise. * cobol.dg/group2/DISPLAY_literals__DECIMAL-POINT_is_COMMA.cob: Likewise. * cobol.dg/group2/GLOBAL_at_lower_level.cob: Likewise. * cobol.dg/group2/GLOBAL_at_same_level.cob: Likewise. * cobol.dg/group2/GLOBAL_FD__1_.cob: Likewise. * cobol.dg/group2/GLOBAL_FD__2_.cob: Likewise. * cobol.dg/group2/GLOBAL_FD__3_.cob: Likewise. * cobol.dg/group2/GLOBAL_FD__4_.cob: Likewise. * cobol.dg/group2/Hexadecimal_literal.cob: Likewise. * cobol.dg/group2/integer_arithmetic_on_floating-point_var.cob: Likewise. * cobol.dg/group2/MULTIPLY_BY_literal_in_INITIAL_program.cob: Likewise. * cobol.dg/group2/Named_conditionals_-_fixed__float__and_alphabetic.cob: Likewise. * cobol.dg/group2/Numeric_operations__1_.cob: Likewise. * cobol.dg/group2/Numeric_operations__2_.cob: Likewise. * cobol.dg/group2/Numeric_operations__3_.cob: Likewise. * cobol.dg/group2/Numeric_operations__4_.cob: Likewise. * cobol.dg/group2/Numeric_operations__5_.cob: Likewise. * cobol.dg/group2/Numeric_operations__7_.cob: Likewise. * cobol.dg/group2/Numeric_operations__8_.cob: Likewise. * cobol.dg/group2/ROUNDED_AWAY-FROM-ZERO.cob: Likewise. * cobol.dg/group2/ROUNDED_NEAREST-AWAY-FROM-ZERO.cob: Likewise. * cobol.dg/group2/ROUNDED_NEAREST-EVEN.cob: Likewise. * cobol.dg/group2/ROUNDED_NEAREST-TOWARD-ZERO.cob: Likewise. * cobol.dg/group2/ROUNDED_TOWARD-GREATER.cob: Likewise. * cobol.dg/group2/ROUNDED_TOWARD-LESSER.cob: Likewise. * cobol.dg/group2/ROUNDED_TRUNCATION.cob: Likewise. * cobol.dg/group2/ROUNDING_omnibus_Floating-Point_from_COMPUTE.cob: Likewise. * cobol.dg/group2/ROUNDING_omnibus_NumericDisplay_from_COMPUTE.cob: Likewise. * cobol.dg/group2/Separate_sign_positions__1_.cob: Likewise. * cobol.dg/group2/Separate_sign_positions__2_.cob: Likewise. * cobol.dg/group2/Simple_p-scaling.cob: Likewise. * cobol.dg/group2/Simple_TYPEDEF.cob: Likewise. * cobol.dg/group2/ADD_SUBTRACT_CORR_mixed_fix___float.out: New known-good result. * cobol.dg/group2/BLANK_WHEN_ZERO.out: Likewise. * cobol.dg/group2/Contained_program_visibility__4_.out: Likewise. * cobol.dg/group2/Context_sensitive_words__1_.out: Likewise. * cobol.dg/group2/Context_sensitive_words__2_.out: Likewise. * cobol.dg/group2/Context_sensitive_words__3_.out: Likewise. * cobol.dg/group2/Context_sensitive_words__4_.out: Likewise. * cobol.dg/group2/Context_sensitive_words__5_.out: Likewise. * cobol.dg/group2/Context_sensitive_words__6_.out: Likewise. * cobol.dg/group2/Context_sensitive_words__7_.out: Likewise. * cobol.dg/group2/Context_sensitive_words__8_.out: Likewise. * cobol.dg/group2/debugging_lines__not_active_.out: Likewise. * cobol.dg/group2/debugging_lines__WITH_DEBUGGING_MODE_.out: Likewise. * cobol.dg/group2/DEBUG_Line.out: Likewise. * cobol.dg/group2/DISPLAY_and_assignment_NumericDisplay.out: Likewise. * cobol.dg/group2/DISPLAY_data_items_with_MOVE_statement.out: Likewise. * cobol.dg/group2/DISPLAY_data_items_with_VALUE_clause.out: Likewise. * cobol.dg/group2/DISPLAY_literals__DECIMAL-POINT_is_COMMA.out: Likewise. * cobol.dg/group2/GLOBAL_at_lower_level.out: Likewise. * cobol.dg/group2/GLOBAL_at_same_level.out: Likewise. * cobol.dg/group2/Hexadecimal_literal.out: Likewise. * cobol.dg/group2/Named_conditionals_-_fixed__float__and_alphabetic.out: Likewise. * cobol.dg/group2/ROUNDED_AWAY-FROM-ZERO.out: Likewise. * cobol.dg/group2/ROUNDED_NEAREST-AWAY-FROM-ZERO.out: Likewise. * cobol.dg/group2/ROUNDED_NEAREST-EVEN.out: Likewise. * cobol.dg/group2/ROUNDED_NEAREST-TOWARD-ZERO.out: Likewise. * cobol.dg/group2/ROUNDED_TOWARD-GREATER.out: Likewise. * cobol.dg/group2/ROUNDED_TOWARD-LESSER.out: Likewise. * cobol.dg/group2/ROUNDED_TRUNCATION.out: Likewise. * cobol.dg/group2/ROUNDING_omnibus_Floating-Point_from_COMPUTE.out: Likewise. * cobol.dg/group2/ROUNDING_omnibus_NumericDisplay_from_COMPUTE.out: Likewise. * cobol.dg/group2/Separate_sign_positions__1_.out: Likewise. * cobol.dg/group2/Separate_sign_positions__2_.out: Likewise. * cobol.dg/group2/Simple_p-scaling.out: Likewise.
2025-04-25modulo-sched: reject loop conditions when not decrementing with one [PR 116479]Andre Vieira2-1/+33
In the commit titled 'doloop: Add support for predicated vectorized loops' the doloop_condition_get function was changed to accept loops with decrements larger than 1. This patch rejects such loops for modulo-sched. gcc/ChangeLog: PR rtl-optimization/116479 * modulo-sched.cc (doloop_register_get): Reject conditions with decrements that are not 1. gcc/testsuite/ChangeLog: * gcc.dg/pr116479.c: New test.
2025-04-25s390: Allow 5+ argument tail-calls in some -m31 -mzarch special cases [PR119873]Jakub Jelinek2-1/+22
Here is a patch to handle the PARALLEL case too. I think we can just use rtx_equal_p there, because it will always use SImode in the EXPR_LIST REGs in that case. 2025-04-25 Jakub Jelinek <jakub@redhat.com> PR target/119873 * config/s390/s390.cc (s390_call_saved_register_used): Don't return true if default definition of PARM_DECL SSA_NAME of the same register is passed in call saved register in the PARALLEL case either. * gcc.target/s390/pr119873-5.c: New test.
2025-04-25c++: bad pending_template recursionJason Merrill3-4/+33
limit_bad_template_recursion currently avoids immediate instantiation of templates from uses in an already ill-formed instantiation, but we still can get unnecessary recursive instantiation in pending_templates if the instantiation was queued before the error. Initially this regressed several libstdc++ tests which seemed to rely on a static_assert in a function called from another that is separately ill-formed. For instance, in the 48101_neg.cc tests, we first got an error in find(), then later instantiate _S_key() (called from find) and got the static_assert error from there. r16-131-g876d1a22dfaf87 and r16-132-g901900bc37566c changed the library code (and tests) to make the expected static_assert errors happen earlier. gcc/cp/ChangeLog: * cp-tree.h (struct tinst_level): Add had_errors bit. * pt.cc (push_tinst_level_loc): Clear it. (pop_tinst_level): Set it. (reopen_tinst_level): Check it. (instantiate_pending_templates): Call limit_bad_template_recursion. gcc/testsuite/ChangeLog: * g++.dg/template/recurse5.C: New test.
2025-04-25GCN: Properly switch sections in 'gcn_hsa_declare_function_name' [PR119737]Andrew Pinski1-3/+3
There are GCN/C++ target as well as offloading codes, where the hard-coded section names in 'gcn_hsa_declare_function_name' do not fit, and assembly thus fails: LLVM ERROR: Size expression must be absolute. This commit progresses GCN target: [-FAIL: g++.dg/init/call1.C -std=gnu++17 (internal compiler error: Aborted signal terminated program as)-] [-FAIL:-]{+PASS:+} g++.dg/init/call1.C -std=gnu++17 (test for excess errors) [-UNRESOLVED:-]{+PASS:+} g++.dg/init/call1.C -std=gnu++17 [-compilation failed to produce executable-]{+execution test+} [-FAIL: g++.dg/init/call1.C -std=gnu++26 (internal compiler error: Aborted signal terminated program as)-] [-FAIL:-]{+PASS:+} g++.dg/init/call1.C -std=gnu++26 (test for excess errors) [-UNRESOLVED:-]{+PASS:+} g++.dg/init/call1.C -std=gnu++26 [-compilation failed to produce executable-]{+execution test+} UNSUPPORTED: g++.dg/init/call1.C -std=gnu++98: exception handling not supported ..., and GCN offloading: [-XFAIL: libgomp.c++/target-exceptions-throw-1.C (internal compiler error: Aborted signal terminated program as)-] [-XFAIL: libgomp.c++/target-exceptions-throw-1.C PR119737 at line 7 (test for bogus messages, line )-] [-XFAIL:-]{+PASS:+} libgomp.c++/target-exceptions-throw-1.C (test for excess errors) [-UNRESOLVED:-]{+PASS:+} libgomp.c++/target-exceptions-throw-1.C [-compilation failed to produce executable-]{+execution test+} {+PASS: libgomp.c++/target-exceptions-throw-1.C output pattern test+} [-XFAIL: libgomp.c++/target-exceptions-throw-2.C (internal compiler error: Aborted signal terminated program as)-] [-XFAIL: libgomp.c++/target-exceptions-throw-2.C PR119737 at line 7 (test for bogus messages, line )-] [-XFAIL:-]{+PASS:+} libgomp.c++/target-exceptions-throw-2.C (test for excess errors) [-UNRESOLVED:-]{+PASS:+} libgomp.c++/target-exceptions-throw-2.C [-compilation failed to produce executable-]{+execution test+} {+PASS: libgomp.c++/target-exceptions-throw-2.C output pattern test+} [-XFAIL: libgomp.oacc-c++/exceptions-throw-1.C -DACC_DEVICE_TYPE_radeon=1 -DACC_MEM_SHARED=0 -foffload=amdgcn-amdhsa -O2 (internal compiler error: Aborted signal terminated program as)-] [-XFAIL: libgomp.oacc-c++/exceptions-throw-1.C -DACC_DEVICE_TYPE_radeon=1 -DACC_MEM_SHARED=0 -foffload=amdgcn-amdhsa -O2 PR119737 at line 7 (test for bogus messages, line )-] [-XFAIL:-]{+PASS:+} libgomp.oacc-c++/exceptions-throw-1.C -DACC_DEVICE_TYPE_radeon=1 -DACC_MEM_SHARED=0 -foffload=amdgcn-amdhsa -O2 (test for excess errors) [-UNRESOLVED:-]{+PASS:+} libgomp.oacc-c++/exceptions-throw-1.C -DACC_DEVICE_TYPE_radeon=1 -DACC_MEM_SHARED=0 -foffload=amdgcn-amdhsa -O2 [-compilation failed to produce executable-]{+execution test+} {+PASS: libgomp.oacc-c++/exceptions-throw-1.C -DACC_DEVICE_TYPE_radeon=1 -DACC_MEM_SHARED=0 -foffload=amdgcn-amdhsa -O2 output pattern test+} [-XFAIL: libgomp.oacc-c++/exceptions-throw-2.C -DACC_DEVICE_TYPE_radeon=1 -DACC_MEM_SHARED=0 -foffload=amdgcn-amdhsa -O2 (internal compiler error: Aborted signal terminated program as)-] [-XFAIL: libgomp.oacc-c++/exceptions-throw-2.C -DACC_DEVICE_TYPE_radeon=1 -DACC_MEM_SHARED=0 -foffload=amdgcn-amdhsa -O2 PR119737 at line 9 (test for bogus messages, line )-] [-XFAIL:-]{+PASS:+} libgomp.oacc-c++/exceptions-throw-2.C -DACC_DEVICE_TYPE_radeon=1 -DACC_MEM_SHARED=0 -foffload=amdgcn-amdhsa -O2 (test for excess errors) [-UNRESOLVED:-]{+PASS:+} libgomp.oacc-c++/exceptions-throw-2.C -DACC_DEVICE_TYPE_radeon=1 -DACC_MEM_SHARED=0 -foffload=amdgcn-amdhsa -O2 [-compilation failed to produce executable-]{+execution test+} {+PASS: libgomp.oacc-c++/exceptions-throw-2.C -DACC_DEVICE_TYPE_radeon=1 -DACC_MEM_SHARED=0 -foffload=amdgcn-amdhsa -O2 output pattern test+} PR target/119737 gcc/ * config/gcn/gcn.cc (gcn_hsa_declare_function_name): Properly switch sections. libgomp/ * testsuite/libgomp.c++/target-exceptions-throw-1.C: Remove PR119737 XFAILing. * testsuite/libgomp.c++/target-exceptions-throw-2.C: Likewise. * testsuite/libgomp.oacc-c++/exceptions-throw-1.C: Likewise. * testsuite/libgomp.oacc-c++/exceptions-throw-2.C: Likewise. Co-authored-by: Thomas Schwinge <tschwinge@baylibre.com>
2025-04-24[PATCH] RISC-V: Imply C from Zca whenever possible [PR119122]Yuriy Kolerov14-5/+84
GCC must imply C extension from Zca extension when it's possible. It's necessary for achieving compatibility between different march strings which in fact may be the same. E.g., if rv32ic multilib configuration is presented in GCC, then GCC will not choose this configuration for linking if -march=rv32i_zca is passed. Here is a more practical example. From RISC-V Instruction Set Manual: Therefore common ISA strings can be updated as follows to include the relevant Zc extensions, for example: - RV32IMC becomes RV32IM_Zce - RV32IMCF becomes RV32IMF_Zce With current implication rules this will not work well if rv32imc configuration is presented and a user passes -march=rv32im_zce. This is how we can check this with a simple empty test.c source file: $ riscv64-unknown-elf-gcc -march=rv32ic -mabi=ilp32 -mriscv-attribute -S test.c $ grep "attribute arch" test.s .attribute arch, "rv32i2p1_c2p0_zca1p0" $ riscv64-unknown-elf-gcc -march=rv32i_zce -mabi=ilp32 -mriscv-attribute -S test.c $ grep "attribute arch" test.s .attribute arch, "rv32i2p1_zicsr2p0_zca1p0_zcb1p0_zce1p0_zcmp1p0_zcmt1p0" According to current GCC these march strings are incompatible: the first one contains c2p0 and the second on doesn't. To introduce such implication rule we need to carefully cover all possible combinations with these extensions: zca, zcf, zcd, F and D. According to the same manual: As C defines the same instructions as Zca, Zcf and Zcd, the rule is that: - C always implies Zca - C+F implies Zcf (RV32 only) - C+D implies Zcd Here is a full list of cases: 1. rv32i_zca implies C. 2. rv32if_zca_zcf implies C. 3. rv32ifd_zca_zcf_zcd implies C. 4. rv64i_zca implies C. 5. rv64ifd_zca_zcd implies C. PR target/119122 gcc/ChangeLog: * common/config/riscv/riscv-common.cc (riscv_implied_info): Add a rule for Zca to C implication. gcc/testsuite/ChangeLog: * gcc.target/riscv/arch-25.c: Fix dg-error expectation. * gcc.target/riscv/attribute-c-1.c: New test. * gcc.target/riscv/attribute-c-2.c: New test. * gcc.target/riscv/attribute-c-3.c: New test. * gcc.target/riscv/attribute-c-4.c: New test. * gcc.target/riscv/attribute-c-5.c: New test. * gcc.target/riscv/attribute-c-6.c: New test. * gcc.target/riscv/attribute-c-7.c: New test. * gcc.target/riscv/attribute-c-8.c: New test. * gcc.target/riscv/attribute-zce-1.c: Update Zce tests. * gcc.target/riscv/attribute-zce-2.c: Likewise. * gcc.target/riscv/attribute-zce-3.c: Likewise * gcc.target/riscv/attribute-zce-4.c: Likewise.
2025-04-25Daily bump.GCC Administrator8-1/+310
2025-04-24s390: Allow 5+ argument tail-calls in some special cases [PR119873]Jakub Jelinek5-3/+100
protobuf (and therefore firefox too) currently doesn't build on s390*-linux. The problem is that it uses [[clang::musttail]] attribute heavily, and in llvm (IMHO llvm bug) [[clang::musttail]] calls with 5+ arguments on s390*-linux are silently accepted and result in a normal non-tail call. In GCC we just reject those because the target hook refuses to tail call it (IMHO the right behavior). Now, the reason why that happens is as s390_function_ok_for_sibcall attempts to explain, the 5th argument (assuming normal <= wordsize integer or pointer arguments, nothing that needs 2+ registers) is passed in %r6 which is not call clobbered, so we can't do tail call when we'd have to change content of that register and then caller would assume %r6 content didn't change and use it again. In the protobuf case though, the 5th argument is always passed through from the caller to the musttail callee unmodified, so one can actually emit just jg tail_called_function or perhaps tweak some registers but keep %r6 untouched, and in that case I think it is just fine to tail call it (at least unless the stack slots used for 6+ argument can't be modified by the callee in the ABI and nothing checks for that). So, the following patch checks for this special case, where the argument which uses %r6 is passed in a single register and it is passed default definition of SSA_NAME of a PARM_DECL with the same DECL_INCOMING_RTL. It won't really work at -O0 but should work for -O1 and above, at least when one doesn't really try to modify the parameter conditionally and hope it will be optimized away in the end. 2025-04-24 Jakub Jelinek <jakub@redhat.com> Stefan Schulze Frielinghaus <stefansf@gcc.gnu.org> PR target/119873 * config/s390/s390.cc (s390_call_saved_register_used): Don't return true if default definition of PARM_DECL SSA_NAME of the same register is passed in call saved register. (s390_function_ok_for_sibcall): Adjust comment. * gcc.target/s390/pr119873-1.c: New test. * gcc.target/s390/pr119873-2.c: New test. * gcc.target/s390/pr119873-3.c: New test. * gcc.target/s390/pr119873-4.c: New test.