aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2025-03-21gccrs: Use name resolver 2.0 for module descendance checksOwen Avery3-7/+53
gcc/rust/ChangeLog: * checks/errors/privacy/rust-privacy-reporter.cc: Include rust-immutable-name-resolution-context.h. (is_child_module): Use ForeverStack::is_module_descendant if name resolution 2.0 is enabled. * resolve/rust-forever-stack.h (ForeverStack::is_module_descendant): Add. (ForeverStack::dfs_node): Add. * resolve/rust-forever-stack.hxx (ForeverStack::dfs_rib): Use ForeverStack::dfs_node. (ForeverStack::dfs_node): Add. (ForeverStack::is_module_descendant): Add. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2025-03-21gccrs: Use name resolver 2.0 in VisibilityResolverOwen Avery1-1/+20
gcc/rust/ChangeLog: * checks/errors/privacy/rust-visibility-resolver.cc: Add includes. (VisibilityResolver::resolve_module_path): Use name resolver 2.0 (when enabled) to lookup path resolutions. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2025-03-21gccrs: fix bad type inference on local patternsPhilip Herron3-1/+12
We do not need to inject inference variables on generic patterns with generic blocks. This will just cause unconstrained inference variables as they may not unify against something. Fixes Rust-GCC#2323 gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_root_path): dont infer here gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: nr2 cant handle this * rust/compile/issue-2323.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
2025-03-21gccrs: Improve handling of struct expressions in nr2.0Owen Avery2-2/+12
gcc/rust/ChangeLog: * resolve/rust-late-name-resolver-2.0.cc (Late::visit): Handle StructExprStruct and use ForeverStack::resolve_path instead of ForeverStack::get to resolve struct expression paths. * resolve/rust-late-name-resolver-2.0.h (Late::visit): Handle StructExprStruct. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2025-03-21gccrs: Remove usage of Resolver::get_builtin_typesOwen Avery3-13/+9
gcc/rust/ChangeLog: * backend/rust-compile-context.cc (Context::setup_builtins): Use TypeCheckContext::get_builtins instead of Resolver::get_builtin_types, TypeCheckContext::lookup_type_by_node_id, and TypeCheckContext::lookup_type. * typecheck/rust-hir-type-check.h (TypeCheckContext::get_builtins): Add. * typecheck/rust-typecheck-context.cc (TypeCheckContext::get_builtins): Add. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2025-03-21gccrs: fix bad type inferencing on path'sPhilip Herron3-8/+25
This catch to inject inference variables into generic paths was a catch all 'hack' that we needed before we handled generics correctly as we do now. Fixes #3009 gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_segments): remove hack gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: nr2 cant handle this * rust/compile/issue-3009.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
2025-03-21gccrs: Make TyTy::TupleType::get_unit_type cache its return valueOwen Avery10-44/+31
This removes a usage of Resolver::get_unit_type_node_id in rust-hir-type-check-expr.cc (the HIR::TupleExpr overload of TypeCheckExpr::visit). gcc/rust/ChangeLog: * typecheck/rust-tyty.cc (TupleType::get_unit_type): Remove parameter, cache return value. * typecheck/rust-tyty.h (TupleType::get_unit_type): Remove parameter. * resolve/rust-late-name-resolver-2.0.cc (Late::setup_builtin_types): Adjust calls to get_unit_type. * resolve/rust-name-resolver.cc (Resolver::generate_builtins): Likewise. * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Likewise. * typecheck/rust-hir-type-check-implitem.cc (TypeCheckTopLevelExternItem::visit): Likewise. (TypeCheckImplItem::visit): Likewise. * typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit): Likewise. * typecheck/rust-hir-type-check-stmt.cc (TypeCheckStmt::visit): Likewise. * typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): Likewise. * typecheck/rust-hir-type-check.cc (TraitItemReference::get_type_from_fn): Likewise. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2025-03-21gccrs: add test case to show method resolution is workingPhilip Herron2-0/+145
The issue here was that the impl block for Cell<T> defines that T must have the bound of Copy implemented. But simultaneously if you do an deref you get direct access to the unsafe cell which also defines a get method so these are two valid ways of accessing the method in question but when Copy is implementet the simplest case is prefered so it does resolve to Cell<T>::get. Fixes #3033 gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: nr can't handle this * rust/compile/issue-3033.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
2025-03-21gccrs: Resolve SelfParam in name resolution 2.0Owen Avery3-4/+13
gcc/rust/ChangeLog: * resolve/rust-late-name-resolver-2.0.cc (Late::visit): Handle SelfParam. * resolve/rust-late-name-resolver-2.0.h (Late::visit): Likewise. gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Remove entries. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2025-03-21gccrs: Use name resolution 2.0 in TraitResolverOwen Avery2-4/+22
gcc/rust/ChangeLog: * typecheck/rust-hir-trait-resolve.cc: Add includes. (TraitResolver::resolve_path_to_trait): Use name resolution 2.0 resolver when enabled. gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Remove entries. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2025-03-21rust: Desugar IfLet* into MatchExprMarc Poulhiès32-477/+260
Replace the "regular" AST->HIR lowering for IfLet* with a desugaring into a MatchExpr. Desugar a simple if let: if let Some(y) = some_value { bar(); } into: match some_value { Some(y) => {bar();}, _ => () } Same applies for IfLetExprConseqElse (if let with an else block). Desugar: if let Some(y) = some_value { bar(); } else { baz(); } into: match some_value { Some(y) => {bar();}, _ => {baz();} } Fixes https://github.com/Rust-GCC/gccrs/issues/1177 gcc/rust/ChangeLog: * backend/rust-compile-block.h: Adjust after removal of HIR::IfLetExpr and HIR::IfLetExprConseqElse. * backend/rust-compile-expr.h: Likewise. * checks/errors/borrowck/rust-bir-builder-expr-stmt.cc (ExprStmtBuilder::visit): Likewise. * checks/errors/borrowck/rust-bir-builder-expr-stmt.h: Likewise. * checks/errors/borrowck/rust-bir-builder-lazyboolexpr.h: Likewise. * checks/errors/borrowck/rust-bir-builder-struct.h: Likewise. * checks/errors/borrowck/rust-function-collector.h: Likewise. * checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::visit): Likewise. * checks/errors/privacy/rust-privacy-reporter.h: Likewise. * checks/errors/rust-const-checker.cc (ConstChecker::visit): Likewise. * checks/errors/rust-const-checker.h: Likewise. * checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): Likewise. * checks/errors/rust-unsafe-checker.h: Likewise. * hir/rust-ast-lower-block.h (ASTLoweringIfLetBlock::translate): Change return type. * hir/rust-ast-lower.cc (ASTLoweringIfLetBlock::desugar_iflet): New. (ASTLoweringIfLetBlock::visit(AST::IfLetExpr &)): Adjust and use desugar_iflet. * hir/rust-ast-lower.h: Add comment. * hir/rust-hir-dump.cc (Dump::do_ifletexpr): Remove. (Dump::visit(IfLetExpr&)): Remove. (Dump::visit(IfLetExprConseqElse&)): Remove. * hir/rust-hir-dump.h (Dump::do_ifletexpr): Remove. (Dump::visit(IfLetExpr&)): Remove. (Dump::visit(IfLetExprConseqElse&)): Remove. * hir/tree/rust-hir-expr.h (class IfLetExpr): Remove. (class IfLetExprConseqElse): Remove. * hir/tree/rust-hir-full-decls.h (class IfLetExpr): Remove. (class IfLetExprConseqElse): Remove. * hir/tree/rust-hir-visitor.h: Adjust after removal of HIR::IfLetExpr and HIR::IfLetExprConseqElse. * hir/tree/rust-hir.cc (IfLetExpr::as_string): Remove. (IfLetExprConseqElse::as_string): Remove. (IfLetExpr::accept_vis): Remove. (IfLetExprConseqElse::accept_vis): Remove. * hir/tree/rust-hir.h: Adjust after removal of HIR::IfLetExpr and HIR::IfLetExprConseqElse. * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Likewise. * typecheck/rust-hir-type-check-expr.h: Likewise. * checks/errors/rust-hir-pattern-analysis.cc (PatternChecker::visit (IfLetExpr &)): Remove. (PatternChecker::visit (IfLetExprConseqElse &)): Remove. * checks/errors/rust-hir-pattern-analysis.h (visit(IfLetExpr &)): Remove. (visit(IfLetExprConseqElse &)): Remove. gcc/testsuite/ChangeLog: * rust/compile/if_let_expr.rs: Adjust. * rust/compile/if_let_expr_simple.rs: New test. * rust/compile/iflet.rs: New test. * rust/execute/torture/iflet.rs: New test. * rust/compile/nr2/exclude: Add iflet.rs and if_let_expr_simple.rs Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
2025-03-21gccrs: Fix name resolution 2.0 definition lookups in unsafe checkerOwen Avery2-10/+38
gcc/rust/ChangeLog: * checks/errors/rust-unsafe-checker.cc: Add includes. (UnsafeChecker::visit): Use 2.0 version of resolver when name resolution 2.0 is enabled. gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Remove entries. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2025-03-21gccrs: Improve path handling while testing name resolution 2.0Owen Avery2-14/+9
gcc/testsuite/ChangeLog: * rust/compile/nr2/compile.exp: Handle paths using "file join" and "file split". * rust/compile/nr2/exclude: Remove debug-diagnostics-on.rs. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2025-03-21gccrs: Use name resolver 2.0 in CompileTraitItemOwen Avery1-4/+32
gcc/rust/ChangeLog: * backend/rust-compile-implitem.cc (CompileTraitItem::visit): Use name resolver 2.0 (when enabled) to obtain canonical paths for instances of TraitItemConst and TraitItemFunc. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2025-03-21gccrs: Use name resolution 2.0 in TraitItemReferenceOwen Avery1-2/+21
gcc/rust/ChangeLog: * typecheck/rust-hir-type-check.cc: Add includes. (TraitItemReference::get_type_from_fn): Use ForeverStack::to_canonical_path when name resolution 2.0 is enabled. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2025-03-21gccrs: Rename some PathIdentSegment functionsOwen Avery2-15/+24
This makes PathIdentSegment more similar to other classes used to represent path segments. gcc/rust/ChangeLog: * ast/rust-path.h (PathIdentSegment::is_super_segment): Rename to... (PathIdentSegment::is_super_path_seg): ...here. (PathIdentSegment::is_crate_segment): Rename to... (PathIdentSegment::is_crate_path_seg): ...here. (PathIdentSegment::is_lower_self): Rename to... (PathIdentSegment::is_lower_self_seg): ...here. (PathIdentSegment::is_big_self): Rename to... (PathIdentSegment::is_big_self_seg): ...here. (PathExprSegment::is_super_path_seg): Handle renames. (PathExprSegment::is_crate_path_seg): Likewise. (PathExprSegment::is_lower_self_seg): Likewise. (TypePathSegment::is_crate_path_seg): Likewise. (TypePathSegment::is_super_path_seg): Likewise. (TypePathSegment::is_big_self_seg): Likewise. (TypePathSegment::is_lower_self_seg): Likewise. * ast/rust-ast-collector.cc (TokenCollector::visit): Likewise. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2025-03-21gccrs: Add a newline to the end of nr2/excludeOwen Avery1-1/+2
gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Add trailing newline along with comment. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2025-03-21gccrs: Fix variable shadowing in late resolution 2.0Owen Avery2-5/+8
gcc/rust/ChangeLog: * resolve/rust-late-name-resolver-2.0.cc (Late::visit): Visit the initialization expressions of let statements before visiting their patterns. gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Remove entries. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2025-03-21gccrs: Insert trait names during toplevel resolution 2.0Owen Avery1-0/+3
gcc/rust/ChangeLog: * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Insert trait names into the type namespace. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2025-03-21gccrs: Fix bad recursive operator overload callPhilip Herron6-6/+134
When we are typechecking the impl block for DerefMut for &mut T the implementation follows the usual operator overload check but this ended up just resolving directly to the Trait definition which ends up being recursive which we usually handle. The issue we had is that a dereference call can be for either the DEREF or DEREF_MUT lang item here it was looking for a recurisve call to the DEREF lang item but we were in the DEREF_MUT lang item so this case was not accounted for. Fixes #3032 gcc/rust/ChangeLog: * typecheck/rust-hir-trait-reference.h: new get locus helper * typecheck/rust-hir-trait-resolve.cc (AssociatedImplTrait::get_locus): implemention * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::resolve_operator_overload): fix overload gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: nr2 cant handle this * rust/compile/issue-3032-1.rs: New test. * rust/compile/issue-3032-2.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
2025-03-21icf: Punt for musttail call flag differences in ICF [PR119376]Jakub Jelinek2-1/+33
The following testcase shows we were ignoring musttail flags on calls when deciding if two functions are the same. That can result in problems in both directions, either we silently lose musttail attribute because there is a similar function without it earlier and then we e.g. don't diagnose if it can't be tail called or don't try harder to do a tail call, or we get it even in functions which didn't have it before. The following patch for now just punts if it differs. Perhaps we could just merge it and get musttail flag if any of the merged functions had one in such position, but it feels to me that it is now too late in GCC 15 cycle to play with this. 2025-03-21 Jakub Jelinek <jakub@redhat.com> PR ipa/119376 * ipa-icf-gimple.cc (func_checker::compare_gimple_call): Return false for gimple_call_must_tail_p mismatches. * c-c++-common/musttail27.c: New test.
2025-03-21fnsplit: Set musttail call during function splitting if there are musttail ↵Jakub Jelinek2-0/+37
calls [PR119376] The just posted inliner patch can regress musttail calls if we perform function splitting and then inline the outlined body back into the original (or inline both the small function and outlined large body into something else). If there are any musttail calls, I think we need to call the outlined body using a musttail call, so that the inliner will preserve musttail attributes in the body. 2025-03-21 Jakub Jelinek <jakub@redhat.com> PR ipa/119376 * ipa-split.cc (split_function): Call gimple_call_set_must_tail on the call to outlined partition if has_musttail and !add_tsan_func_exit. * g++.dg/opt/musttail1.C: New test.
2025-03-21inliner: Silently drop musttail flag on calls during inlining unless the ↵Jakub Jelinek2-0/+42
inlined routine was musttail called [PR119376] As discussed in the PR, some packages fail to build because they use musttail attribute on calls in functions which we inline, and if they are inlined into a middle of the function, that results in an error because we have a musttail call in the middle of a function and so it can't be tail called there. Now, guess the primary intent of the musttail attribute is ensuring we don't get an extra stack frame in the backtrace. Inlining itself removes one extra stack frame from the backtrace as well (sure, not counting virtual backtraces in gdb), so I think erroring out on that is unnecessary. Except when we are inlining a musttail call which has musttail calls in it, in that case we are being asked to remove 2 stack frames from the backtrace, inlining removes one, so we need to keep musttail on the calls so that another stack frame is removed through a tail call. The following patch implements that, keeping previous behavior when id->call_stmt is NULL (i.e. when versioning/cloning etc.). 2025-03-21 Jakub Jelinek <jakub@redhat.com> PR ipa/119376 * tree-inline.cc (remap_gimple_stmt): Silently clear gimple_call_must_tail_p on inlined call stmts if id->call_stmt is a call without that flag set. * c-c++-common/musttail26.c: New test.
2025-03-21libstdc++: Fix localized %c formatting for non-UTC times [PR117214]Jonathan Wakely5-9/+287
The previous commit fixed most cases of %c formatting, but it incorrectly prints times using the system's local time zone. This only matters if the locale's %c format includes %Z, but some do. To print a correct value for %Z we can set tm.tm_zone to either "UTC" or the abbreviation passed to the formatter in the local-time-format-t structure. For local times with no info and for systems that don't support tm_zone (which is new in POSIX.1-2024) we just set tm_isdst = -1 so that no zone name is printed. In theory, a locale's %c format could use %z which should print a +hhmm offset from UTC. I'm unsure how to control that though. The new tm_gmtoff field in combination with tm_isdst != -1 seems like it should work, but using that without also setting tm_zone causes the system zone to be used for %Z again. That means local_time_format(lt, nullptr, &off) might work for a locale that uses %z but prints the wrong thing for %Z. This commit doesn't set tm_gmtoff even if _M_offset_sec is provided for a local-time-format-t value. libstdc++-v3/ChangeLog: PR libstdc++/117214 * configure.ac: Use AC_STRUCT_TIMEZONE. * config.h.in: Regenerate. * configure: Regenerate. * include/bits/chrono_io.h (__formatter_chrono::_M_c): Set tm_isdst and tm_zone. * testsuite/std/time/format/pr117214.cc: Check %c formatting of zoned_time and local time.
2025-03-21libstdc++: Fix localized D_T_FMT %c formatting for <chrono> [PR117214]XU Kailiang2-16/+53
Formatting a time point with %c was implemented by calling std::vprint_to with format string constructed from locale's D_T_FMT string, but in some locales this string contains strftime specifiers which are not valid for chrono-specs, e.g. %l. So just use _M_locale_fmt to avoid this problem. libstdc++-v3/ChangeLog: PR libstdc++/117214 * include/bits/chrono_io.h (__formatter_chrono::_M_c): Use _M_locale_fmt to format %c time point. * testsuite/std/time/format/pr117214.cc: New test. Signed-off-by: XU Kailiang <xu2k3l4@outlook.com> Co-authored-by: Jonathan Wakely <jwakely@redhat.com>
2025-03-21libstdc++: Use formatting locale for std::time_put formatsJonathan Wakely2-0/+34
When using std::time_put to format a chrono value, we should imbue the formatting locale into the stream. This ensures that when std::time_put::do_put uses a ctype or __timepunct facet from the locale, it gets the correct facets. libstdc++-v3/ChangeLog: * include/bits/chrono_io.h (__formatter_chrono::_M_locale_fmt): Imbue locale into ostringstream. * testsuite/std/time/format/localized.cc: Check that correct locale is used for call to time_put::put. Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
2025-03-21libstdc++: Simplify std::vector::vector(from_range_t, const Alloc&)Jonathan Wakely1-18/+2
Tomasz suggested replacing this constructor with just append_range(rg), after using a delegating constructor so that the destructor will run if append_range exits via an exception. This is slightly less simple than his suggestion, because I want to avoid the overhead of reserve's slow path and the ASan annotations. Neither of those is needed for this constructor, because we have no existing storage to reallocate and no unused capacity to tell ASan about. libstdc++-v3/ChangeLog: * include/bits/stl_vector.h (vector(from_range_t, Alloc)): Use delegating constructor instead of RAII guards. Use append_range for unsized input range case. Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
2025-03-21cobol: Rename COB_{BLOCK,UNSIGNED,SIGNED} to {BLOCK,UNSIGNED,SIGNED}_kw for ↵Jakub Jelinek3-18/+18
consistency On Wed, Mar 19, 2025 at 06:03:24PM -0400, James K. Lowden wrote: > Elsewhere in the parser where there was a conflict like that, I renamed > the token. For example, the COBOL word TRUE uses a token named > TRUE_kw. I don't mind either way; your solution has less impact on the > parser. I think consistency is good and when it is a suffix rather than prefix, it also sorts alphabetically together with the actual keywords. 2025-03-21 Jakub Jelinek <jakub@redhat.com> * parse.y: Rename COB_BLOCK to BLOCK_kw, COB_SIGNED to SIGNED_kw and COB_UNSIGNED to UNSIGNED_kw. * scan.l: Likewise. * token_names.h: Regenerate.
2025-03-21libstdc++: Fix std.compat exports of <stdbit.h> and <stdckdint.h>Jonathan Wakely1-2/+9
libstdc++-v3/ChangeLog: * src/c++23/std.compat.cc.in: Only export <stdbit.h> and <stdckdint.h> contents for C++26 and later. Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
2025-03-21libstdc++: Add views::cache_latest and views::to_input to std moduleJonathan Wakely1-3/+20
Also export the tuple-like helpers from <complex>, and the std::from_range_t and std::from_range tag. libstdc++-v3/ChangeLog: * src/c++23/std.cc.in (tuple_element, tuple_element_t) (tuple_size, tuple_size_v, get): Export. (ranges::cache_latest_view, views::cache_latest): Export. (ranges::to_input_view, views::to_input): Export. (from_range_t, from_range): Export. Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
2025-03-21move global data to symbol_table_initRichard Biener1-89/+84
The following avoids early runtime initialization of cbl_field_t objects which, when using tree to represent the current _Float128 data, segfaults as tree data like float128_type_node is not yet initialized. The solution is to move the global data to symbol_table_init which is the only user and it already has one such instance locally, the 'constants' array. * symbols.cc (empty_float, empty_comp5, empty_literal, empty_conditional, debug_registers, special_registers): Move global cbl_field_t typed data to ... (symbol_table_init): ... local scope here.
2025-03-21s390: Accept only Pmode for registers AP/FP/RA [PR119235]Stefan Schulze Frielinghaus1-2/+2
gcc/ChangeLog: PR target/119235 * config/s390/s390.cc (s390_hard_regno_mode_ok): Accept only Pmode for registers AP/FP/RA.
2025-03-21make sources coretypes.h and tree.h cleanRichard Biener15-31/+40
The following removes HOWEVER_GCC_DEFINES_TREE and the alternate definition of tree from symbols.h and instead ensures that both coretypes.h and tree.h are included where required. This required putting GCCs own 'NONE' in a scoped enum (see separate patch) and renaming the cobol use of UNSIGNED, SIGNED and BLOCK which conflict with enums from tree.h. There's a few things in conflict with options.h defines, notably cobol_dialect and cobol_exceptions but also yy_flex_debug (wherever that comes from). I've chosen to simply #undef those where appropriate. I've refrained from putting the coretypes.h and tree.h includes in cobol-system.h since not all files require this. This helps in making use of real.h instead of using _Float128. PR cobol/119241 gcc/cobol/ * symbols.h: Do not typedef tree. * cdf.y: Include coretypes.h and tree.h. * symbols.cc: Likewise. * symfind.cc: Likewise. * util.cc: Likewise. * parse.y: Include coretypes.h and tree.h where appropriate. Rename BLOCK to COB_BLOCK, SIGNED to COB_SIGNED, UNSIGNED to COB_UNSIGNED. * scan.l: Likewise. * token_names.h: Likewise. * cobol1.cc: Do not define HOWEVER_GCC_DEFINES_TREE. * except.cc: Likewise. * genapi.cc: Likewise. * gengen.cc: Likewise. * genmath.cc: Likewise. * genutil.cc: Likewise. * structs.cc: Likewise.
2025-03-21Fortran: Fix double free on polymorphic array dummy argument [PR119349]Andre Vehreschild2-1/+30
Calling elemental routines with polymorphic formals leads to generation of a temporary polymorphic variable and code for its deallocation. Sourcing this element from an array constructor the latter now is prevented from generating a second deallocation. PR fortran/119349 gcc/fortran/ChangeLog: * trans-expr.cc (gfc_conv_procedure_call): Prevent deallocation of array temporary for polymorphic temporary argument. gcc/testsuite/ChangeLog: * gfortran.dg/class_79.f90: New test.
2025-03-21Put early debug generation under TV_SYMOUTRichard Biener1-0/+4
Like all other debug info generation this should be with TV_SYMOUT, otherwise it's recorded as TV_CGRAPH. * cgraphunit.cc (symbol_table::finalize_compilation_unit): Put early debug generation under TV_SYMOUT.
2025-03-21Daily bump.GCC Administrator12-1/+313
2025-03-20combine: Add REG_DEAD notes to the last instruction after a split [PR118914]Andrew Pinski1-15/+31
So gcc.target/aarch64/rev16_2.c started to fail after r15-268-g9dbff9c05520a7, the problem is combine now rejects the instruction combine. This happens because after a different combine which uses a define_split and that define_split creates a new pseudo register. That new pseudo register is dead after the last instruction in the stream BUT combine never creates a REG_DEAD for it. So combine thinks it is still needed after and now with the i2 not changing, combine rejects the combine. Now combine should be creating a REG_DEAD for the new pseudo registers for the last instruction of the split. This fixes rev16_2.c and also improves the situtation in other cases by removing other dead instructions. Bootstrapped and tested on aarch64-linux-gnu and x86_64-linux-gnu. gcc/ChangeLog: PR rtl-optimization/118914 * combine.cc (recog_for_combine): Add old_nregs and new_nregs argument (defaulting to 0). Update call to recog_for_combine_1. (combine_split_insns): Add old_nregs and new_nregs arguments, store the old and new max registers to them. (try_combine): Update calls to combine_split_insns and pass old_nregs and new_nregs for the i3 call to recog_for_combine. (find_split_point): Update call to combine_split_insns; ignoring the values there. (recog_for_combine_1): Add old_nregs and new_nregs arguments, if the insn was recognized (and not to no-op move), add the REG_DEAD notes to pnotes argument. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2025-03-21d: Fix quoted command-line options to match lang.opt [PR118545]Iain Buclaw1-3/+3
It was noticed that not all D language options get a url in diagnostics. These have been checked and fixed as necessary. PR d/118545 gcc/d/ChangeLog: * d-lang.cc (d_handle_option): Adjust quoted options.
2025-03-20modula2: Defend against no ENOTBLK definitionGaius Mulley1-2/+10
This patch defends against no ENOTBLK definition. libgm2/ChangeLog: * libm2iso/ErrnoCategory.cc (IsErrnoHard): Defend against lack of ENOTBLK. (UnAvailable): Ditto. (GetOpenResults): Ditto. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2025-03-20PR modula2/118600 Assigning to a record causes alignment exceptionGaius Mulley10-20/+255
This patch recursively tests every assignment (of a constructor to a designator) to ensure the types are GCC equivalent. If they are equivalent then it uses gimple assignment and if not then it copies a structure by field and uses __builtin_strncpy to copy a string cst into an array. Unions are copied by __builtin_memcpy. gcc/m2/ChangeLog: PR modula2/118600 * gm2-compiler/M2GenGCC.mod (PerformCodeBecomes): New procedure. (CodeBecomes): Refactor and call PerformCodeBecomes. * gm2-gcc/m2builtins.cc (gm2_strncpy_node): New global variable. (DoBuiltinStrNCopy): New function. (m2builtins_BuiltinStrNCopy): New function. (m2builtins_init): Initialize gm2_strncpy_node. * gm2-gcc/m2builtins.def (BuiltinStrNCopy): New procedure function. * gm2-gcc/m2builtins.h (m2builtins_BuiltinStrNCopy): New function. * gm2-gcc/m2statement.cc (copy_record_fields): New function. (copy_array): Ditto. (copy_strncpy): Ditto. (copy_memcpy): Ditto. (CopyByField_Lower): Ditto. (m2statement_CopyByField): Ditto. * gm2-gcc/m2statement.def (CopyByField): New procedure function. * gm2-gcc/m2statement.h (m2statement_CopyByField): New function. * gm2-gcc/m2type.cc (check_record_fields): Ditto. (check_array_types): Ditto. (m2type_IsGccStrictTypeEquivalent): Ditto. * gm2-gcc/m2type.def (IsGccStrictTypeEquivalent): New procedure function. * gm2-gcc/m2type.h (m2type_IsAddress): Replace return type int with bool. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2025-03-20cobol: Do not overload int64_t, overload long and long long.Iain Sandoe1-1/+1
Since the type that is ued for int64_t varies between platforms trying to overload it creates ambiguous or conflicting overloads. gcc/cobol/ChangeLog: * cdfval.h (struct cdfval_t): Overload long instead of int64_t. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2025-03-20libgcobol: Add configure checks for iconv.Iain Sandoe6-4/+933
Some targets might need to add libraries to get iconv support. libgcobol/ChangeLog: * Makefile.am: Use LIBICONV. * Makefile.in: Regenerate. * aclocal.m4: Regenerate. * config.h.in: Regenerate. * configure: Regenerate. * configure.ac: Check for iconv support. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2025-03-20Update gcc hr.poJoseph Myers1-689/+484
* hr.po: Update.
2025-03-20tree-optimization/119389 - limit edge processing in dominated_by_p_w_unexRichard Biener1-1/+5
The following removes quadraticness when visiting each predecessor of a large CFG merge with dominated_by_p_w_unex. PR tree-optimization/119389 * tree-ssa-sccvn.cc (dominated_by_p_w_unex): Limit the number of predecessors of a CFG merge we try to skip.
2025-03-20Update cpplib de.poJoseph Myers1-11/+7
* de.po: Update.
2025-03-20Revert "s390: Deprecate ESA/390 support"Stefan Schulze Frielinghaus26-34/+10
The intention of -m31 -mesa and -m31 -mzarch was that they are (ABI) compatible which is almost true except as it turns out they are not for attribute mode(word). After doing some archaeology and digging out an over 18 year old thread [1,2] which is about this very attribute, I come to the conclusion to revert this patch. The intention by deprecating and eventually removing ESA/390 support was to prepare for a future removal of -m31; though in smaller steps. Thus, instead of introducing some potential hick ups along the route, I will revert this patch and will revisit this topic when time for -m31 in its entirety has come---independent of -mesa/-mzarch. [1] https://gcc.gnu.org/pipermail/gcc-patches/2006-September/200465.html [2] https://gcc.gnu.org/pipermail/gcc-patches/2006-October/201154.html This reverts commit 3b1bd1fdcd241dd1e5b706b6937400d74ca43146.
2025-03-20gimple: sccopy: Don't increment i after vec::unordered_remove()Filip Kastl1-1/+3
I increment the index variable in a loop even when I do vec::unordered_remove() which causes the vector traversal to miss some elements. Mikael notified me of this mistake I made in my last patch. gcc/ChangeLog: * gimple-ssa-sccopy.cc (scc_copy_prop::propagate): Don't increment after vec::unordered_remove(). Reported-by: Mikael Morin <mikael@gcc.gnu.org> Signed-off-by: Filip Kastl <fkastl@suse.cz>
2025-03-20libstdc++: Add from_range_t constructors to debug unordered containersTomasz Kamiński2-0/+272
libstdc++-v3/ChangeLog: * include/debug/unordered_map (unordered_map): Add from_range constructors and deduction guides. (unordered_multimap): Likewise. * include/debug/unordered_set (unordered_set): Add from_range constructors and deduction guides. (unordered_multiset): Likewise. Reviewed-by: Jonathan Wakely <jwakely@redhat.com> Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2025-03-20libstdc++: Add from_range_t constructors to debug ordered containersJonathan Wakely4-1/+133
libstdc++-v3/ChangeLog: * include/debug/map.h (map): Add from_range constructors and deduction guides. * include/debug/multimap.h (multimap): Likewise. * include/debug/multiset.h (multiset): Likewise. * include/debug/set.h (set): Likewise. Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
2025-03-20libstdc++: Fix comment typoJakub Jelinek1-1/+1
Another IEE typo. 2025-03-20 Jakub Jelinek <jakub@redhat.com> * testsuite/18_support/numeric_limits/traps.cc (main): Fix comment typo.