aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2025-04-26Add m32c*-*-* to the list of obsolete targetsIain Buclaw2-1/+2
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 Administrator11-1/+464
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-25libstdc++: Use markdown in some Doxygen commentsJonathan Wakely1-3/+3
libstdc++-v3/ChangeLog: * include/bits/ptr_traits.h (to_address): Use markdown for formatting in Doxygen comments.
2025-04-25libstdc++: Add some makefile dependenciesJonathan Wakely2-0/+16
This ensures that wstring-inst.o and similar files will be rebuilt when string-inst.cc changes. libstdc++-v3/ChangeLog: * src/c++11/Makefile.am: Add prerequisites for targets that depend on string-inst.cc. * src/c++11/Makefile.in: Regenerate.
2025-04-25libstdc++: Micro-optimization for std::addressofJonathan Wakely1-1/+1
Currently std::addressof calls std::__addressof which uses __builtin_addressof. This leads to me prefering std::__addressof in some code, to avoid the extra hop. But it's not as though the implementation of std::__addressof is complicated and reusing it avoids any code duplication. So let's just make std::addressof use the built-in directly, and then we only need to use std::__addressof in C++98 code. (Transitioning existing uses of std::__addressof to std::addressof isn't included in this change.) The front end does fold std::addressof with -ffold-simple-inlines but this change still seems worthwhile. libstdc++-v3/ChangeLog: * include/bits/move.h (addressof): Use __builtin_addressof directly.
2025-04-25libstdc++: Remove c++26 dg-error lines for -Wdelete-incomplete errorsJonathan Wakely1-3/+0
This fixes: FAIL: tr1/2_general_utilities/shared_ptr/cons/43820_neg.cc -std=gnu++26 (test for errors, line 283) FAIL: tr1/2_general_utilities/shared_ptr/cons/43820_neg.cc -std=gnu++26 (test for errors, line 305) This is another consequence of r16-133-g8acea9ffa82ed8 which prevents the -Wdelete-incomplete errors that happen after the first error. libstdc++-v3/ChangeLog: * testsuite/tr1/2_general_utilities/shared_ptr/cons/43820_neg.cc: Remove dg-error directives for additional c++26 errors.
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-25libstdc++: Rename std::latch data memberJonathan Wakely1-6/+6
Rename _M_a to match the name of the exposition-only data member shown in the standard, i.e. 'counter'. libstdc++-v3/ChangeLog: * include/std/latch (latch::_M_a): Rename to _M_counter. Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
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-25libstdc++: Minimalize temporary allocations when width is specified [PR109162]Tomasz Kamiński6-106/+961
When width parameter is specified for formatting range, tuple or escaped presentation of string, we used to format characters to temporary string, and write produce sequence padded according to the spec. However, once the estimated width of formatted representation of input is larger than the value of spec width, it can be written directly to the output. This limits size of required allocation, especially for large ranges. Similarly, if precision (maximum) width is provided for string presentation, only a prefix of sequence with estimated width not greater than precision, needs to be buffered. To realize above, this commit implements a new _Padding_sink specialization. This sink holds an output iterator, a value of padding width, (optionally) maximum width and a string buffer inherited from _Str_sink. Then any incoming characters are treated in one of following ways, depending of estimated width W of written sequence: * written to string if W is smaller than padding width and maximum width (if present) * ignored, if W is greater than maximum width * written to output iterator, if W is greater than padding width The padding sink is used instead of _Str_sink in __format::__format_padded, __formatter_str::_M_format_escaped functions. Furthermore __formatter_str::_M_format implementation was reworked, to: * reduce number of instantiations by delegating to _Rg& and const _Rg& overloads, * non-debug presentation is written to _Out directly or via _Padding_sink * if maximum width is specified for debug format with non-unicode encoding, string size is limited to that number. PR libstdc++/109162 libstdc++-v3/ChangeLog: * include/bits/formatfwd.h (__simply_formattable_range): Moved from std/format. * include/std/format (__formatter_str::_format): Extracted escaped string handling to separate method... (__formatter_str::_M_format_escaped): Use __Padding_sink. (__formatter_str::_M_format): Adjusted implementation. (__formatter_str::_S_trunc): Extracted as namespace function... (__format::_truncate): Extracted from __formatter_str::_S_trunc. (__format::_Seq_sink): Removed forward declarations, made members protected and non-final. (_Seq_sink::_M_trim): Define. (_Seq_sink::_M_span): Renamed from view. (_Seq_sink::view): Returns string_view instead of span. (__format::_Str_sink): Moved after _Seq_sink. (__format::__format_padded): Use _Padding_sink. * testsuite/std/format/debug.cc: Add timeout and new tests. * testsuite/std/format/ranges/sequence.cc: Specify unicode as encoding and new tests. * testsuite/std/format/ranges/string.cc: Likewise. * testsuite/std/format/tuple.cc: Likewise. Reviewed-by: Jonathan Wakely <jwakely@redhat.com> Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2025-04-25libstdc++: Replace leftover std::queue with Adaptor in ranges/adaptors.cc.Tomasz Kamiński1-1/+1
This was leftover from work-in-progress state, where only std::queue was tested. libstdc++-v3/ChangeLog: * testsuite/std/format/ranges/adaptors.cc: Updated test.
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-25libstdc++: Remove c++98_only dg-errorJonathan Wakely1-1/+0
This fixes FAIL: 22_locale/ctype/is/string/89728_neg.cc -std=gnu++98 (test for errors, line ) Since r16-133-g8acea9ffa82ed8 we don't keep issuing more errors after the first one, so this dg-error no longer matches anything. libstdc++-v3/ChangeLog: * testsuite/22_locale/ctype/is/string/89728_neg.cc: Remove dg-error for c++98_only effective target.
2025-04-25libstdc++: Constrain formatter for thread::id [PR119918]Tomasz Kamiński4-143/+210
This patch add constraint __formatter::__char to _CharT type parameter of formatter<thread::id, _CharT> specialization, matching the constraint of formatting of integer/pointers that are used as native handles. The dependency on <format> header, is changed to <bits/formatfwd.h>. To achieve that, formatting of pointers is extracted from void const* specialization to internal __formatter_ptr<_CharT>, that can be forward declared. Finally, the handle representation is now printed directly to __fc.out(), by the formatter for handle type. To support this, internal formatters can now be constructed from _Spec object as alternative to invoking parse method. PR libstdc++/119918 libstdc++-v3/ChangeLog: * include/bits/formatfwd.h (__format::_Align): Moved from std/format. (std::__throw_format_error, __format::__formatter_str) (__format::__formatter_ptr): Declare. * include/std/format (__format::_Align): Moved to bits/formatfwd.h. (__formatter_int::__formatter_int): Define. (__format::__formatter_ptr): Extracted from formatter for const void*. (std::formatter<const void*, _CharT>, formatter<void*, _CharT>) (std::formatter<nullptr_t, _CharT>): Delegate to __formatter_ptr<_CharT>. * include/std/thread (std::formatter<thread::id, _CharT>): Constrain _CharT template parameter. (formatter<thread::id, _CharT>::parse): Specify default aligment, and qualify __throw_format_error to disable ADL. (formatter<thread::id, _CharT>::format): Use formatters to write directly to output. * testsuite/30_threads/thread/id/output.cc: Tests for formatting thread::id representing not-a-thread with padding and formattable concept. Reviewed-by: Jonathan Wakely <jwakely@redhat.com> Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2025-04-25libstdc++: Define __cpp_lib_format_ranges in format header [PR109162]Tomasz Kamiński7-10/+17
As P2286R8 and P2585R1 as now fully implemented, we now define __cpp_lib_format_ranges feature test macro with __cpp_lib_format_ranges. This macro is provided only in <format>. Uses of internal __glibcxx_format_ranges are also updated. PR libstdc++/109162 libstdc++-v3/ChangeLog: * include/bits/version.def (format_ranges): Remove no_stdname and update value. * include/bits/version.h: Regenerate. * src/c++23/std.cc.in: Replace __glibcxx_format_ranges with __cpp_lib_format_ranges. * testsuite/std/format/formatter/lwg3944.cc: Likewise. * testsuite/std/format/parse_ctx.cc: Likewise. * testsuite/std/format/string.cc: Likewise. * testsuite/std/format/ranges/feature_test.cc: New test. Reviewed-by: Jonathan Wakely <jwakely@redhat.com> Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2025-04-25libstdc++: Implement formatters for queue, priority_queue and stack [PR109162]Tomasz Kamiński7-74/+387
This patch implements formatter specializations for standard container adaptors (queue, priority_queue and stack) from P2286R8. To be able to access the protected `c` member, the adaptors befriend corresponding formatter specializations. Note that such specialization may be disable if the container is formattable, in such case specializations are unharmful. As in the case of previous commits, the signatures of the user-facing parse and format methods of the provided formatters deviate from the standard by constraining types of parameters: * _CharT is constrained __formatter::__char * basic_format_parse_context<_CharT> for parse argument * basic_format_context<_Out, _CharT> for format second argument The standard specifies all above as unconstrained types. In particular _CharT constrain, allow us to befriend all allowed specializations. Furthermore the standard specifies these formatters as delegating to formatter<ranges::ref_view<const? _Container>, charT>, which in turn delegates to range_formatter. This patch avoids one level of indirection, and dependency of ranges::ref_view. This is technically observable if user specializes formatter<std::ref_view<PD>> where PD is program defined container, but I do not think this is the case worth extra indirection. This patch also moves the formattable and it's dependencies to the formatfwd.h, so it can be used in adapters formatters, without including format header. The definition of _Iter_for is changed from alias to denoting back_insert_iterator<basic_string<_CharT>>, to struct with type nested typedef that points to same type, that is forward declared. PR libstdc++/109162 libstdc++-v3/ChangeLog: * include/bits/formatfwd.h (__format::__parsable_with) (__format::__formattable_with, __format::__formattable_impl) (__format::__has_debug_format, __format::__const_formattable_range) (__format::__maybe_const_range, __format::__maybe_const) (std::formattable): Moved from std/format. (__format::Iter_for, std::range_formatter): Forward declare. * include/bits/stl_queue.h (std::formatter): Forward declare. (std::queue, std::priority_queue): Befriend formatter specializations. * include/bits/stl_stack.h (std::formatter): Forward declare. (std::stack): Befriend formatter specializations. * include/std/format (__format::_Iter_for): Define as struct with (__format::__parsable_with, __format::__formattable_with) (__format::__formattable_impl, __format::__has_debug_format) (_format::__const_formattable_range, __format::__maybe_const_range) (__format::__maybe_const, std::formattable): Moved to bits/formatfwd.h. (std::range_formatter): Remove default argument specified in declaration in bits/formatfwd.h. * include/std/queue: Include bits/version.h before bits/stl_queue.h. (formatter<queue<_Tp, _Container, _Compare>, _CharT>) (formatter<priority_queue<_Tp, _Container, _Compare>, _CharT>): Define. * include/std/stack: Include bits/version.h before bits/stl_stack.h (formatter<stack<_Tp, _Container, _Compare>, _CharT>): Define. * testsuite/std/format/ranges/adaptors.cc: New test. Reviewed-by: Jonathan Wakely <jwakely@redhat.com> Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2025-04-25OpenMP, GCN: Add interop-hsa testcaseAndrew Stubbs1-0/+203
This testcase ensures that the interop HSA support is sufficient to run a kernel manually on the same device. libgomp/ChangeLog: * testsuite/libgomp.c/interop-hsa.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-25libstdc++: Improve diagnostics for std::packaged_task invocable checksJonathan Wakely3-41/+38
Moving the static_assert that checks is_invocable_r_v into _Task_state means it is checked when we instantiate that class template. Replacing the __create_task_state function with a static member function _Task_state::_S_create ensures we instantiate _Task_state and trigger the static_assert immediately, not deep inside the implementation of std::allocate_shared. This results in shorter diagnostics that don't show deeply-nested template instantiations before the static_assert failure. Placing the static_assert at class scope also helps us to fail earlier than waiting until when the _Task_state::_M_run virtual function is instantiated. That also makes the diagnostics shorter and easier to read (although for C++11 and C++14 modes the class-scope static_assert doesn't check is_invocable_r, so dangling references aren't detected until _M_run is instantiated). libstdc++-v3/ChangeLog: * include/std/future (__future_base::_Task_state): Check invocable requirement here. (__future_base::_Task_state::_S_create): New static member function. (__future_base::_Task_state::_M_reset): Use _S_create. (__create_task_state): Remove. (packaged_task): Use _Task_state::_S_create instead of __create_task_state. * testsuite/30_threads/packaged_task/cons/dangling_ref.cc: Adjust dg-error patterns. * testsuite/30_threads/packaged_task/cons/lwg4154_neg.cc: Likewise. Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
2025-04-25libstdc++: Add _M_key_compare helper to associative containersJonathan Wakely1-57/+49
In r10-452-ge625ccc21a91f3 I noted that we don't have an accessor for invoking _M_impl._M_key_compare in the associative containers. That meant that the static assertions to check for valid comparison functions were squirrelled away in _Rb_tree::_S_key instead. As Jason noted in https://gcc.gnu.org/pipermail/gcc-patches/2025-April/681436.html this means that the static assertions fail later than we'd like. This change adds a new _Rb_tree::_M_key_compare member function which invokes the _M_impl._M_key_compare function object, and then moves the static_assert from _S_key into _M_key_compare. Now if the static_assert fails, that's the first error we get, before the "no match for call" and and "invalid conversion" errors. Because the new function is const-qualified, we now treat LWG 2542 as a DR for older standards, requiring the comparison function to be const invocable. Previously we only enforced the LWG 2542 rule for C++17 and later. I did consider deprecating support for comparisons which aren't const invocable, something like this: // Before LWG 2542 it wasn't strictly necessary for _Compare to be // const invocable, if you only used non-const container members. // Define a non-const overload for pre-C++17, deprecated for C++11/14. #if __cplusplus < 201103L bool _M_key_compare(const _Key& __k1, const _Key& __k2) { return _M_impl._M_key_compare(__k1, __k2); } #elif __cplusplus < 201703L template<typename _Key1, typename _Key2> [[__deprecated__("support for comparison functions that are not " "const invocable is deprecated")]] __enable_if_t< __and_<__is_invocable<_Compare&, const _Key1&, const _Key2&>, __not_<__is_invocable<const _Compare&, const _Key1&, const _Key2&>>>::value, bool> _M_key_compare(const _Key1& __k1, const _Key2& __k2) { static_assert( __is_invocable<_Compare&, const _Key&, const _Key&>::value, "comparison object must be invocable with two arguments of key type" ); return _M_impl._M_key_compare(__k1, __k2); } #endif But I decided that this isn't necessary, because we've been enforcing the C++17 rule since GCC 8.4 and 9.2, and C++17 has been the default since GCC 11.1. Users have had plenty of time to fix their invalid comparison functions. libstdc++-v3/ChangeLog: * include/bits/stl_tree.h (_Rb_tree::_M_key_compare): New member function to invoke comparison function. (_Rb_tree): Use new member function instead of accessing the comparison function directly. Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
2025-04-25GCN, nvptx offloading: Host/device compatibility: Itanium C++ ABI, DSO ↵Thomas Schwinge8-3/+363
Object Destruction API [PR119853, PR119854] '__dso_handle' for '__cxa_atexit', '__cxa_finalize'. See <https://itanium-cxx-abi.github.io/cxx-abi/abi.html#dso-dtor>. PR target/119853 PR target/119854 libgcc/ * config/gcn/crt0.c (_fini_array): Call '__GCC_offload___cxa_finalize'. * config/nvptx/gbl-ctors.c (__static_do_global_dtors): Likewise. libgomp/ * target-cxa-dso-dtor.c: New. * config/accel/target-cxa-dso-dtor.c: Likewise. * Makefile.am (libgomp_la_SOURCES): Add it. * Makefile.in: Regenerate. * testsuite/libgomp.c++/target-cdtor-1.C: New. * testsuite/libgomp.c++/target-cdtor-2.C: Likewise.
2025-04-25Add 'libgomp.c-c++-common/target-cdtor-1.c'Thomas Schwinge1-0/+89
libgomp/ * testsuite/libgomp.c-c++-common/target-cdtor-1.c: New.
2025-04-25GCN: Properly switch sections in 'gcn_hsa_declare_function_name' [PR119737]Andrew Pinski5-15/+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-25Adjust 'libgomp.c++/target-exceptions-pr118794-1.C' for ↵Thomas Schwinge3-6/+12
'targetm.arm_eabi_unwinder' [PR118794] Fix-up for commit aa3e72f943032e5f074b2bd2fd06d130dda8760b "Add test cases for exception handling constructs in dead code for GCN, nvptx target and OpenMP 'target' offloading [PR118794]": we need to adjust for configurations with 'targetm.arm_eabi_unwinder', as per: gcc/config/arm/arm.cc:#define TARGET_ARM_EABI_UNWINDER true gcc/config/c6x/c6x.cc:#define TARGET_ARM_EABI_UNWINDER true ..., which for ARM is conditional to '#if ARM_UNWIND_INFO' (defined in 'gcc/config/arm/bpabi.h', used for various GCC configurations), and for C6x unconditional. This gets us: --- target-exceptions-pr118794-1.C.269t.optimized +++ target-exceptions-pr118794-1.C.270t.optimized [...] __attribute__((omp declare target)) void f () [...] gimple_call <__dt_comp , NULL, &c> - gimple_call <__builtin_eh_pointer, _7, 2> - gimple_call <__builtin_unwind_resume, NULL, _7> + gimple_call <__builtin_cxa_end_cleanup, NULL> } [...] PR target/118794 libgomp/ * testsuite/libgomp.c++/target-exceptions-pr118794-1.C: Adjust for 'targetm.arm_eabi_unwinder'. * testsuite/libgomp.c++/target-exceptions-pr118794-1-offload-sorry-GCN.C: Likewise. * testsuite/libgomp.c++/target-exceptions-pr118794-1-offload-sorry-nvptx.C: Likewise.
2025-04-25Adjust gcc_release for id href web transformationsJakub Jelinek1-1/+1
We now have some script which transforms e.g. <h2 id="15.1">GCC 15.1</h2> line in gcc-15/changes.html to <h2 id="15.1"><a href="#15.1">GCC 15.1</a></h2> This unfortunately breaks the gcc_release script, which looks for GCC 15.1 appearing in gennews after optional blanks from the start of the line in the NEWS file, which is no longer the case, there is [129]GCC 15.1 or something like that with an URL later on 129. https://gcc.gnu.org/gcc-15/changes.html#15.1 The following patch handles this. 2025-04-25 Jakub Jelinek <jakub@redhat.com> * gcc_release: Allow optional \[[0-9]+\] before GCC major.minor in the NEWS file.
2025-04-25Update gennews for GCC 15.Jakub Jelinek1-0/+1
2025-04-25 Jakub Jelinek <jakub@redhat.com> * gennews (files): Add files for GCC 15.
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 Administrator12-1/+440
2025-04-24libstdc++: Remove unnecessary dg-prune-output from testsJonathan Wakely4-4/+0
There are no errors matching this pattern in these tests (only in the deque/48101_neg.cc and vector/48101_neg.cc tests). libstdc++-v3/ChangeLog: * testsuite/23_containers/forward_list/48101_neg.cc: Remove dg-prune-output that doesn't match anything. * testsuite/23_containers/list/48101_neg.cc: Likewise. * testsuite/23_containers/multiset/48101_neg.cc: Likewise. * testsuite/23_containers/set/48101_neg.cc: Likewise.
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.
2025-04-24libstdc++: Add lvalue overload for generator::yield_valueJonathan Wakely2-0/+67
This was approved in Wrocław as LWG 3899. This avoids creating a new coroutine frame to co_yield the elements of an lvalue generator. libstdc++-v3/ChangeLog: * include/std/generator (generator::yield_value): Add overload taking lvalue element_of view, as per LWG 3899. * testsuite/24_iterators/range_generators/lwg3899.cc: New test. Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com> Reviewed-by: Arsen Arsenović <arsen@aarsen.me>
2025-04-24PR modula2/115276: libgm2 wraptime.cc field access all return -1.Gaius Mulley4-66/+462
This patch provides autoconf tests for each field used in wraptime.cc referencing struct tm and struct timeval. libgm2/ChangeLog: PR modula2/115276 * config.h.in: Regenerate. * configure: Regenerate. * configure.ac (AC_STRUCT_TIMEZONE): Add. (AC_CHECK_MEMBER): Test for struct tm.tm_year. (AC_CHECK_MEMBER): Test for struct tm.tm_mon. (AC_CHECK_MEMBER): Test for struct tm.tm_mday. (AC_CHECK_MEMBER): Test for struct tm.tm_hour. (AC_CHECK_MEMBER): Test for struct tm.tm_min. (AC_CHECK_MEMBER): Test for struct tm.tm_sec. (AC_CHECK_MEMBER): Test for struct tm.tm_year. (AC_CHECK_MEMBER): Test for struct tm.tm_yday. (AC_CHECK_MEMBER): Test for struct tm.tm_wday. (AC_CHECK_MEMBER): Test for struct tm.tm_isdst. (AC_CHECK_MEMBER): Test for struct timeval.tv_sec. (AC_CHECK_MEMBER): Test for struct timeval.tv_sec. (AC_CHECK_MEMBER): Test for struct timeval.tv_usec. * libm2iso/wraptime.cc (InitTimeval): Guard against lack struct timeval and malloc. (InitTimezone): Guard against lack of struct tm.tm_zone and malloc. (KillTimezone): Ditto. (InitTimeval): Guard against lack of struct timeval and malloc. (KillTimeval): Guard against lack of malloc. (settimeofday): Guard against lack of struct tm.tm_zone. (GetFractions): Guard against lack of struct timeval. (localtime_r): Ditto. (GetYear): Guard against lack of struct tm. (GetMonth): Ditto. (GetDay): Ditto. (GetHour): Ditto. (GetMinute): Ditto. (GetSecond): Ditto. (GetSummerTime): Ditto. (GetDST): Guards against lack of struct timezone. (SetTimezone): Ditto. (SetTimeval): Guard against lack of struct tm. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2025-04-24cobol: Repair some exception processing logic.Robert Dubner3-589/+295
This patch changes the exception processing logic for the calculation of reference modifications and table subscripts to be more in accordance with ISO specifications. It also adjusts the processing of RETURN-CODE when calling routines that have no CALL ... RETURNING phrase. gcc/cobol * genapi.cc: (initialize_variable_internal): Change TRACE1 formatting. (create_and_call): Repair RETURN-CODE processing. (mh_source_is_group): Repair run-time IF type comparison. (psa_FldLiteralA): Change TRACE1 formatting. (parser_symbol_add): Eliminate unnecessary code. * genutil.cc: Eliminate SET_EXCEPTION_CODE macro. (get_data_offset_dest): Repair set_exception_code logic. (get_data_offset_source): Likewise. (get_binary_value): Likewise. (refer_refmod_length): Likewise. (refer_fill_depends): Likewise. (refer_offset_dest): Likewise. (refer_size_dest): Likewise. (refer_offset_source): Likewise. gcc/testsuite * cobol.dg/group1/declarative_1.cob: Adjust for repaired exception logic.
2025-04-24Fix i386 vectorizer cost of COND_EXPR and MIN_MAX with one of parameters 0 or -1Jan Hubicka2-8/+48
gcc/ChangeLog: PR target/119919 * config/i386/i386.cc (ix86_vector_costs::add_stmt_cost): Account correctly cond_expr and min/max when one of operands is 0 or -1. gcc/testsuite/ChangeLog: * gcc.target/i386/pr119919.c: New test.
2025-04-24Fix ICE building deepsjeng with -fprofile-useJan Hubicka1-4/+4
The problem here is division by zero, since adjusted 0 > precise 0. Fixed by using right test. gcc/ChangeLog: PR ipa/119924 * ipa-cp.cc (update_counts_for_self_gen_clones): Use nonzero_p. (update_profiling_info): Likewise. (update_specialized_profile): Likewise.
2025-04-24libgomp/testsuite: Fix hip_header_nvidia check, add workaround to testTobias Burnus4-4/+16
This is all about using the AMD's HIP header files with __HIP_PLATFORM_NVIDIA__ defined, i.e. HIP with Nvidia/CUDA; in that case, HIP is a thin layer on top of CUDA. First, the check_effective_target_gomp_hip_header_nvidia check failed; to fix it, -Wno-deprecated-declarations was added - and likewise to the two affected testcases that actually used the HIP headers on Nvidia. Doing so, the HIP tested was successful but the HIP-BLAS one showed two issues: * One seems to be related to include search paths as the HIP header uses #include "library_types.h" to include that CUDA header. Seemingly, it tried to included (again) the HIP header hip/library_types.h, not the CUDA one. I guess, some tweaking of -isystem vs. -I could have prevented this, but the simpler workaround was to just explicitly include the CUDA one before the HIP header files. * Once done, everything compiled but linking failed as the association between three HIP-BLAS functions and their CUDA-BLAS ones did not work. Solution: Just add three #define for mapping them. libgomp/ChangeLog: * testsuite/lib/libgomp.exp (check_effective_target_gomp_hip_header_nvidia): Compile with "-Wno-deprecated-declarations". * testsuite/libgomp.c/interop-hip-nvidia-full.c: Likewise. * testsuite/libgomp.c/interop-hipblas-nvidia-full.c: Likewise. * testsuite/libgomp.c/interop-hipblas.h: Add workarounds when using the HIP headers with __HIP_PLATFORM_NVIDIA__.
2025-04-24libstdc++: Add std::deque<>::shrink_to_fit testFrançois Dumont2-6/+40
The existing test is currently testing std::vector. Adapt it for std::deque. libstdc++-v3/ChangeLog: * testsuite/util/replacement_memory_operators.h: Adapt for -fno-exceptions context. * testsuite/23_containers/deque/capacity/shrink_to_fit.cc: Adapt test to check std::deque shrink_to_fit method. Reviewed-by: Jonathan Wakely <jwakely@redhat.com> Reviewed-by: Tomasz Kaminski <tkaminsk@redhat.com>
2025-04-24c++: attribute duplication [PR116954]Jason Merrill1-0/+3
As a followup to the previous patch for 116954, there's no reason to do anything in remove_contract_attributes if contracts aren't enabled. PR c++/116954 gcc/cp/ChangeLog: * contracts.cc (remove_contract_attributes): Return early if not enabled.
2025-04-24aarch64: Fix CFA offsets in non-initial stack probes [PR119610]Richard Sandiford3-26/+78
PR119610 is about incorrect CFI output for a stack probe when that probe is not the initial allocation. The main aarch64 stack probe function, aarch64_allocate_and_probe_stack_space, implicitly assumed that the incoming stack pointer pointed to the top of the frame, and thus held the CFA. aarch64_save_callee_saves and aarch64_restore_callee_saves use a parameter called bytes_below_sp to track how far the stack pointer is above the base of the static frame. This patch does the same thing for aarch64_allocate_and_probe_stack_space. Also, I noticed that the SVE path was attaching the first CFA note to the wrong instruction: it was attaching the note to the calculation of the stack size, rather than to the r11<-sp copy. gcc/ PR target/119610 * config/aarch64/aarch64.cc (aarch64_allocate_and_probe_stack_space): Add a bytes_below_sp parameter and use it to calculate the CFA offsets. Attach the first SVE CFA note to the move into the associated temporary register. (aarch64_allocate_and_probe_stack_space): Update calls accordingly. Start out with bytes_per_sp set to the frame size and decrement it after each allocation. gcc/testsuite/ PR target/119610 * g++.dg/torture/pr119610.C: New test. * g++.target/aarch64/sve/pr119610-sve.C: Likewise.