aboutsummaryrefslogtreecommitdiff
path: root/gcc
AgeCommit message (Collapse)AuthorFilesLines
2025-03-21gccrs: fix typechecking of Fn trait calls using ADT typesPhilip Herron4-4/+72
Fixes RustGcc#2953 gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit): fix the ty_id gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: nr2 cant handle these * rust/compile/issue-2953-1.rs: New test. * rust/compile/issue-2953-2.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
2025-03-21gccrs: fix ICE for placeholder which is not setupPhilip Herron1-1/+11
We can have a case where the placeholder is not configred and the can_resolve check is not detecting this case which can lead to ICE. gcc/rust/ChangeLog: * typecheck/rust-tyty.cc (PlaceholderType::can_resolve): check for empty mappings Signed-off-by: Philip Herron <herron.philip@googlemail.com>
2025-03-21gccrs: Reorganize the CPU feature detectionAntoni Boucher2-93/+96
Move the code from i386-rust.cc to i386-rust-and-jit.inc so that it can be reused by libgccjit. gcc/ChangeLog: * config/i386/i386-rust-and-jit.inc: New file. * config/i386/i386-rust.cc: Move code to i386-rust-and-jit.inc.
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-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-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 Administrator8-1/+271
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-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-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-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-20Make function_decl_type a scoped enumRichard Biener6-13/+19
The enum currently has a member named NONE which pollutes the global namespace unnecessarily. Use a scoped enum instead. gcc/ * tree-core.h (function_decl_type): Make a scoped enum. * tree.h (set_function_decl_type): Adjust. (DECL_IS_OPERATOR_NEW_P): Likewise. (DECL_SET_IS_OPERATOR_NEW): Likewise. (DECL_IS_OPERATOR_DELETE_P): Likewise. (DECL_SET_IS_OPERATOR_DELETE): Likewise. (DECL_LAMBDA_FUNCTION_P): Likewise. (DECL_SET_LAMBDA_FUNCTION): Likewise. * lto-streamer-out.cc (hash_tree): Hash all of FUNCTION_DECL_DECL_TYPE. * tree-streamer-out.cc (pack_ts_function_decl_value_fields): Adjust. * config/aarch64/aarch64-simd-pragma-builtins.def (vcombine_mf8): Use literal zero instead of NONE. gcc/cp/ * module.cc (trees_out::core_bools): Convert scoped enum explicitly.
2025-03-20i386: Fix AVX10.2 SAT CVT testcases.Hu, Lin115-90/+165
Init res_ref2 for rounding control intrinsics. gcc/testsuite/ChangeLog: * gcc.target/i386/avx10_2-512-vcvtph2ibs-2.c: Fix testcase. * gcc.target/i386/avx10_2-512-vcvtph2iubs-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvtps2ibs-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvtps2iubs-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvttpd2dqs-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvttpd2qqs-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvttpd2udqs-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvttpd2uqqs-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvttph2ibs-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvttps2dqs-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvttps2ibs-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvttps2iubs-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvttps2qqs-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvttps2udqs-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvttps2uqqs-2.c: Ditto.
2025-03-20openmp: Fix up cloning of dynamic C++ initializers for OpenMP target [PR119370]Jakub Jelinek2-0/+28
The following testcase ICEs, because we emit the dynamic initialization twice, once for host and once for target initialization, and although we use copy_tree_body_r to unshare it, e.g. for the array initializers it can contain TARGET_EXPRs with local temporaries (or local temporaries alone). Now, these temporaries were created when current_function_decl was NULL, they are outside of any particular function, so they have DECL_CONTEXT NULL. That is normally fine, gimple_add_tmp_var will set DECL_CONTEXT for them later on to the host __static_init* function into which they are gimplified. The problem is that the copy_tree_body_r cloning happens before that (and has to, gimplification is destructive and so we couldn't gimplify the same tree again in __omp_static_init* function) and uses auto_var_in_fn_p to see what needs to be remapped. But that means it doesn't remap temporaries with NULL DECL_CONTEXT and having the same temporaries in two different functions results in ICEs (sure, one can e.g. use parent function's temporaries in a nested function). The following patch just arranges to set DECL_CONTEXT on the temporaries to the host dynamic initialization function, so that they get remapped. If gimplification cared whether DECL_CONTEXT is NULL or not, we could remember those that we've changed in a vector and undo it afterwards, but seems it doesn't really care. 2025-03-20 Jakub Jelinek <jakub@redhat.com> PR c++/119370 * decl2.cc (set_context_for_auto_vars_r): New function. (emit_partial_init_fini_fn): Call walk_tree with that function on &init before walk_tree with copy_tree_body_r. * g++.dg/gomp/pr119370.C: New test.
2025-03-19Use ix86_fp_comparison_operator in cbranchbf4 to avoid ICE.liuhongt2-1/+13
*jcc only supports ix86_fp_comparison_operator for CCFP, when comparison code is LT, there's an ICE. W/o AVX10.2, it's ok since do_compare_rtx_and_jump will transform LT to GT, but w/ AVX10.2 it goes directly into ix86_expand_branch which doesn't handle it. Use ix86_fp_comparison_operator in cbranchbf4. gcc/ChangeLog: PR target/117452 * config/i386/i386.md (cbranchbf4): Use ix86_fp_comparison_operator instead of comparison_operator. gcc/testsuite/ChangeLog: * gcc.target/i386/pr117452.c: New test.
2025-03-20i386: Add "s_" as Saturation for AVX10.2 SAT CVT Intrinsics.Hu, Lin130-760/+760
This patch aims to add "s_" before intrinsic core name represent saturation. gcc/ChangeLog: * config/i386/avx10_2-512satcvtintrin.h: Add "s_" before intrinsics' core name. * config/i386/avx10_2satcvtintrin.h: Ditto. gcc/testsuite/ChangeLog: * gcc.target/i386/avx10_2-512-satcvt-1.c: Modify intrinsic name. * gcc.target/i386/avx10_2-512-vcvtbf162ibs-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvtbf162iubs-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvtph2ibs-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvtph2iubs-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvtps2ibs-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvtps2iubs-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvttbf162ibs-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvttbf162iubs-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvttpd2dqs-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvttpd2qqs-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvttpd2udqs-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvttpd2uqqs-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvttph2ibs-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvttph2iubs-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvttps2dqs-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvttps2ibs-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvttps2iubs-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvttps2qqs-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvttps2udqs-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvttps2uqqs-2.c: Ditto. * gcc.target/i386/avx10_2-satcvt-1.c: Ditto. * gcc.target/i386/avx10_2-vcvttsd2sis-2.c: Ditto. * gcc.target/i386/avx10_2-vcvttsd2usis-2.c: Ditto. * gcc.target/i386/avx10_2-vcvttss2sis-2.c: Ditto. * gcc.target/i386/avx10_2-vcvttss2usis-2.c: Ditto. * gcc.target/i386/sse-14.c: Ditto. * gcc.target/i386/sse-22.c: Ditto.
2025-03-20i386: Fix AVX10.2 SAT CVT testcases.Hu, Lin123-97/+565
Add missing testcases. gcc/testsuite/ChangeLog: * gcc.target/i386/avx10_2-512-satcvt-1.c: Add testcase. * gcc.target/i386/avx10_2-512-vcvtph2ibs-2.c: Ditto * gcc.target/i386/avx10_2-512-vcvtph2iubs-2.c: Ditto * gcc.target/i386/avx10_2-512-vcvtps2ibs-2.c: Ditto * gcc.target/i386/avx10_2-512-vcvtps2iubs-2.c: Ditto * gcc.target/i386/avx10_2-512-vcvttpd2dqs-2.c: Ditto * gcc.target/i386/avx10_2-512-vcvttpd2qqs-2.c: Ditto * gcc.target/i386/avx10_2-512-vcvttpd2udqs-2.c: Ditto * gcc.target/i386/avx10_2-512-vcvttpd2uqqs-2.c: Ditto * gcc.target/i386/avx10_2-512-vcvttph2ibs-2.c: Ditto * gcc.target/i386/avx10_2-512-vcvttph2iubs-2.c: Ditto * gcc.target/i386/avx10_2-512-vcvttps2dqs-2.c: Ditto * gcc.target/i386/avx10_2-512-vcvttps2ibs-2.c: Ditto * gcc.target/i386/avx10_2-512-vcvttps2iubs-2.c: Ditto * gcc.target/i386/avx10_2-512-vcvttps2qqs-2.c: Ditto * gcc.target/i386/avx10_2-512-vcvttps2udqs-2.c: Ditto * gcc.target/i386/avx10_2-512-vcvttps2uqqs-2.c: Ditto * gcc.target/i386/avx10_2-satcvt-1.c: Ditto * gcc.target/i386/avx10_2-vcvttsd2sis-2.c: Ditto * gcc.target/i386/avx10_2-vcvttsd2usis-2.c: Ditto * gcc.target/i386/avx10_2-vcvttss2sis-2.c: Ditto * gcc.target/i386/avx10_2-vcvttss2usis-2.c: Ditto
2025-03-20i386: Add AVX10.2 SAT CVT Intrinsics without Rounding ControlHu, Lin15-0/+1098
gcc/ChangeLog: * config/i386/avx10_2-512satcvtintrin.h: Add new intrinsics. * config/i386/avx10_2satcvtintrin.h: Ditto. * config/i386/i386-builtin-types.def: Add DEF_FUNCTION_TYPE (V32HI, V32HF, V32HI, USI), (V16SI, V16SF, V16SI, UHI), (V8DI, V8SF, V8DI, UQI), (V8DI, V8DF, V8DI, UQI), (V8SI, V8DF, V8SI, UQI). * config/i386/i386-builtin.def: Add new builtins. * config/i386/i386-expand.cc: Handle V16SI_FTYPE_V16SF_V16SI_UHI, V32HI_FTYPE_V32HF_V32HI_USI, V8DI_FTYPE_V8SF_V8DI_UQI, V8DI_FTYPE_V8DF_V8DI_UQI, V8SI_FTYPE_V8DF_V8SI_UQI.
2025-03-20i386: Update Suffix for AVX10.2 SAT CVT IntrinsicsHu, Lin118-458/+458
The intrinsic names for *[i|u]bs instructions in AVX10.2 are missing the required _ep[i|u]8 suffix. This patch aims to fix the issue. gcc/ChangeLog: * config/i386/avx10_2-512satcvtintrin.h: Change *i[u]bs's type suffix of intrin name. * config/i386/avx10_2satcvtintrin.h: Ditto. gcc/testsuite/ChangeLog: * gcc.target/i386/avx10_2-512-satcvt-1.c: Modify intrin name. * gcc.target/i386/avx10_2-512-vcvtbf162ibs-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvtbf162iubs-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvtph2ibs-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvtph2iubs-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvtps2ibs-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvtps2iubs-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvttbf162ibs-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvttbf162iubs-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvttph2ibs-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvttph2iubs-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvttps2ibs-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvttps2iubs-2.c: Ditto. * gcc.target/i386/avx10_2-satcvt-1.c: Ditto. * gcc.target/i386/sse-14.c: Ditto. * gcc.target/i386/sse-22.c: Ditto.
2025-03-20Daily bump.GCC Administrator9-1/+1963