aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2024-09-28doc: Remove i?86-*-linux* installation note from 2003Gerald Pfeifer1-3/+0
gcc: PR target/69374 * doc/install.texi (Specific) <i?86-*-linux*>: Remove note from 2003.
2024-09-28Daily bump.GCC Administrator9-1/+308
2024-09-28c++: Implement resolution for DR 36 [PR116160]Nathaniel Shead4-7/+18
This implements part of P1787 to no longer complain about redeclaring an entity via using-decl other than in a class scope. PR c++/116160 gcc/cp/ChangeLog: * name-lookup.cc (supplement_binding): Allow redeclaration via USING_DECL if not in class scope. (do_nonmember_using_decl): Remove function-scope exemption. (push_using_decl_bindings): Remove outdated comment. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/using-enum-3.C: No longer expect an error. * g++.dg/lookup/using53.C: Remove XFAIL. * g++.dg/cpp2a/using-enum-11.C: New test. Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com> Reviewed-by: Jason Merrill <jason@redhat.com>
2024-09-28c++: Don't strip USING_DECLs when updating local bindings [PR116748]Nathaniel Shead3-7/+19
Currently update_binding strips USING_DECLs too eagerly, leading to ICEs in pop_local_decl as it can't find the decl it's popping in the binding list. Let's rather try to keep the original USING_DECL around. This also means that using59.C can point to the location of the using-decl rather than the underlying object directly; this is in the direction required to fix PR c++/106851 (though more work is needed to emit properly helpful diagnostics here). PR c++/116748 gcc/cp/ChangeLog: * name-lookup.cc (update_binding): Maintain USING_DECLs in the binding slots. gcc/testsuite/ChangeLog: * g++.dg/lookup/using59.C: Update location. * g++.dg/lookup/using69.C: New test. Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com> Reviewed-by: Jason Merrill <jason@redhat.com>
2024-09-28c++/modules: Propagate purview/import for templates in duplicate_decls ↵Nathaniel Shead4-0/+41
[PR116803] We need to ensure that for a declaration in the module purview, that the resulting declaration has PURVIEW_P set and IMPORT_P cleared so that we understand it might be something requiring exporting. This is normally handled for a declaration by set_instantiating_module, but when this declaration is a redeclaration duplicate_decls needs to propagate this to olddecl. This patch only changes the logic for template declarations, because in the non-template case the whole contents of olddecl's DECL_LANG_SPECIFIC is replaced with newdecl's (which includes these flags), so there's nothing to do. PR c++/116803 gcc/cp/ChangeLog: * decl.cc (duplicate_decls): Propagate DECL_MODULE_PURVIEW_P and DECL_MODULE_IMPORT_P for template redeclarations. gcc/testsuite/ChangeLog: * g++.dg/modules/merge-18_a.H: New test. * g++.dg/modules/merge-18_b.H: New test. * g++.dg/modules/merge-18_c.C: New test. Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com> Reviewed-by: Jason Merrill <jason@redhat.com>
2024-09-27libstdc++: Fix more pedwarns in headers for C++98Jonathan Wakely17-15/+97
Some tests e.g. 17_intro/headers/c++1998/all_pedantic_errors.cc FAIL with GLIBCXX_TESTSUITE_STDS=98 due to numerous C++11 extensions still in use in the library headers. The recent changes to not make them system headers means we get warnings now. This change adds more diagnostic pragmas to suppress those warnings. libstdc++-v3/ChangeLog: * include/bits/istream.tcc: Add diagnostic pragmas around uses of long long and extern template. * include/bits/locale_facets.h: Likewise. * include/bits/locale_facets.tcc: Likewise. * include/bits/locale_facets_nonio.tcc: Likewise. * include/bits/ostream.tcc: Likewise. * include/bits/stl_algobase.h: Likewise. * include/c_global/cstdlib: Likewise. * include/ext/pb_ds/detail/resize_policy/hash_prime_size_policy_imp.hpp: Likewise. * include/ext/pointer.h: Likewise. * include/ext/stdio_sync_filebuf.h: Likewise. * include/std/istream: Likewise. * include/std/ostream: Likewise. * include/tr1/cmath: Likewise. * include/tr1/type_traits: Likewise. * include/tr1/functional_hash.h: Likewise. Remove semi-colons at namespace scope that aren't needed after macro expansion. * include/tr1/tuple: Remove semi-colon at namespace scope. * include/bits/vector.tcc: Change LL suffix to just L.
2024-09-27libstdc++: Refactor experimental::filesystem::path string conversionsJonathan Wakely1-84/+53
I noticed a -Wc++17-extensions warning due to use of if-constexpr in std::experimental::filesystem::path, which was not protected by diagnostic pragmas to disable the warning. While adding the pragmas I noticed that other places in the same file use tag dispatching and multiple overloads instead of if-constexpr. Since we're already using it in that file, we might as well just use it everywhere. libstdc++-v3/ChangeLog: * include/experimental/bits/fs_path.h (path::_Cvt): Refactor to use if-constexpr. (path::string(const Allocator&)): Likewise.
2024-09-27libstdc++: Fix -Wsign-compare warning in std::string::resize_for_overwriteJonathan Wakely2-2/+2
libstdc++-v3/ChangeLog: * include/bits/basic_string.tcc (resize_for_overwrite): Fix -Wsign-compare warning. * include/bits/cow_string.h (resize_for_overwrite): Likewise.
2024-09-27c++: ICE with structured bindings and m-d array [PR102594]Marek Polacek2-1/+35
We ICE in decay_conversion with this test: struct S { S() {} }; S arr[1][1]; auto [m](arr3); But not when the last line is: auto [n] = arr3; Therefore the difference is between copy- and direct-init. In particular, in build_vec_init we have: if (direct_init) from = build_tree_list (NULL_TREE, from); and then we call build_vec_init again with init==from. Then decay_conversion gets the TREE_LIST and it crashes. build_aggr_init has: /* Wrap the initializer in a CONSTRUCTOR so that build_vec_init recognizes it as direct-initialization. */ init = build_constructor_single (init_list_type_node, NULL_TREE, init); CONSTRUCTOR_IS_DIRECT_INIT (init) = true; so I propose to do the same in build_vec_init. PR c++/102594 gcc/cp/ChangeLog: * init.cc (build_vec_init): Build up a CONSTRUCTOR to signal direct-initialization rather than a TREE_LIST. gcc/testsuite/ChangeLog: * g++.dg/cpp1z/decomp61.C: New test. Reviewed-by: Jason Merrill <jason@redhat.com>
2024-09-27libstdc++: Fix test FAILs due to -Wreturn-local-addrJonathan Wakely2-0/+2
This fixes two FAILs due to -Wpointer-arith warnings when testing with c++11 or c++14 dialects. libstdc++-v3/ChangeLog: * testsuite/20_util/bind/dangling_ref.cc: Add an additional dg-warning for -Wreturn-local-addr warning. * testsuite/30_threads/packaged_task/cons/dangling_ref.cc: Likewise.
2024-09-27libstdc++: Fix test FAIL due to -Wpointer-arithJonathan Wakely3-34/+32
This fixes a FAIL due to a -Wpointer-arith warning when testing with c++11 or c++14 dialects. As an extension our std::atomic<void*> supports pointer arithmetic in C++11 and C++14, but due to the system header changes there is now a warning about it. The warning seems reasonable, so rather than suppress it we should make the test expect it. While looking into this I decided to simplify some of the code related to atomic<T*> arithmetic. libstdc++-v3/ChangeLog: * include/bits/atomic_base.h (__atomic_base<T*>::_M_type_size): Replace overloaded functions with static _S_type_size. * include/std/atomic (atomic<T*>): Use is_object_v instead of is_object. * testsuite/29_atomics/atomic/operators/pointer_partial_void.cc: Add dg-warning for -Wpointer-arith warning.
2024-09-27aarch64: fix build failure on aarch64-none-elfMatthieu Longo1-1/+1
A previous patch ([1]) introduced a build regression on aarch64-none-elf target. The changes were primarilly tested on aarch64-unknown-linux-gnu, so the issue was missed during development. The includes are slighly different between the two targets, and due to some include rules ([2]), "aarch64-unwind-def.h" was not found. [1]: https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=bdf41d627c13bc5f0dc676991f4513daa9d9ae36 [2]: https://gcc.gnu.org/onlinedocs/cpp/Include-Syntax.html > include "file" > ... It searches for a file named file first in the directory > containing the current file, ... libgcc/ChangeLog: * config/aarch64/aarch64-unwind.h: Fix header path.
2024-09-27diagnostic: Save/restore diagnostic context history and push/pop state for ↵Jakub Jelinek5-1/+80
PCH [PR116847] The following patch on top of the just posted cleanup patch saves/restores the m_classification_history and m_push_list vectors for PCH. Without that as the testcase shows during parsing of the templates we don't report ignored diagnostics, but after loading PCH header when instantiating those templates those warnings can be emitted. This doesn't show up on x86_64-linux build because configure injects there -fcf-protection -mshstk flags during library build (and so also during PCH header creation), but make check doesn't use those flags and so the PCH header is ignored. 2024-09-26 Jakub Jelinek <jakub@redhat.com> PR libstdc++/116847 gcc/ * diagnostic.h (diagnostic_option_classifier): Add pch_save and pch_restore method declarations. (diagnostic_context): Add pch_save and pch_restore inline method definitions. * diagnostic.cc (diagnostic_option_classifier::pch_save): New method. (diagnostic_option_classifier::pch_restore): Likewise. gcc/c-family/ * c-pch.cc: Include diagnostic.h. (c_common_write_pch): Call global_dc->pch_save. (c_common_read_pch): Call global_dc->pch_restore. gcc/testsuite/ * g++.dg/pch/pr116847.C: New test. * g++.dg/pch/pr116847.Hs: New test.
2024-09-27diagnostic: Use vec instead of custom array reallocations for ↵Jakub Jelinek2-46/+30
m_classification_history/m_push_list [PR116847] diagnostic.h already relies on vec.h, it uses auto_vec in one spot. The following patch converts m_classification_history and m_push_list hand-managed arrays to vec templates. The main advantage is exponential rather than linear reallocation, e.g. with current libstdc++ headers if one includes all the standard headers there could be ~ 300 reallocations of the m_classification_history array (sure, not all of them will result in actually copying the data, but still). In addition to that it fixes some formatting issues in the code. 2024-09-26 Jakub Jelinek <jakub@redhat.com> PR libstdc++/116847 * diagnostic.h (diagnostic_option_classifier): Change type of m_classification_history from diagnostic_classification_change_t * to vec<diagnostic_classification_change_t>. Change type of m_push_list from int * to vec<int>. Remove m_n_classification_history and m_n_push members. * diagnostic.cc (diagnostic_option_classifier::init): Set m_push_list to vNULL rather than nullptr. Don't initialize m_n_push. Initialize m_classification_history to vNULL. (diagnostic_option_classifier::fini): Call release () method on m_push_list instead of free on it. Call release () on m_classification_history. Don't clear m_n_push. (diagnostic_option_classifier::push): Adjust for m_push_list and m_classification_history being vectors rather than custom allocated arrays with counter. (diagnostic_option_classifier::pop): Likewise. (classify_diagnostic): Adjust for m_classification_history being vector rather than custom allocated array with counter. (update_effective_level_from_pragmas): Likewise.
2024-09-27i386: Modernize AMD processor typesUros Bizjak2-41/+37
Use iterative PTA definitions for members of the same AMD processor family. Also, fix a couple of related M_CPU_TYPE/M_CPU_SUBTYPE inconsistencies. No functional changes intended. gcc/ChangeLog: * config/i386/i386.h: Add PTA_BDVER1, PTA_BDVER2, PTA_BDVER3, PTA_BDVER4, PTA_BTVER1 and PTA_BTVER2. * common/config/i386/i386-common.cc (processor_alias_table) <"bdver1">: Use PTA_BDVER1. <"bdver2">: Use PTA_BDVER2. <"bdver3">: Use PTA_BDVER3. <"bdver4">: Use PTA_BDVER4. <"btver1">: Use PTA_BTVER1. Use M_CPU_TYPE (AMD_BTVER1). <"btver2">: Use PTA_BTVER2. <"shanghai>: Use M_CPU_SUBTYPE (AMDFAM10H_SHANGHAI). <"istanbul>: Use M_CPU_SUBTYPE (AMDFAM10H_ISTANBUL).
2024-09-27Widening-Mul: Fix one ICE when iterate on phi nodePan Li2-2/+83
We iterate all phi node of bb to try to match the SAT_* pattern for scalar integer. We also remove the phi mode when the relevant pattern matched. Unfortunately the iterator may have no idea the phi node is removed and continue leverage the free data and then ICE similar as below. [0] psi ptr 0x75216340c000 [0] psi ptr 0x75216340c400 [1] psi ptr 0xa5a5a5a5a5a5a5a5 <=== GC freed pointer. during GIMPLE pass: widening_mul tmp.c: In function ‘f’: tmp.c:45:6: internal compiler error: Segmentation fault 45 | void f(int rows, int cols) { | ^ 0x36e2788 internal_error(char const*, ...) ../../gcc/diagnostic-global-context.cc:517 0x18005f0 crash_signal ../../gcc/toplev.cc:321 0x752163c4531f ??? ./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0 0x103ae0e bool is_a_helper<gphi*>::test<gimple>(gimple*) ../../gcc/gimple.h:1256 0x103f9a5 bool is_a<gphi*, gimple>(gimple*) ../../gcc/is-a.h:232 0x103dc78 gphi* as_a<gphi*, gimple>(gimple*) ../../gcc/is-a.h:255 0x104f12e gphi_iterator::phi() const ../../gcc/gimple-iterator.h:47 0x1a57bef after_dom_children ../../gcc/tree-ssa-math-opts.cc:6140 0x3344482 dom_walker::walk(basic_block_def*) ../../gcc/domwalk.cc:354 0x1a58601 execute ../../gcc/tree-ssa-math-opts.cc:6312 This patch would like to fix the iterate on modified collection problem by backup the next phi in advance. The below test suites are passed for this patch. * The rv64gcv fully regression test. * The x86 bootstrap test. * The x86 fully regression test. PR middle-end/116861 gcc/ChangeLog: * tree-ssa-math-opts.cc (math_opts_dom_walker::after_dom_children): Backup the next psi iterator before remove the phi node. gcc/testsuite/ChangeLog: * gcc.dg/torture/pr116861-1.c: New test. Signed-off-by: Pan Li <pan2.li@intel.com>
2024-09-27Fix sorting in Contributors.htmlRichard Biener1-4/+4
The following moves my entry to where it belongs alphabetically (it wasn't moved when s/Guenther/Biener/). * doc/contrib.texi (Richard Biener): Move entry.
2024-09-27libgcc, Darwin: Don't build legacy libgcc_s.1 on macOS 14 [PR116809]Mark Mentovai1-1/+1
d9cafa0c4f0a stopped building libgcc_s.1 on macOS >= 15, in part because that is required to bootstrap the compiler using the macOS 15 SDK. The macOS 15 SDK ships in Xcode 16, which also runs on macOS 14. libgcc_s.1 can no longer be built on macOS 14 using Xcode 16 by the same logic that the previous change disabled it for macOS 15. PR target/116809 libgcc/ChangeLog: * config.host: Don't build legacy libgcc_s.1 on macOS 14. Signed-off-by: Mark Mentovai <mark@mentovai.com>
2024-09-27c++/coro: ignore cleanup_point_exprs while expanding awaits [PR116793]Arsen Arsenović2-1/+29
If we reach a CLEANUP_POINT_EXPR while trying to walk statements, we actually care about the statement or statement list contained within it. Indeed, such a construction started happening with r15-3513-g964577c31df206, after temporary promotion. In the test case presented in PR116793, the compiler generated: <<cleanup_point { struct _cleanup_task Aw0 [value-expr: frame_ptr->Aw0_2_3]; int T002 [value-expr: frame_ptr->T002_2_3]; int T002 [value-expr: frame_ptr->T002_2_3]; <<cleanup_point <<< Unknown tree: expr_stmt (void) (T002 = TARGET_EXPR <D.20994, 3>) >>>>>; struct _cleanup_task Aw0 [value-expr: frame_ptr->Aw0_2_3]; <<cleanup_point <<< Unknown tree: expr_stmt (void) (Aw0 = TARGET_EXPR <D.20995, func ((int &) &T002)>) >>>>>; <<cleanup_point <<< Unknown tree: expr_stmt (void) (D.22450 = <<< Unknown tree: co_await TARGET_EXPR <D.20995, func ((int &) &T002)> Aw0 {_cleanup_task::await_ready (&Aw0), _cleanup_task::await_suspend<_task1::promise_type> (&Aw0, TARGET_EXPR <D.21078, _Coro_self_handle>), <<< Unknown tree: aggr_init_expr 4 await_resume D.22443 &Aw0 >>>} 0 >>>) >>>>>; <<cleanup_point <<< Unknown tree: expr_stmt (void) (D.20991 = (struct tuple &) &D.22450) >>>>>; } D.22467 = 1; int & i [value-expr: frame_ptr->i_1_2]; <<cleanup_point <<< Unknown tree: expr_stmt (void) (i = std::get<0, int&> (NON_LVALUE_EXPR <D.20991>)) >>>>>;>>; ... i.e. a statement list within a cleanup point. In such a case, we don't actually care about the cleanup point, but we do care about the statement inside, so, we can just walk down into the CLEANUP_POINT_EXPR. PR c++/116793 gcc/cp/ChangeLog: * coroutines.cc (await_statement_expander): Just process subtrees if encountering a CLEANUP_POINT_EXPR. gcc/testsuite/ChangeLog: * g++.dg/coroutines/pr116793-1.C: New test.
2024-09-27c++: simplify handling implicit INDIRECT_REF and co_await in convert_to_voidArsen Arsenović4-53/+132
convert_to_void has, so far, when converting a co_await expression to void altered the await_resume expression of a co_await so that it is also converted to void. This meant that the type of the await_resume expression, which is also supposed to be the type of the whole co_await expression, was not the same as the type of the CO_AWAIT_EXPR tree. While this has not caused problems so far, it is unexpected, I think. Also, convert_to_void had a special case when an INDIRECT_REF wrapped a CALL_EXPR. In this case, we also diagnosed maybe_warn_nodiscard. This was a duplication of logic related to converting call expressions to void. Instead, we can generalize a bit, and rather discard the expression that was implicitly dereferenced instead. This patch changes the diagnostic of: void f(struct S* x) { static_cast<volatile S&>(*x); } ... from: warning: indirection will not access object of incomplete type 'volatile S' in statement ... to: warning: implicit dereference will not access object of type ‘volatile S’ in statement ... but should have no impact in other cases. gcc/cp/ChangeLog: * coroutines.cc (co_await_get_resume_call): Return a tree directly, rather than a tree pointer. * cp-tree.h (co_await_get_resume_call): Adjust signature accordingly. * cvt.cc (convert_to_void): Do not alter CO_AWAIT_EXPRs when discarding them. Simplify handling implicit INDIRECT_REFs. gcc/testsuite/ChangeLog: * g++.dg/coroutines/nodiscard-1.C: New test.
2024-09-27c++/coro: prevent ICV_STATEMENT diagnostics in temp promotion [PR116502]Arsen Arsenović3-3/+75
If such a diagnostic is necessary, it has already been emitted, otherwise, it is not correct and emitting it here is inactionable by the user, and bogus. PR c++/116502 gcc/cp/ChangeLog: * coroutines.cc (maybe_promote_temps): Convert temporary initializers to void without complaining. gcc/testsuite/ChangeLog: * g++.dg/coroutines/maybe-unused-1.C: New test. * g++.dg/coroutines/pr116502.C: New test.
2024-09-27[MAINTAINERS]: Add myself as MVE Reviewer for the AArch32 (arm) portChristophe Lyon1-0/+1
ChangeLog: * MAINTAINERS: Add myself as MVE Reviewer for the AArch32 (arm) port.
2024-09-27libgomp.texi: Remove now duplicate TR13 itemTobias Burnus1-3/+1
Remove an item under "Other new TR 13 features" that since the last commit (r15-3917-g6b7eaec20b046e) to this file is is covered by the added "New @code{storage} map-type modifier; context-dependent @code{alloc} and @code{release} are aliases" "Update of the map-type decay for mapping and @code{declare_mapper}" libgomp/ * libgomp.texi (TR13 status): Update semi-duplicated, semi-obsoleted item; remove left-over half-sentence.
2024-09-27RISC-V/libgcc: Save/Restore routines for E goes with ABI.Jim Lin1-2/+2
That Save/Restore routines for E can be used for RVI with ILP32E ABI. libgcc/ChangeLog: * config/riscv/save-restore.S: Check with __riscv_abi_rve rather than __riscv_32e.
2024-09-27libgomp.texi: fix formatting; add post-TR13 OpenMP impl. status itemsTobias Burnus1-2/+6
libgomp/ * libgomp.texi (OpenMP Technical Report 13): Change @emph to @code; add two post-TR13 OpenMP 6.0 items.
2024-09-27tree-optimization/116818 - try VMAT_GATHER_SCATTER also for SLPRichard Biener1-14/+15
When not doing SLP and we end up with VMAT_ELEMENTWISE we consider using strided loads, aka VMAT_GATHER_SCATTER. The following moves this logic down to also apply to SLP where we now can end up using VMAT_ELEMENTWISE as well. PR tree-optimization/116818 * tree-vect-stmts.cc (get_group_load_store_type): Consider VMAT_GATHER_SCATTER instead of VMAT_ELEMENTWISE also for SLP. (vectorizable_load): For single-lane VMAT_GATHER_SCATTER also ignore permutations.
2024-09-27Fix bogus SLP nvector compute in check_load_store_for_partial_vectorsRichard Biener1-7/+3
We have a new overload for vect_get_num_copies that handles both SLP and non-SLP. Use it and avoid the division by group_size for SLP when not using load-store lanes. * tree-vect-stmts.cc (check_load_store_for_partial_vectors): Use the new vect_get_num_copies overload. Only divide by group_size for SLP for load-store lanes.
2024-09-27unswitch: Replace manual ondemand maybe_undef with ↵Andrew Pinski1-59/+2
ssa_name_maybe_undef_p/mark_ssa_maybe_undefs [PR116848] The ondemand maybe_undef that follows phis was added in r7-6427-g8b670f93ab1136 but then later ssa_name_maybe_undef_p/mark_ssa_maybe_undefs was added in r13-972-gbe2861fe8c527a. This moves the ondemand one to use mark_ssa_maybe_undefs/ssa_name_maybe_undef_p instead. Which itself will be faster since the mark_ssa_maybe_undefs is a walk based on the uses of undefined names (and only once) rather than a walk based on the def of ones which are more likely defined (and on demand). Even though the ondemand maybe_undef had some extra special cases, those won't make a big difference in most code. Bootstrapped and tested on x86_64-linux-gnu. PR tree-optimization/116848 gcc/ChangeLog: * tree-ssa-loop-unswitch.cc (tree_ssa_unswitch_loops): Call mark_ssa_maybe_undefs. (is_maybe_undefined): Call ssa_name_maybe_undef_p instead of ondemand undef. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2024-09-27c++/modules: Allow imported references in constant expressionsNathaniel Shead3-1/+23
Currently the streaming code uses TREE_CONSTANT to determine whether an entity will have a definition that is interesting to stream out. This is not sufficient, however; we also need to write the definition of references, since although not TREE_CONSTANT they can still be usable in constant expressions. As such this patch uses the existing decl_maybe_constant_var function which correctly handles this case. gcc/cp/ChangeLog: * module.cc (has_definition): Use decl_maybe_constant_var instead of TREE_CONSTANT. gcc/testsuite/ChangeLog: * g++.dg/modules/cexpr-5_a.C: New test. * g++.dg/modules/cexpr-5_b.C: New test. Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com> Reviewed-by: Jason Merrill <jason@redhat.com>
2024-09-27c++/modules: Fix linkage checks for exported using-declsNathaniel Shead7-41/+154
This fixes some inconsistencies with what kinds of linkage various entities are assumed to have. This also fixes handling of exported using-decls binding to GM entities and type aliases to better align with the standard's requirements. gcc/cp/ChangeLog: * name-lookup.cc (check_can_export_using_decl): Handle internal linkage GM entities (but ignore in header units); use linkage of entity ultimately referred to by aliases. gcc/testsuite/ChangeLog: * g++.dg/modules/using-10.C: Add tests for no-linkage, fix expected linkage of aliases. * g++.dg/modules/using-12.C: Likewise. * g++.dg/modules/using-27.C: New test. * g++.dg/modules/using-28_a.C: New test. * g++.dg/modules/using-28_b.C: New test. * g++.dg/modules/using-29.H: New test. Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com> Reviewed-by: Jason Merrill <jason@redhat.com>
2024-09-27c++/modules: Use decl_linkage in maybe_record_mergeable_declNathaniel Shead1-8/+1
This avoids any possible inconsistencies (current or future) about whether a declaration is internal or not. gcc/cp/ChangeLog: * name-lookup.cc (maybe_record_mergeable_decl): Use decl_linkage instead of ad-hoc checks. Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com> Reviewed-by: Jason Merrill <jason@redhat.com>
2024-09-27c++: Update decl_linkage for C++11Nathaniel Shead3-37/+60
Currently modules code uses a variety of ad-hoc methods to attempt to determine whether an entity has internal linkage, which leads to inconsistencies and some correctness issues as different edge cases are neglected. While investigating this I discovered 'decl_linkage', but it doesn't seem to have been updated to account for the C++11 clarification that all entities declared in an anonymous namespace are internal. I'm not convinced that even in C++98 it was intended that e.g. types in anonymous namespaces should be external, but some tests in the testsuite rely on this, so for compatibility I restricted those modifications to C++11 and later. This should have relatively minimal impact as not much seems to actually rely on decl_linkage, but does change the mangling of symbols in anonymous namespaces slightly. Previously, we had namespace { int x; // mangled as '_ZN12_GLOBAL__N_11xE' static int y; // mangled as '_ZN12_GLOBAL__N_1L1yE' } but with this patch the x is now mangled like y (with the extra 'L'). For contrast, Clang currently mangles neither x nor y with the 'L'. Since this only affects internal-linkage entities I don't believe this should break ABI in any observable fashion. gcc/cp/ChangeLog: * name-lookup.cc (do_namespace_alias): Propagate TREE_PUBLIC for namespace aliases. * tree.cc (decl_linkage): Update rules for C++11. gcc/testsuite/ChangeLog: * g++.dg/modules/mod-sym-4.C: Update test to account for non-static internal-linkage variables new mangling. Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com> Reviewed-by: Jason Merrill <jason@redhat.com>
2024-09-27testsuite/gfortran.dg/open_errors_2.f90: Remove now-redundant file deletionHans-Peter Nilsson1-1/+0
Now that fort.N files are removed by the testsuite framework, remove this single "manual" file deletion. (Also, it should have been "remote_file target delete", since it's the target that creates the file, not the build framework, which might matter to some setups.) * gfortran.dg/open_errors_2.f90: Remove now-redundant file deletion.
2024-09-27Daily bump.GCC Administrator9-1/+313
2024-09-27libstdc++: Add missing 'inline' to always_inline functionJonathan Wakely1-1/+1
This fixes a -Wattributes warning for the COW std::string which was previously suppressed due to being in a system header. libstdc++-v3/ChangeLog: * include/bits/cow_string.h (__resize_for_overwrite): Add inline keyword to function with always_inline attribute.
2024-09-27libgcc, libstdc++: Make declarations no longer TU-local [PR115126]Nathaniel Shead8-84/+137
In C++20, modules streaming check for exposures of TU-local entities. In general exposing internal linkage functions in a header is liable to cause ODR violations in C++, and this is now detected in a module context. This patch goes through and removes 'static' from many declarations exposed through libstdc++ to prevent code like the following from failing: export module M; extern "C++" { #include <bits/stdc++.h> } Since gthreads is used from C as well, we need to choose whether to use 'inline' or 'static inline' depending on whether we're compiling for C or C++ (since the semantics of 'inline' are different between the languages). Additionally we need to remove static global variables, so we migrate these to function-local statics to avoid the ODR issues. There doesn't seem to be a good workaround for weakrefs, so I've left them as-is and will work around it in the modules streaming code to consider them as not TU-local. The same issue occurs in the objective-C specific parts of gthreads, but I'm not familiar with the surrounding context and we don't currently test modules with Objective C++ anyway so I've left it as-is. PR libstdc++/115126 libgcc/ChangeLog: * gthr-posix.h (__GTHREAD_ALWAYS_INLINE): New macro. (__GTHREAD_INLINE): New macro. (__gthread_active): Convert from variable to (hidden) function. (__gthread_active_p): Mark as __GTHREAD_INLINE instead of static; make visibility("hidden") when it has a static local variable. (__gthread_trigger): Mark as __GTHREAD_INLINE instead of static. (__gthread_create): Likewise. (__gthread_join): Likewise. (__gthread_detach): Likewise. (__gthread_equal): Likewise. (__gthread_self): Likewise. (__gthread_yield): Likewise. (__gthread_once): Likewise. (__gthread_key_create): Likewise. (__gthread_key_delete): Likewise. (__gthread_getspecific): Likewise. (__gthread_setspecific): Likewise. (__gthread_mutex_init_function): Likewise. (__gthread_mutex_destroy): Likewise. (__gthread_mutex_lock): Likewise. (__gthread_mutex_trylock): Likewise. (__gthread_mutex_timedlock): Likewise. (__gthread_mutex_unlock): Likewise. (__gthread_recursive_mutex_init_function): Likewise. (__gthread_recursive_mutex_lock): Likewise. (__gthread_recursive_mutex_trylock): Likewise. (__gthread_recursive_mutex_timedlock): Likewise. (__gthread_recursive_mutex_unlock): Likewise. (__gthread_recursive_mutex_destroy): Likewise. (__gthread_cond_init_function): Likewise. (__gthread_cond_broadcast): Likewise. (__gthread_cond_signal): Likewise. (__gthread_cond_wait): Likewise. (__gthread_cond_timedwait): Likewise. (__gthread_cond_wait_recursive): Likewise. (__gthread_cond_destroy): Likewise. (__gthread_rwlock_rdlock): Likewise. (__gthread_rwlock_tryrdlock): Likewise. (__gthread_rwlock_wrlock): Likewise. (__gthread_rwlock_trywrlock): Likewise. (__gthread_rwlock_unlock): Likewise. * gthr-single.h: (__GTHREAD_ALWAYS_INLINE): New macro. (__GTHREAD_INLINE): New macro. (__gthread_active_p): Mark as __GTHREAD_INLINE instead of static. (__gthread_once): Likewise. (__gthread_key_create): Likewise. (__gthread_key_delete): Likewise. (__gthread_getspecific): Likewise. (__gthread_setspecific): Likewise. (__gthread_mutex_destroy): Likewise. (__gthread_mutex_lock): Likewise. (__gthread_mutex_trylock): Likewise. (__gthread_mutex_unlock): Likewise. (__gthread_recursive_mutex_lock): Likewise. (__gthread_recursive_mutex_trylock): Likewise. (__gthread_recursive_mutex_unlock): Likewise. (__gthread_recursive_mutex_destroy): Likewise. libstdc++-v3/ChangeLog: * include/bits/shared_ptr.h (std::__is_shared_ptr): Remove unnecessary 'static'. * include/bits/unique_ptr.h (std::__is_unique_ptr): Likewise. * include/std/future (std::__create_task_state): Likewise. * include/std/shared_mutex (_GLIBCXX_GTRHW): Likewise. (__glibcxx_rwlock_init): Likewise. (__glibcxx_rwlock_timedrdlock): Likewise. (__glibcxx_rwlock_timedwrlock): Likewise. (__glibcxx_rwlock_rdlock): Likewise. (__glibcxx_rwlock_tryrdlock): Likewise. (__glibcxx_rwlock_wrlock): Likewise. (__glibcxx_rwlock_trywrlock): Likewise. (__glibcxx_rwlock_unlock): Likewise. (__glibcxx_rwlock_destroy): Likewise. (__glibcxx_rwlock_init): Likewise. * include/pstl/algorithm_impl.h (__pstl::__internal::__set_algo_cut_off): Mark inline. * include/pstl/unseq_backend_simd.h (__pstl::__unseq_backend::__lane_size): Mark inline. Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com> Reviewed-by: Jonathan Wakely <jwakely@redhat.com> Reviewed-by: Jakub Jelinek <jakub@redhat.com>
2024-09-26c++: tweak for -Wrange-loop-construct [PR116731]Marek Polacek2-3/+62
This PR reports that the warning would be better off using a check for trivially constructible rather than trivially copyable. LLVM accepted a similar fix: https://github.com/llvm/llvm-project/issues/47355 PR c++/116731 gcc/cp/ChangeLog: * parser.cc (warn_for_range_copy): Check if TYPE is trivially constructible, not copyable. gcc/testsuite/ChangeLog: * g++.dg/warn/Wrange-loop-construct3.C: New test. Reviewed-by: Jason Merrill <jason@redhat.com>
2024-09-26libstdc++: Fix freebsd/dragonfly build [PR116859]Jakub Jelinek2-3/+15
As reported in the PR, the system headers libstdc++ changes result in -Werror=expansion-to-defined errors on FreeBSD and supposedly on DragonFly too. The following patch fixes those by performing the preprocessor test right away, rather than using defined in the macro definitions. I think neither __ISO_C_VISIBLE nor __LONG_LONG_SUPPORTED should normally change during compilation. 2024-09-26 Jakub Jelinek <jakub@redhat.com> PR libstdc++/116859 * config/os/bsd/freebsd/os_defines.h (_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC, _GLIBCXX_USE_C99_FLOAT_TRANSCENDENTALS_DYNAMIC): Avoid -Wexpansion-to-defined warnings. * config/os/bsd/dragonfly/os_defines.h (_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC): Likewise.
2024-09-26libstdc++: Preserve signbit of nan when converting float to double [PR113578]Jonathan Wakely2-6/+51
LWG 117 specifies that inserting a float into an ostream should cast it to double, because there's no std::num_put::put member that takes a float. However, on RISC-V converting a NaN float to double loses the sign, which means that negative NaN floats are printed as positive. This has been reported as LWG 4101 and there is good support for fixing the standard to preserve the sign bit when printing negative NaN values. This change uses copysign((double)f, (double)std::bit_cast<int>(f)) to get a double that preserves the sign. The bit_cast gives us an integer with the same signbit, and casting that to the target type preserves the signbit. We don't care about the value, as copysign only uses the signbit. The inserters for extended floating-point types need the same treatment, so add a new _S_cast_flt helper to do the signbit-preserving conversion generically. So far only RISC-V has been confirmed to need this treatment, but we might need to extend it to other targets later. libstdc++-v3/ChangeLog: PR libstdc++/113578 * include/std/ostream (_S_cast_flt): New static member function to restore signbit after casting to double or long double. (operator<<(float), operator<<(_Float16), operator<<(_Float32)) (operator<<(_Float64), operator(_Float128)) (operator<<(__bfloat16_t)): Use _S_cast_flt. testsuite/27_io/basic_ostream/inserters_arithmetic/lwg4101.cc: New test. Co-authored-by: Andrew Waterman <andrew@sifive.com>
2024-09-26libstdc++: Fix comments in <sstream> tests that mention basic_filebufJonathan Wakely9-25/+17
libstdc++-v3/ChangeLog: * testsuite/27_io/basic_istringstream/cons/2020.cc: Fix comment referring to basic_filebuf. * testsuite/27_io/basic_istringstream/requirements/base_classes.cc: Likewise. * testsuite/27_io/basic_ostringstream/cons/2020.cc: Likewise. * testsuite/27_io/basic_ostringstream/requirements/base_classes.cc: Likewise. * testsuite/27_io/basic_stringbuf/cons/2020.cc: Likewise. * testsuite/27_io/basic_stringbuf/requirements/explicit_instantiation/2.cc: Likewise. * testsuite/27_io/basic_stringbuf/requirements/explicit_instantiation/4.cc: Likewise. * testsuite/27_io/basic_stringstream/cons/2020.cc: Likewise. * testsuite/27_io/basic_stringstream/requirements/base_classes.cc: Likewise.
2024-09-26libstdc++: Add [[nodiscard]] to iostream membersJonathan Wakely7-4/+51
These are all pure functions and MSVC also marks all of these as nodiscard except for std::basic_ios::tie() const, but that's been confirmed as an accidental omission. libstdc++-v3/ChangeLog: * include/bits/basic_ios.h (basic_ios::operator bool()): Add [[nodiscard]] attribute. (basic_ios::operator!(), basic_ios::rdstate()) (basic_ios::good(), basic_ios::eof(), basic_ios::fail()) (basic_ios::bad(), basic_ios::exceptions(), basic_ios::tie()) (basic_ios::rdbuf(), basic_ios::fill()): Likewise. * include/bits/ios_base.h (ios_base::flags()): Likewise. (ios_base::precision(), ios_base::width(), ios_base::getloc()): Likewise. * include/std/fstream (basic_filebuf::is_open) (basic_ifstream::rdbuf(), basic_ifstream::is_open) (basic_ofstream::rdbuf(), basic_ofstream::is_open) (basic_fstream::rdbuf(), basic_fstream::is_open): Likewise. * include/std/spanstream (basic_spanbuf::span()) (basic_ispanstream::span(), basic_ispanstream::rdbuf()) (basic_ospanstream::span(), basic_ospanstream::rdbuf()) (basic_spanstream::span(), basic_spanstream::rdbuf()): Likewise. * include/std/sstream (basic_stringbuf::str()) (basic_istringstream::rdbuf(), basic_istringstream::str()) (basic_ostringstream::rdbuf(), basic_ostringstream::str()) (basic_stringstream::rdbuf(), basic_stringstream::str()): Likewise. * testsuite/27_io/basic_istream/extractors_arithmetic/char/01.cc: Suppress -Wunused-result warnings. * testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/01.cc: Likewise.
2024-09-26libgomp.texi: Fix deprecation note for omp_{get,set}_nested + OMP_NESTEDTobias Burnus1-3/+3
libgomp/ChangeLog: * libgomp.texi (omp_get_nested,omp_set_nested, OMP_NESTED): Fix note about deprecation - correct is 5.0 not 5.2.
2024-09-26testsuite: XFAIL gfortran.dg/initialization_25.f90 properlySam James1-2/+2
The test was disabled/XFAIL'd informally in r0-100012-gcdc6637d7c78ec, but r15-3890-g34bf6aa41ba539 didn't realize this, causing a FAIL. Fix that by marking it as XFAIL per the original intent. gcc/testsuite/ChangeLog: PR fortran/35779 PR fortran/116858 * gfortran.dg/initialization_25.f90: Mark as XFAIL.
2024-09-26doc: Remove index reference to removed documentation in fortran manualMikael Morin1-1/+0
Fortran option -M used to be an alias for -J. After some deprecation time, it was reused for another purpose at revision r0-100725-gd8ddea4044ee8212d5fe305e8e2a547700cd7b8f. That revision removed the documentation parts of -J mentioning -M, but left a reference to -M in the index. This change removes the remaining reference. gcc/fortran/ChangeLog: * invoke.texi (-M): Remove index reference to removed documentation.
2024-09-26Add virtual destructor to AbstractExprOwen Avery1-0/+2
gcc/rust/ChangeLog: * checks/errors/borrowck/rust-bir.h (class AbstractExpr): Add virtual destructor. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2024-09-26tree-optimization/114855 - speed up dom_oracle::register_transitivesRichard Biener3-18/+44
dom_oracle::register_transitives contains an unbound dominator walk which for the testcase in PR114855 dominates the profile. The following fixes the unbound work done by assigning a constant work budget to the loop, bounding the number of dominators visited but also the number of relations processed. This gets both dom_oracle::register_transitives and get_immediate_dominator off the profile. I'll note that we're still doing an unbound dominator walk via equiv_set in find_equiv_dom at the start of the function and when we register a relation that also looks up the same way. At least for the testcase at hand this isn't an issue. I've also amended the guard to register_transitives with the per-basic-block limit for the number of relations registered not being exhausted. PR tree-optimization/114855 * params.opt (--param transitive-relations-work-bound): New. * doc/invoke.texi (--param transitive-relations-work-bound): Document. * value-relation.cc (dom_oracle::register_transitives): Assing an overall work budget, bounding the dominator walk and the number of relations processed. (dom_oracle::record): Only register_transitives when the number of already registered relations does not yet exceed the per-BB limit.
2024-09-26Fortran/OpenMP: Middle-end support for mapping of DT with allocatable componentsTobias Burnus5-26/+265
gcc/ChangeLog: * langhooks-def.h (lhd_omp_deep_mapping_p, lhd_omp_deep_mapping_cnt, lhd_omp_deep_mapping): New. (LANG_HOOKS_OMP_DEEP_MAPPING_P, LANG_HOOKS_OMP_DEEP_MAPPING_CNT, LANG_HOOKS_OMP_DEEP_MAPPING): Define. (LANG_HOOKS_DECLS): Use it. * langhooks.cc (lhd_omp_deep_mapping_p, lhd_omp_deep_mapping_cnt, lhd_omp_deep_mapping): New stubs. * langhooks.h (struct lang_hooks_for_decls): Add new hooks * omp-expand.cc (expand_omp_target): Handle dynamic-size addr/sizes/kinds arrays. * omp-low.cc (build_sender_ref, fixup_child_record_type, scan_sharing_clauses, lower_omp_target): Update to handle new hooks and dynamic-size addr/sizes/kinds arrays.
2024-09-26libstdc++: Suppress an attribute suggestion warning [PR116853].Iain Sandoe1-0/+3
This warning is triggering during the build and breaking bootstrap on at least two targets. The warning appears valid, but the final fix for it is not yet clear. In the meantime, to restore bootstrap, the following patch ignores the warning in the relevant code section. PR libstdc++/116853 libstdc++-v3/ChangeLog: * include/bits/basic_string.h: Ignore suggest-attribute=format warning when using posix vsnprintf in to_string() implementations. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2024-09-26libstdc++: Fix std::basic_stracktrace to not assume allocators throw ↵Jonathan Wakely1-2/+2
std::bad_alloc The standard allows allocators to throw any kind of exception, not only something that can be caught as std::bad_alloc. std::basic_stracktrace was assuming std::bad_alloc. libstdc++-v3/ChangeLog: * include/std/stacktrace (basic_stacktrace::_Impl::_M_allocate): Do not assume allocators only throw std::bad_alloc.
2024-09-26libstdc++: Remove noexcept-specifier from MCF __cxa_guard_acquire [PR116857]Jonathan Wakely1-10/+10
This function definition should not be marked as non-throwing, because the declaration in <cxxabi.h> is potentially throwing. Also fix whitespace. libstdc++-v3/ChangeLog: PR libstdc++/116857 * libsupc++/guard.cc (__cxa_guard_acquire): Remove _GLIBCXX_NOTHROW to match declaration in <cxxabi.h>.