aboutsummaryrefslogtreecommitdiff
path: root/gcc
AgeCommit message (Collapse)AuthorFilesLines
2024-08-01gccrs: Unify ASTValidation::visit for ExternalFunctionItem and Function0xn4utilus3-17/+57
gcc/rust/ChangeLog: * checks/errors/rust-ast-validation.cc (ASTValidation::visit): Add external function validation support. Add ErrorCode::E0130. * parse/rust-parse-impl.h (Parser::parse_function): Parse external functions from `parse_function`. (Parser::parse_external_item): Clang format. (Parser::parse_pattern): Clang format. * parse/rust-parse.h: Add default parameter `is_external` in `parse_function`. Signed-off-by: 0xn4utilus <gyanendrabanjare8@gmail.com>
2024-08-01gccrs: Add get_pattern_kind to Pattern0xn4utilus4-0/+60
gcc/rust/ChangeLog: * ast/rust-ast.h: Add Kind Enum to Pattern. * ast/rust-macro.h: Add get_pattern_kind(). * ast/rust-path.h: Likewise. * ast/rust-pattern.h: Likewise. Signed-off-by: 0xn4utilus <gyanendrabanjare8@gmail.com>
2024-08-01gccrs: Add support for external functions0xn4utilus4-20/+43
gcc/rust/ChangeLog: * ast/rust-ast.cc (Function::Function): Add `is_external_function` field. (Function::operator=): Likewise. * ast/rust-ast.h: New constructor for ExternalItem. * ast/rust-item.h (class Function): Add `is_external_function` field. Update `get_node_id`. * ast/rust-macro.h: Update copy constructor. Signed-off-by: 0xn4utilus <gyanendrabanjare8@gmail.com>
2024-08-01gccrs: Clean BiMap to use tl::optional for lookupsSourabh Jaiswal6-23/+28
gcc/rust/Changelog: * expand/rust-expand-visitor.cc (ExpandVisitor::expand_inner_items): Adjust to use has_value () (ExpandVisitor::expand_inner_stmts): Likewise * expand/rust-macro-builtins.cc (builtin_macro_from_string): Likewise (make_macro_path_str): Likewise * util/rust-hir-map.cc (Mappings::insert_macro_def): Likewise * util/rust-lang-item.cc (LangItem::Parse): Adjust to return tl::optional (LangItem::toString) Likewise * util/rust-token-converter.cc (handle_suffix): Adjust to use value.or () (from_literal) Likewise * util/bi-map.h (BiMap::lookup): Adjust to use tl::optional for lookups Signed-off-by: Sourabh Jaiswal <sourabhrj31@gmail.com>
2024-08-01gccrs: Ensure TupleStructPattern and TuplePattern have itemsOwen Avery6-54/+26
Note that instances of both classes which have been moved from will have (items == nullptr). gcc/rust/ChangeLog: * ast/rust-pattern.h (class TupleStructPattern): Assert that items != nullptr. (class TuplePattern): Likewise. (TupleStructPattern::has_items): Remove. (TuplePattern::has_tuple_pattern_items): Likewise. * parse/rust-parse-impl.h (Parser::parse_ident_leading_pattern): Prevent construction of TupleStructPattern with (items == nullptr). (Parser::parse_pattern_no_alt): Likewise. * ast/rust-ast-collector.cc (TokenCollector::visit): Remove usage of TupleStructPattern::has_items. * ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Likewise. * resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit): Likewise. gcc/testsuite/ChangeLog: * rust/compile/pattern-struct.rs: Fix test. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2024-08-01gccrs: Add curly brackets, formatted clangjjasmine1-5/+12
gcc/rust/ChangeLog: * resolve/rust-late-name-resolver-2.0.cc (Late::visit): Add error emitting
2024-08-01gccrs: Add error emitting when we can't resolve id exprjjasmine1-1/+4
gcc/rust/ChangeLog: * resolve/rust-late-name-resolver-2.0.cc (Late::visit): Add error emitting
2024-08-01gccrs: format-args: Add documentation for future expansion of functionArthur Cohen1-21/+5
gcc/rust/ChangeLog: * expand/rust-macro-builtins.cc (MacroBuiltin::format_args_handler): Add documentation regarding future tasks.
2024-08-01gccrs: lower: Add base for lowering FormatArgs nodesArthur Cohen10-54/+127
gcc/rust/ChangeLog: * Make-lang.in: Compile the new source file. * ast/rust-ast-collector.cc (TokenCollector::visit): Error out when visiting FormatArgs nodes. * resolve/rust-ast-resolve-base.cc (ResolverBase::visit): Likewise. * hir/rust-ast-lower-expr.cc (ASTLoweringExpr::visit): Likewise. * ast/rust-ast.cc (FormatArgs::get_locus): New. * ast/rust-builtin-ast-nodes.h: Improve FormatArgs API. * ast/rust-fmt.cc (Pieces::~Pieces): Cleanup. (Pieces::Pieces): Likewise. * ast/rust-fmt.h (struct Pieces): Add pieces_vector member. * hir/rust-ast-lower-format-args.cc: New file. * hir/rust-ast-lower-format-args.h: New file.
2024-08-01gccrs: format-args: Fix Rust interface and add input parsing.Arthur Cohen6-58/+368
gcc/rust/ChangeLog: * ast/rust-ast.cc: Make FormatArgs inherit from AST::Expr * ast/rust-builtin-ast-nodes.h: Improve FormatArg* nodes and helpers. * ast/rust-fmt.cc (Pieces::collect): Fix interface to match FFI function. * ast/rust-fmt.h (collect_pieces): Likewise. (struct Pieces): Add append_newline parameter. * expand/rust-macro-builtins.cc: Add proper parsing of format_args input. * hir/rust-ast-lower-base.cc: Include diagnostics header. libgrust/ChangeLog: * libformat_parser/src/lib.rs: Switch interface to use more parser parameters. * libformat_parser/src/bin.rs: Use new interface.
2024-08-01gccrs: parser: Add peek(n) method to parserArthur Cohen1-0/+1
gcc/rust/ChangeLog: * parse/rust-parse.h: New method.
2024-08-01gccrs: macro-builtins: Add newline generic format_args!() handlerArthur Cohen2-8/+65
gcc/rust/ChangeLog: * expand/rust-macro-builtins.cc (format_args_maker): New function. (try_expand_many_expr): Add comment about reworking function. (MacroBuiltin::format_args_handler): Add newline parameter. * expand/rust-macro-builtins.h: Likewise.
2024-08-01gccrs: ast: Add base nodes for FormatArgsArthur Cohen16-0/+191
This commit adds a base for creating AST FormatArgs nodes after expanding invocations of `format_args!()`. These nodes will then be expanded to the proper runtime function calls (to core::fmt::rt) during the AST lowering. gcc/rust/ChangeLog: * ast/rust-builtin-ast-nodes.h: New file. * ast/rust-ast-full-decls.h (class FormatArgs): Declare new class. * ast/rust-ast-collector.cc: Handle FormatArgs nodes properly. * ast/rust-ast-collector.h: Likewise. * ast/rust-ast-full.h: Likewise. * ast/rust-ast-visitor.cc: Likewise. * ast/rust-ast-visitor.h: Likewise. * ast/rust-ast.cc: Likewise. * ast/rust-ast.h: Likewise. * expand/rust-derive.h: Likewise. * hir/rust-ast-lower-base.cc: Likewise. * hir/rust-ast-lower-base.h: Likewise. * hir/rust-ast-lower-expr.cc: Likewise. * hir/rust-ast-lower-expr.h: Likewise. * resolve/rust-ast-resolve-base.cc: Likewise. * resolve/rust-ast-resolve-base.h: Likewise.
2024-08-01gccrs: Make DefaultResolver visit more of the ASTOwen Avery2-16/+91
gcc/rust/ChangeLog: * resolve/rust-default-resolver.cc (DefaultResolver::visit): Visit inner AST nodes of ClosureExprInner, ClosureExprInnerTyped, IfExpr, IfExprConseqElse, MatchExpr, PathInExpression, EnumItemTuple, EnumItemStruct, and EnumItemDiscriminant. * ast/rust-item.h (EnumItemDiscriminant::has_expr): New function. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2024-08-01gccrs: extern-types: Lower to HIR::ExternalTypeItem properlyArthur Cohen2-3/+16
gcc/rust/ChangeLog: * hir/rust-ast-lower-extern.h: Lower to HIR::ExternalTypeItem nodes. * hir/tree/rust-hir-item.h (class ExternalTypeItem): Create private visibility by default as extern types have no visibility - add a comment about the correctness of this.
2024-08-01gccrs: hir: Add ExternalTypeItem nodeArthur Cohen16-3/+230
gcc/rust/ChangeLog: * hir/tree/rust-hir-item.h (class ExternalTypeItem): New class. * hir/tree/rust-hir.cc (ExternalTypeItem::as_string): Likewise. * backend/rust-compile-extern.h: Add base for handling HIR::ExternalTypeItem node. * checks/errors/borrowck/rust-bir-builder-struct.h: Likewise. * checks/errors/borrowck/rust-function-collector.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-extern.h: Likewise. * hir/rust-hir-dump.cc (Dump::visit): Likewise. * hir/rust-hir-dump.h: Likewise. * hir/tree/rust-hir-full-decls.h (class ExternalTypeItem): Likewise. * hir/tree/rust-hir-visitor.h: Likewise. (ExternalTypeItem::accept_vis): Likewise. * typecheck/rust-hir-type-check-implitem.cc (TypeCheckTopLevelExternItem::visit): Likewise. * typecheck/rust-hir-type-check-implitem.h: Likewise.
2024-08-01gccrs: extern-types: Declare external types in name resolver.Arthur Cohen1-0/+19
gcc/rust/ChangeLog: * resolve/rust-ast-resolve-implitem.h: Declare external types as new types.
2024-08-01gccrs: lang-items: Make lang items enum stronger, rename class, cleanup ns.Arthur Cohen17-226/+213
gcc/rust/ChangeLog: * util/rust-lang-item.h (class RustLangItem): Renamed to... (class LangItem): ...this. Rename ItemType enum to Kind * util/rust-lang-item.cc: Rename methods to use new class name. * backend/rust-compile-expr.cc (CompileExpr::visit): Use new lang-item API. (CompileExpr::resolve_operator_overload): Likewise. * backend/rust-compile-expr.h: Likewise. * hir/rust-ast-lower-base.cc (ASTLoweringBase::handle_lang_item_attribute): Likewise. * typecheck/rust-autoderef.cc (Adjuster::try_deref_type): Likewise. (AutoderefCycle::cycle): Likewise. * typecheck/rust-autoderef.h: Likewise. * typecheck/rust-hir-type-bounds.h: Likewise. * typecheck/rust-hir-type-check-base.cc (TypeCheckBase::get_marker_predicate): Likewise. * typecheck/rust-hir-type-check-base.h: Likewise. * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Likewise. * typecheck/rust-hir-type-check-expr.h: Likewise. * typecheck/rust-hir-type-check-type.cc (TypeResolveGenericParam::visit): Likewise. * typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::assemble_sized_builtin): Likewise. (TypeBoundsProbe::assemble_builtin_candidate): Likewise. (TypeCheckBase::get_predicate_from_bound): Likewise. * typecheck/rust-tyty.cc (ClosureType::setup_fn_once_output): Likewise. * util/rust-hir-map.cc (Mappings::get_lang_item): Likewise. (Mappings::lookup_trait_item_lang_item): Likewise. * util/rust-hir-map.h: Likewise.
2024-08-01gccrs: lang-items: Cleanup parsing and lookups of lang items.Arthur Cohen4-507/+206
gcc/rust/ChangeLog: * Make-lang.in: Compile new rust-lang-item.o. * util/rust-lang-item.h: Split into header and source. * util/rust-lang-item.cc: Cleanup parsing of lang items by using a hashmap and returning optional values, cleanup handling of exhaustive lang item lookups. * hir/rust-ast-lower-base.cc (ASTLoweringBase::handle_lang_item_attribute): Use new optional API.
2024-08-01gccrs: Fix small FixMe task in rust macro builtinsjjasmine3-4/+3
gcc/rust/ChangeLog: * expand/rust-macro-builtins.cc: Change BuiltinMacro in builtin_macro_from_string to tl::optional<> * expand/rust-macro-builtins.h (enum class): Change BuiltinMacro in builtin_macro_from_string to tl::optional<> * resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit): Resolved wrong type dependency of builtin_macro_from_string Signed-off-by: jjasmine <tanghocle456@gmail.com>
2024-08-01gccrs: Adjust error checks to match name resolution 2.0Owen Avery6-10/+10
gcc/testsuite/ChangeLog: * rust/compile/bad_stmt_enums.rs: Adjust redefinition error. * rust/compile/bad_toplevel_enums.rs: Likewise. * rust/compile/redef_error1.rs: Likewise. * rust/compile/redef_error3.rs: Likewise. * rust/compile/redef_error4.rs: Likewise. * rust/compile/redef_error6.rs: Likewise. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2024-08-01gccrs: rust-fmt: Store parsed string in Pieces structArthur Cohen2-4/+7
gcc/rust/ChangeLog: * ast/rust-fmt.cc (Pieces::collect): Fix signature to take ownership of the given string. * ast/rust-fmt.h (struct Pieces): Store parsed string in the struct. libgrust/ChangeLog: * libformat_parser/src/lib.rs: Add debug prompt.
2024-08-01gccrs: format_args: Parse entire token invocationArthur Cohen1-18/+22
gcc/rust/ChangeLog: * expand/rust-macro-builtins.cc (MacroBuiltin::format_args_handler): Transform entire invocation token stream into string for the parser.
2024-08-01gccrs: format_args: Parse format string properlyArthur Cohen1-1/+18
gcc/rust/ChangeLog: * expand/rust-macro-builtins.cc (MacroBuiltin::format_args_handler): Construct string to parser properly.
2024-08-01gccrs: libformat_parser: Send boxed values across FFI properlyArthur Cohen2-1/+12
gcc/rust/ChangeLog: * ast/rust-fmt.cc (Pieces::~Pieces): Call libformat_parser's release function in destructor. * ast/rust-fmt.h (struct PieceSlice): Add capacity. (destroy_pieces): New. (struct Pieces): Add destructor. libgrust/ChangeLog: * libformat_parser/src/lib.rs: Leak Boxes properly for C++ to see them, add memory release function.
2024-08-01gccrs: libformat_parser: Update header and remove old interfaceArthur Cohen2-52/+157
gcc/rust/ChangeLog: * ast/rust-fmt.cc (Pieces::collect): Use new Pieces API. * ast/rust-fmt.h: Update interface with new FFI bindings. libgrust/ChangeLog: * libformat_parser/src/lib.rs: Add IntoFFI trait. * libformat_parser/libformat-parser.h: Removed.
2024-08-01gccrs: libformat_parser: Start experimenting with cbindgenArthur Cohen1-2/+2
libgrust/ChangeLog: * libformat_parser/cbindgen.toml: New file. * libformat_parser/libformat-parser.h: New file. gcc/rust/ChangeLog: * ast/rust-fmt.h: Add remaining FFI types.
2024-08-01Rust: Move 'libformat_parser' build into libgrustThomas Schwinge1-15/+1
Addresses #2883. contrib/ * gcc_update (files_and_dependencies): Update for 'libformat_parser' in libgrust. gcc/rust/ * Make-lang.in (LIBFORMAT_PARSER): Point to 'libformat_parser' build in libgrust. (%.toml:, $(LIBFORMAT_PARSER):): Remove. libgrust/ * libformat_parser/Makefile.am: New. * Makefile.am [!TARGET_LIBRARY] (SUBDIRS): Add 'libformat_parser'. * configure.ac: Handle it. (TARGET_LIBRARY): New 'AM_CONDITIONAL'. * libformat_parser/Makefile.in: Generate. * Makefile.in: Regenerate. * configure: Likewise.
2024-08-01Rust: Move 'libformat_parser' build into the GCC build directoryThomas Schwinge1-2/+9
Fixes #2883. gcc/rust/ChangeLog: * Make-lang.in (LIBFORMAT_PARSER): Point to the GCC build directory. * ($(LIBFORMAT_PARSER)): Build in the GCC build directory.
2024-08-01Rust: Don't cache 'libformat_parser.a'Thomas Schwinge1-2/+1
gcc/rust/ * Make-lang.in (LIBFORMAT_PARSER): Point to the actual build artifact. ($(LIBFORMAT_PARSER)): Don't cache it.
2024-08-01gccrs: Add 'gcc/rust/Make-lang.in:LIBFORMAT_PARSER'Thomas Schwinge1-4/+8
... to avoid verbatim repetition. gcc/rust/ * Make-lang.in (LIBPROC_MACRO_INTERNAL): New. (RUST_LIBDEPS, crab1$(exeext), rust/libformat_parser.a): Use it.
2024-08-01gccrs: libgrust: Add format_parser libraryArthur Cohen5-153/+139
Compile libformat_parser and link to it. gcc/rust/ChangeLog: * Make-lang.in: Compile libformat_parser. * ast/rust-fmt.cc: New FFI definitions. * ast/rust-fmt.h: Likewise. * expand/rust-macro-builtins.cc (MacroBuiltin::format_args_handler): Call into libformat_parser. * expand/rust-macro-builtins.h: Define format_args!() handler proper. libgrust/ChangeLog: * libformat_parser/Cargo.lock: New file. * libformat_parser/Cargo.toml: New file. * libformat_parser/generic_format_parser/Cargo.toml: New file. * libformat_parser/generic_format_parser/src/lib.rs: New file. * libformat_parser/src/bin.rs: New file. * libformat_parser/src/lib.rs: New file.
2024-08-01gccrs: fmt: Start working on format_args!() parserArthur Cohen3-0/+230
This commit adds a base class for parsing the various constructs of a Rust format string, according to the grammar in the reference: https://doc.rust-lang.org/std/fmt/index.html#syntax gcc/rust/ChangeLog: * Make-lang.in: Compile rust-fmt object * ast/rust-fmt.cc: New file. * ast/rust-fmt.h: New file.
2024-08-01gccrs: minor cleanup in langhook.type_for_modeMarc Poulhiès1-24/+15
gcc/rust/ChangeLog: * rust-lang.cc (grs_langhook_type_for_mode): simplify code for xImode. Add missing long_double_type_node. Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
2024-08-01gccrs: Fix false positive for top-level AltPatternOwen Avery2-0/+2
gcc/rust/ChangeLog: * hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::visit): Reset is_let_top_level while visiting GroupedPattern. gcc/testsuite/ChangeLog: * rust/compile/let_alt.rs: Check for false positive. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2024-08-01Rust: Make 'tree'-level 'MAIN_NAME_P' workThomas Schwinge1-0/+6
'gcc/tree.h': #define main_identifier_node global_trees[TI_MAIN_IDENTIFIER] #define MAIN_NAME_P(NODE) \ (IDENTIFIER_NODE_CHECK (NODE) == main_identifier_node) ..., which is not initialized by default, but has to be set up by every front end individually. 'MAIN_NAME_P' enables certain code optimizations, but is especially also relevant for back ends that emit additional program entry setup code for 'main'. gcc/rust/ * backend/rust-compile-base.cc (HIRCompileBase::compile_function): For 'main', initialize 'main_identifier_node'.
2024-08-01tree-optimization/114659 - VN and FP to int punningRichard Biener2-7/+66
The following addresses another case where x87 FP loads mangle the bit representation and thus are not suitable for a representative in other types. VN was value-numbering a later integer load of 'x' as the same as a former float load of 'x'. We can use the new TARGET_MODE_CAN_TRANSFER_BITS hook to identify problematic modes and enforce strict compatibility for those in the reference comparison, improving the handling of modes with padding in visit_reference_op_load. PR tree-optimization/114659 * tree-ssa-sccvn.cc (visit_reference_op_load): Do not prevent punning from modes with padding here, but ... (vn_reference_eq): ... ensure this here, also honoring types with modes that cannot act as bit container. * gcc.target/i386/pr114659.c: New testcase.
2024-08-01[x86] implement TARGET_MODE_CAN_TRANSFER_BITSRichard Biener1-0/+22
The following implements the hook, excluding x87 modes for scalar and complex float modes. * config/i386/i386.cc (TARGET_MODE_CAN_TRANSFER_BITS): Define. (ix86_mode_can_transfer_bits): New function.
2024-08-01Add TARGET_MODE_CAN_TRANSFER_BITSRichard Biener4-0/+42
The following adds a target hook to specify whether regs of MODE can be used to transfer bits. The hook is supposed to be used for value-numbering to decide whether a value loaded in such mode can be punned to another mode instead of re-loading the value in the other mode and for SRA to decide whether MODE is suitable as container holding a value to be used in different modes. * target.def (mode_can_transfer_bits): New target hook. * target.h (mode_can_transfer_bits): New function wrapping the hook and providing default behavior. * doc/tm.texi.in: Update. * doc/tm.texi: Re-generate.
2024-08-01AVR: Tweak unsigned comparisons against 256 resp. 65536.Georg-Johann Lay1-2/+34
u16 >= 256 can be performed by testing the hi8 part against 0. u32 >= 65536 can be performed by testing the high word against 0. The optimization is performed in split2 after register allocation because the register allocator likely spills for subregs. gcc/ * config/avr/avr.md (cbranch<mode>4_insn): Split to a test of the high part against 0 if possible.
2024-08-01AVR: Tweak register pressure for const_fixed compares against "M".Georg-Johann Lay2-14/+21
When comparing a 16-bit or 32-bit integer against a constant in the range 0...0xff, constraint M is used because no scratch reg is needed in that case. Same can be done for fixed-point compares. gcc/ * config/avr/constraints.md (YMM): New constraint. * config/avr/avr.md (cmp<mode>3, *cmp<mode>3) (cbranch<mode>4_insn): Allow YMM where M is allowed.
2024-08-01i386: Fix up *<extract_type>_vinsert<shuffletype><extract_suf>_0 [PR115981]Jakub Jelinek3-21/+27
The r14-537 change started canonicalizing VEC_MERGE operands based on swap_commutative_operands_p or if they have the same precedence least significant bit of the third operand. The *<extract_type>_vinsert<shuffletype><extract_suf>_0 pattern was added for combine matching and no longer triggers after that change, as it used the reg_or_0_operand as the first operand and VEC_DUPLICATE as the second. Now, reg_or_0_operand could be a REG, SUBREG of object or CONST_VECTOR. REG has commutative_operand_precedence -1 or -2, SUBREG of object -3, CONST_VECTOR -4, while VEC_DUPLICATE has 0, so VEC_DUPLICATE will always go first and REG, SUBREG or CONST_VECTOR second. This patch swaps the operands so that it matches again. 2024-08-01 Jakub Jelinek <jakub@redhat.com> PR target/115981 * config/i386/sse.md (*<extract_type>_vinsert<shuffletype><extract_suf>_0): Swap the first two VEC_MERGE operands, renumber match_operands and test for 0xF or 0x3 rather than 0xFFF0 or 0xFC immediate. * gcc.target/i386/avx512dq-pr90991-1.c: Add tests for no separate zero extension instructions. * gcc.target/i386/avx512dq-pr90991-2.c: Likewise.
2024-08-01omp-offload.cc: Fix value-expr handling of 'declare target link' vars [PR115637]Tobias Burnus2-4/+9
As the PR and included testcase shows, replacing 'arr2' by its value expression '*arr2$13$linkptr' failed for MEM <uint128_t> [(c_char * {ref-all})&arr2] which left 'arr2' in the code as unknown symbol. Now expand the value expression already in pass_omp_target_link::execute's process_link_var_op walk_gimple_stmt walk - and don't rely on gimple_regimplify_operands. PR middle-end/115637 gcc/ChangeLog: * gimplify.cc (gimplify_body): Fix macro name in the comment. * omp-offload.cc (find_link_var_op): Rename to ... (process_link_var_op): ... this. Replace value expr. (pass_omp_target_link::execute): Update walk_gimple_stmt call. libgomp/ChangeLog: * testsuite/libgomp.fortran/declare-target-link.f90: Uncomment now working code. Co-authored-by: Richard Biener <rguenther@suse.de
2024-08-01i386: Remove ndd support for *add<mode>_4 [PR113744]Lingling Kong1-25/+15
*add<mode>_4 and *adddi_4 are for shorter opcode from cmp to inc/dec or add $128. But NDD code is longer than the cmp code, so there is no need to support ndd. gcc/ChangeLog: PR target/113744 * config/i386/i386.md (*add<mode>_4): Remove ndd support. (*adddi_4): Ditto. Co-Authored-By: Hu, Lin1 <lin1.hu@intel.com>
2024-08-01RISC-V: NFC: Do not use zicond for pr105314 testcasesXiao Zeng3-3/+3
gcc/testsuite/ChangeLog: * gcc.target/riscv/pr105314-rtl.c: Skip zicond. * gcc.target/riscv/pr105314-rtl32.c: Ditto. * gcc.target/riscv/pr105314.c: Ditto. Signed-off-by: Xiao Zeng <zengxiao@eswincomputing.com>
2024-08-01Fix ICE when using -gcodeview with empty structMark Harmstone1-2/+5
Empty structs result in empty LF_FIELDLIST types, which are valid, but we weren't accounting for this and assuming they had to contain subtypes. gcc/ * dwarf2codeview.cc (get_type_num_struct): Fix NULL pointer dereference.
2024-07-31testsuite: split out parts of jit.dg/jit.exp into a new lib/valgrind.expDavid Malcolm2-43/+62
I want to reuse some of the support for valgrind in jit.exp in my upcoming testsuite for https://gcc.gnu.org/wiki/libdiagnostics so this patch splits that out into a valgrind.exp. No functional change intended. gcc/testsuite/ChangeLog: * jit.dg/jit.exp: Add load_lib valgrind.exp. (proc report_leak): Move to valgrind.exp, and add argument leak_report_function rather than hardcoding xfail. (parse_valgrind_logfile): Likewise. (fixed_host_execute): Pass xfail to parse_valgrind_logfile. * lib/valgrind.exp: New file, based on the above. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2024-07-31diagnostics: handle logical locations with NULL nameDavid Malcolm1-1/+2
gcc/ChangeLog: * diagnostic-path.cc (thread_event_printer::print_swimlane_for_event_range): Gracefully handle logical_location::get_name_for_path_output returning null. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2024-07-31testsuite: drop unused import within sarif.pyDavid Malcolm1-1/+0
No functional change intended. gcc/testsuite/ChangeLog: * gcc.dg/sarif-output/sarif.py: Drop unused import of gzip. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2024-07-31diagnostics: SARIF output: capture unlabelled secondary locationsDavid Malcolm4-6/+152
This patch extends * the work done in r15-2291-gd7a688fc960f78 to capture labels on location ranges in rich_locations in SARIF form as "annotations" (§3.28.6) * the work done in r15-2354-g4d1f71d49e396c to support related locations (§3.27.22 and §3.34) so that all location ranges in a rich_location now get captured in the SARIF output: - those with a label are handled as before as "annotations" (§3.28.6), per r15-2291-gd7a688fc960f78 - those without a label now get captured, in the result's "relatedLocations" (§3.27.22) For example, given: int missing_semicolon (void) { return 42 } for which the textual output looks like this: PATH/missing-semicolon.c: In function 'missing_semicolon': PATH/missing-semicolon.c:9:12: error: expected ';' before '}' token 9 | return 42 | ^ | ; 10 | } | ~ with this patch the SARIF output now has this for the result's location: "relationships": [{"target": 0, "kinds": ["relevant"]}]}], where the result gains a related location : "relatedLocations": [{"physicalLocation": {"artifactLocation": { [...snip...] }, "region": {"startLine": 10, "startColumn": 1, "endColumn": 2}, "contextRegion": {"startLine": 10, "snippet": {"text": "}\n"}}}, "id": 0}]}]}]} i.e. that the error also has the secondary location at the trailing close brace which has the relationship "relevant" to the primary location (at the suggested insertion point). The patch also adds test coverage for the SARIF encoding of the fix-it hint. gcc/ChangeLog: * diagnostic-format-sarif.cc (sarif_location_manager::worklist_item::unlabelled_secondary_location): New enum value. (sarif_location_manager::m_unlabelled_secondary_locations): New field. (sarif_location_manager::process_worklist_item): Handle unlabelled secondary locations. (sarif_builder::make_location_object): Generalize code to handle ranges within a rich_location so as well as using annotations for those with labels, we now add related locations for those without labels. gcc/testsuite/ChangeLog: * gcc.dg/sarif-output/missing-semicolon.c: New test. * gcc.dg/sarif-output/sarif.py (get_location_physical_region): New. (get_location_snippet_text): New. * gcc.dg/sarif-output/test-missing-semicolon.py: New test. Signed-off-by: David Malcolm <dmalcolm@redhat.com>