aboutsummaryrefslogtreecommitdiff
path: root/gcc
AgeCommit message (Collapse)AuthorFilesLines
2023-04-06gccrs: Implement lowering ReferencePattern from AST to HIROwen Avery3-0/+34
gcc/rust/ChangeLog: * ast/rust-pattern.h: (ReferencePattern::is_double_reference): Add method. (ReferencePattern::get_is_mut): Add method. * hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::visit): Add ReferencePattern visitor. * hir/rust-ast-lower-pattern.h: (ASTLoweringPattern::visit): Add ReferencePattern visitor. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2023-04-06gccrs: Optimize HIR::ReferencePatternOwen Avery2-13/+5
gcc/rust/ChangeLog: * hir/tree/rust-hir-pattern.h (class ReferencePattern): Remove has_two_amps field. * hir/tree/rust-hir-full-test.cc (ReferencePattern::as_string): Remove usage of ReferencePattern::has_two_amps. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2023-04-06gccrs: Remove HIR::GroupedPatternOwen Avery17-132/+0
gcc/rust/ChangeLog: * backend/rust-compile-fnparam.h (CompileFnParam::visit): Remove HIR::GroupedPattern visitor. * backend/rust-compile-pattern.cc (CompilePatternCaseLabelExpr::visit): Remove HIR::GroupedPattern visitor. (CompilePatternBindings::visit): Remove HIR::GroupedPattern visitor. * backend/rust-compile-pattern.h (CompilePatternCaseLabelExpr::visit): Remove HIR::GroupedPattern visitor. (CompilePatternBindings::visit): Remove HIR::GroupedPattern visitor. (CompilePatternLet::visit): Remove HIR::GroupedPattern visitor. * backend/rust-compile-resolve-path.h (ResolvePathRef::visit): Remove HIR::GroupedPattern visitor. * backend/rust-compile-var-decl.h (CompileVarDecl::visit): Remove HIR::GroupedPattern visitor. * checks/errors/rust-const-checker.cc (ConstChecker::visit): Remove HIR::GroupedPattern visitor. * checks/errors/rust-const-checker.h (ConstChecker::visit): Remove HIR::GroupedPattern visitor. * checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): Remove HIR::GroupedPattern visitor. * checks/errors/rust-unsafe-checker.h (UnsafeChecker::visit): Remove HIR::GroupedPattern visitor. * hir/rust-hir-dump.cc (Dump::visit): Remove HIR::GroupedPattern visitor. * hir/rust-hir-dump.h (Dump::visit): Remove HIR::GroupedPattern visitor. * hir/tree/rust-hir-full-decls.h (class GroupedPattern): Remove class. * hir/tree/rust-hir-full-test.cc (GroupedPattern::accept_vis): Remove method. * hir/tree/rust-hir-pattern.h (class GroupedPattern): Remove class. * hir/tree/rust-hir-visitor.h (HIRFullVisitor::visit): Remove HIR::GroupedPattern visitor. (HIRFullVisitorBase::visit): Remove HIR::GroupedPattern visitor. (HIRPatternVisitor::visit): Remove HIR::GroupedPattern visitor. * typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): Remove HIR::GroupedPattern visitor. * typecheck/rust-hir-type-check-pattern.h (TypeCheckPattern::visit): Remove HIR::GroupedPattern visitor. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2023-04-06gccrs: Improve GroupedPattern loweringOwen Avery1-11/+1
gcc/rust/ChangeLog: * hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::visit): Lower AST::GroupedPattern to its inner pattern. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2023-04-06gccrs: Move rust-buffered-queue.h to util folder #1766MAHAD1-0/+0
gcc/rust/ChangeLog: * rust-buffered-queue.h: Moved to... * util/rust-buffered-queue.h: ...here. Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
2023-04-06gccrs: parser: Allow parsing multiple reference typesArthur Cohen3-6/+41
The parser now recursively tries to parse a reference type after seeing a `&` or `&&` token. gcc/rust/ChangeLog: * parse/rust-parse-impl.h (Parser::parse_type): Handle double ampersan properly (Parser::parse_reference_type): Call into `parse_reference_type_inner` and wrap double reference types in another `AST::ReferenceType` node (Parser::parse_reference_type_inner): Add parsing implementation which does not care about the leading token (& or &&) (Parser::parse_type_no_bounds): Handle double ampersand properly * parse/rust-parse.h: Declare `parse_reference_type_inner` gcc/testsuite/ChangeLog: * rust/compile/multi_reference_type.rs: New test.
2023-04-06gccrs: Create and use CompilePatternLet visitor for compiling let statmentsOwen Avery3-28/+148
gcc/rust/ChangeLog: * backend/rust-compile-pattern.cc (CompilePatternLet::visit): New function. * backend/rust-compile-stmt.cc (CompileStmt::visit): Likewise. * backend/rust-compile-pattern.h (class CompilePatternLet): New visitor. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2023-04-06gccrs: macro: Allow builtin `MacroInvocation`s within the ASTArthur Cohen3-56/+126
gcc/rust/ChangeLog: * ast/rust-macro.h (enum class): Add `BuiltinMacro` enum class. * expand/rust-attribute-visitor.cc (AttrVisitor::visit): Mention switching on `macro.kind` once builtin macro invocations are properly handled. * parse/rust-parse-impl.h (Parser::parse_macro_invocation): Switch to new MacroInvocation API. (Parser::parse_type): Likewise. (Parser::parse_type_no_bounds): Likewise.
2023-04-06gccrs: fixed indentations in AST pretty expanded dump of traitAbdul Rafey1-6/+1
gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): removed extra indentations in trait ast dump Signed-off-by: Abdul Rafey <abdulrafeyq@gmail.com>
2023-04-06gccrs: fixed compiler error message on wildcard pattern within expressionAbdul Rafey2-0/+14
gcc/rust/ChangeLog: * parse/rust-parse-impl.h (Parser::null_denotation): Add proper error when seeing wildcard var on right side of assignment. gcc/testsuite/ChangeLog: * rust/compile/issue-867.rs: New test. Signed-off-by: Abdul Rafey <abdulrafeyq@gmail.com>
2023-04-06gccrs: moved operator.h to util/rust-operators.hAbdul Rafey6-5/+5
gcc/rust/ChangeLog: * ast/rust-ast.cc: Fix include list. * ast/rust-expr.h: Likewise. * hir/tree/rust-hir-expr.h: Likewise. * rust-backend.h: Likewise. * util/rust-lang-item.h: Likewise. * operator.h: Moved to... * util/rust-operators.h: ...here. Signed-off-by: Abdul Rafey <abdulrafeyq@gmail.com>
2023-04-06gccrs: Rename file rust-ast-full-test.cc to rust-ast.ccParthib2-1/+1
gcc/rust/ChangeLog: * Make-lang.in: Rename object file. * ast/rust-ast-full-test.cc: Moved to... * ast/rust-ast.cc: ...here.
2023-04-06gccrs: Added missing GroupedPattern visitors for code generationOwen Avery2-2/+14
gcc/rust/ChangeLog: * backend/rust-compile-pattern.cc (CompilePatternCaseLabelExpr::visit): Add proper visitor. (CompilePatternBindings::visit): Likewise. * backend/rust-compile-pattern.h: Declare them. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2023-04-06gccrs: Add type resolution for grouped patternsOwen Avery1-3/+5
gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): Add proper visitor. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2023-04-06gccrs: Add get_item method for HIR::GroupedPatternOwen Avery1-0/+6
gcc/rust/ChangeLog: * hir/tree/rust-hir-pattern.h: Add get_item method. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2023-04-06gccrs: Add HIR lowering for GroupedPatternOwen Avery2-0/+17
gcc/rust/ChangeLog: * hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::visit): Add proper visitor. * hir/rust-ast-lower-pattern.h: Declare it. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2023-04-06gccrs: Do not crash on empty macros expand. Fixes #1712Lyra2-0/+9
This commit fixes a compiler crash when expanding an empty macro into an existing AST. gcc/rust/ChangeLog: * expand/rust-macro-expand.cc (transcribe_expression): Fix ICE when expanding empty macros. gcc/testsuite/ChangeLog: * rust/compile/macro45.rs: New test. Signed-off-by: Lyra Karenai <teromene@teromene.fr>
2023-04-06gccrs: Support GroupedPattern during name resolutionOwen Avery1-0/+5
gcc/rust/ChangeLog: * resolve/rust-ast-resolve-pattern.h: Support GroupedPattern properly. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2023-04-06gccrs: testsuite: Handle Windows carriage returns properlyArthur Cohen87-109/+104
In dg-output, check for \r* carriage returns to make sure execution tests pass on windows platforms gcc/testsuite/ChangeLog: * rust/execute/torture/builtin_macro_cfg.rs: Handle carriage returns properly. * rust/execute/torture/builtin_macro_concat.rs: Likewise. * rust/execute/torture/builtin_macro_env.rs: Likewise. * rust/execute/torture/builtin_macro_include_bytes.rs: Likewise. * rust/execute/torture/builtin_macro_include_str.rs: Likewise. * rust/execute/torture/builtin_macro_line.rs: Likewise. * rust/execute/torture/builtin_macros1.rs: Likewise. * rust/execute/torture/builtin_macros3.rs: Likewise. * rust/execute/torture/cfg1.rs: Likewise. * rust/execute/torture/cfg2.rs: Likewise. * rust/execute/torture/cfg3.rs: Likewise. * rust/execute/torture/cfg4.rs: Likewise. * rust/execute/torture/coercion1.rs: Likewise. * rust/execute/torture/coercion2.rs: Likewise. * rust/execute/torture/extern_mod4.rs: Likewise. * rust/execute/torture/helloworld1.rs: Likewise. * rust/execute/torture/helloworld2.rs: Likewise. * rust/execute/torture/issue-1198.rs: Likewise. * rust/execute/torture/issue-1231.rs: Likewise. * rust/execute/torture/issue-1232.rs: Likewise. * rust/execute/torture/issue-1249.rs: Likewise. * rust/execute/torture/issue-1436.rs: Likewise. * rust/execute/torture/issue-1496.rs: Likewise. * rust/execute/torture/issue-647.rs: Likewise. * rust/execute/torture/issue-845.rs: Likewise. * rust/execute/torture/issue-851.rs: Likewise. * rust/execute/torture/issue-858.rs: Likewise. * rust/execute/torture/issue-976.rs: Likewise. * rust/execute/torture/macros10.rs: Likewise. * rust/execute/torture/macros11.rs: Likewise. * rust/execute/torture/macros12.rs: Likewise. * rust/execute/torture/macros13.rs: Likewise. * rust/execute/torture/macros14.rs: Likewise. * rust/execute/torture/macros2.rs: Likewise. * rust/execute/torture/macros22.rs: Likewise. * rust/execute/torture/macros29.rs: Likewise. * rust/execute/torture/macros3.rs: Likewise. * rust/execute/torture/macros30.rs: Likewise. * rust/execute/torture/macros31.rs: Likewise. * rust/execute/torture/macros7.rs: Likewise. * rust/execute/torture/macros8.rs: Likewise. * rust/execute/torture/macros9.rs: Likewise. * rust/execute/torture/match1.rs: Likewise. * rust/execute/torture/match2.rs: Likewise. * rust/execute/torture/match3.rs: Likewise. * rust/execute/torture/match_bool1.rs: Likewise. * rust/execute/torture/match_byte1.rs: Likewise. * rust/execute/torture/match_char1.rs: Likewise. * rust/execute/torture/match_int1.rs: Likewise. * rust/execute/torture/match_loop1.rs: Likewise. * rust/execute/torture/match_range1.rs: Likewise. * rust/execute/torture/match_range2.rs: Likewise. * rust/execute/torture/match_tuple1.rs: Likewise. * rust/execute/torture/method1.rs: Likewise. * rust/execute/torture/method2.rs: Likewise. * rust/execute/torture/method3.rs: Likewise. * rust/execute/torture/method4.rs: Likewise. * rust/execute/torture/operator_overload_1.rs: Likewise. * rust/execute/torture/operator_overload_10.rs: Likewise. * rust/execute/torture/operator_overload_11.rs: Likewise. * rust/execute/torture/operator_overload_12.rs: Likewise. * rust/execute/torture/operator_overload_2.rs: Likewise. * rust/execute/torture/operator_overload_4.rs: Likewise. * rust/execute/torture/operator_overload_5.rs: Likewise. * rust/execute/torture/operator_overload_6.rs: Likewise. * rust/execute/torture/operator_overload_7.rs: Likewise. * rust/execute/torture/operator_overload_8.rs: Likewise. * rust/execute/torture/operator_overload_9.rs: Likewise. * rust/execute/torture/str-layout1.rs: Likewise. * rust/execute/torture/str-zero.rs: Likewise. * rust/execute/torture/trait1.rs: Likewise. * rust/execute/torture/trait10.rs: Likewise. * rust/execute/torture/trait11.rs: Likewise. * rust/execute/torture/trait12.rs: Likewise. * rust/execute/torture/trait13.rs: Likewise. * rust/execute/torture/trait2.rs: Likewise. * rust/execute/torture/trait3.rs: Likewise. * rust/execute/torture/trait4.rs: Likewise. * rust/execute/torture/trait5.rs: Likewise. * rust/execute/torture/trait6.rs: Likewise. * rust/execute/torture/trait7.rs: Likewise. * rust/execute/torture/trait8.rs: Likewise. * rust/execute/torture/trait9.rs: Likewise. * rust/execute/torture/closure2.rs: Likewise. * rust/execute/torture/closure3.rs: Likewise. * rust/execute/torture/loop-condition-eval.rs: Likewise. * rust/execute/torture/operator_overload_3.rs: Likewise.
2023-04-06gccrs: Change how CompileVarDecl outputs Bvariable'sOwen Avery2-14/+16
This allows patterns to declare multiple/no variables gcc/rust/ChangeLog: * backend/rust-compile-base.cc (HIRCompileBase::compile_locals_for_block): Allow patterns to declare zero or multiple variables. * backend/rust-compile-var-decl.h: Change function declaration. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2023-04-06gccrs: diagnostics: Add underline for tokens in diagnostics.mxlol2332-0/+72
Currently, the diagnostics only point to the corresponding token's start position by carets, and lack of underlines for full token. This commit add support for such underlines in diagnostics by encoding range information in location_t. gcc/rust/ChangeLog: * lex/rust-lex.cc (Lexer::build_token): Make location enclose entire token. (Lexer::parse_byte_char): Likewise. (Lexer::parse_byte_string): Likewise. (Lexer::parse_raw_byte_string): Likewise. (Lexer::parse_raw_identifier): Likewise. (Lexer::parse_string): Likewise. (Lexer::parse_identifier_or_keyword): Likewise. (Lexer::parse_raw_string): Likewise. (Lexer::parse_non_decimal_int_literal): Likewise. (Lexer::parse_decimal_int_or_float): Likewise. (Lexer::parse_char_or_lifetime): Likewise. gcc/testsuite/ChangeLog: * rust/compile/diagnostic_underline.rs: New test. Signed-off-by: Xiao Ma <mxlol233@outlook.com>
2023-04-06gccrs: Add get_locus function for abstract class MetaItemInner.mxlol2333-0/+22
This commit adds virtual function get_locus to base class MetaItemInner, which is helpful when we need to print diagnostics on some sub-classes of MetaItemInner. gcc/rust/ChangeLog: * ast/rust-ast.h: Add get_locus method. * ast/rust-expr.h: Likewise. * ast/rust-macro.h: Likewise. Signed-off-by: Xiao Ma <mxlol233@outlook.com>
2023-04-06gccrs: Reuse TypeCheckPattern on LetStmt'sOwen Avery1-8/+6
Update Rust type-checking to reuse TypeCheckPattern on HIR::LetStmt's. This will unify the paths and improve error handling. gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-stmt.cc (TypeCheckStmt::visit): Cleanup LetStmt type checking. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2023-04-06gccrs: Support associated type bound argumentsPhilip Herron9-38/+236
This patch adds support for the GenercArgsBinding type, where you can specify the associated types of a trait bound using `<Foo=i32>` style syntax. Note that the type-resolution relys on the i32 impl for Add as type resolution will resolve the `a+a` to the core::ops::Add method so code generation will require this to exist. I have ameded testsuite/rust/compile/bounds.rs as this code is wrongly creating an HIR::GenericArgs with a trait-object type and causing issues. the parsing is still correct but we dont have the mechanism to represent this in AST and HIR properly. I think we will need a new HIR::GenericArgs AssociatedTypeBindingBound or something similar. We are still lacking bounds checking during are type coercions and unifications so running this example using an f32 will wrongly pass type checking, this will need addressed next. Fixes #1720 gcc/rust/ChangeLog: * hir/tree/rust-hir-path.h: Add const get_identifier and get_type method. * typecheck/rust-hir-path-probe.h: Use new SubstitutionArgumentMappings constructor. * typecheck/rust-hir-trait-resolve.cc: Likewise. * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Likewise. * typecheck/rust-tyty-bounds.cc (TypeCheckBase::get_predicate_from_bound): Do not assert failure on size mismatch anymore. (TypeBoundPredicate::TypeBoundPredicate): Use new SubstitutionArgumentMappings constructor. (TypeBoundPredicate::operator=): Likewise. (TypeBoundPredicate::apply_generic_arguments): Likewise. (TypeBoundPredicateItem::get_tyty_for_receiver): Likewise. (TypeBoundPredicate::get_num_associated_bindings): Likewise. (TypeBoundPredicate::lookup_associated_type): Fix implementation for new system. (TypeBoundPredicate::get_associated_type_items): Likewise. * typecheck/rust-tyty.cc (SubstitutionRef::get_mappings_from_generic_args): Add new behavior. (SubstitutionRef::infer_substitions): Use new constructor and add comment. (SubstitutionRef::solve_missing_mappings_from_this): Use new constructor. * typecheck/rust-tyty.h: Define new constructors. gcc/testsuite/ChangeLog: * rust/compile/bounds.rs: change to use -fsyntax-only * rust/execute/torture/issue-1720.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
2023-04-06gccrs: Add name resolution to generic argument associated item bindingsPhilip Herron1-0/+5
When specifying generic arguments to Traits we can also specify the associated types using `<BindingName=i32>` syntax we need to add name resolution to the type argument here and rely on the type resolution pass to ensure the associated type exists and to setup the associated types accordingly. Addresses #1720 gcc/rust/ChangeLog: * resolve/rust-ast-resolve-type.cc (ResolveGenericArgs::go): Add name resolution to Trait items. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
2023-04-06gccrs: Implement declarative macro 2.0 parserRaiki Tamura19-80/+301
gcc/rust/ChangeLog: * ast/rust-ast-full-decls.h (class MacroItem): Remove forward declaration. * ast/rust-ast-full-test.cc (MacroRulesDefinition): Rework MacroRulesDefinition class * ast/rust-ast.h (class MacroItem): Remove abstract class. * ast/rust-item.h (class MacroItem): Remove forward declaration. * ast/rust-macro.h (class MacroItem): Likewise. (class MacroRulesDefinition): Add MacroKind enum. (class MacroInvocation): Fix inheritance. * lex/rust-token.h: Token "macro" is now used. * parse/rust-parse-impl.h (Parser::parse_item): Add handling for MACRO. (Parser::parse_vis_item): Call into parse_decl_macro_def. (Parser::parse_macro_item): Delete function. (Parser::parse_macro_rules_def): Return MBE macros only. (Parser::parse_decl_macro_def): New function. (Parser::parse_stmt): Handle MACRO token. (Parser::parse_stmt_or_expr_without_block): Call into parse_macro_rules_def. * parse/rust-parse.h: Declare new function. gcc/testsuite/ChangeLog: * rust/compile/decl_macro1.rs: New test. * rust/compile/decl_macro2.rs: New test. * rust/compile/decl_macro3.rs: New test. * rust/compile/decl_macro4.rs: New test. * rust/compile/decl_macro5.rs: New test. * rust/compile/decl_macro6.rs: New test. * rust/compile/decl_macro7.rs: New test. * rust/execute/torture/decl_macro1.rs: New test. * rust/execute/torture/decl_macro2.rs: New test. * rust/execute/torture/decl_macro3.rs: New test. * rust/execute/torture/decl_macro4.rs: New test. Signed-off-by: Raiki Tamura <tamaron1203@gmail.com>
2023-04-06gccrs: rust: add bound parsing in parse_generic_arg.mxlol2332-0/+27
gcc/rust/ChangeLog: * parse/rust-parse-impl.h (Parser::parse_generic_arg): Add proper bound parsing. gcc/testsuite/ChangeLog: * rust/compile/bounds.rs: New test. Signed-off-by: Xiao Ma <mxlol233@outlook.com>
2023-04-06gccrs: Check for mutable references in const functionsDave2-2/+9
Use StackedContext instead. Fix error string Signed-off-by: Dave Evans <dave@dmetwo.org> (Squashed commits) Check for mutable references in const functions using StackedContext gcc/rust/ChangeLog: * checks/errors/rust-const-checker.cc (ConstChecker::visit): Use StackedContext class. gcc/testsuite/ChangeLog: * rust/compile/const10.rs: New test. Signed-off-by: Dave Evans <dave@dmetwo.org>
2023-04-06gccrs: unsafe: check use of `target_feature` attributePrajwal S N4-1/+44
The `target_feature` attribute is for conditional compilation and may or may not compile on all platforms. Using it requires an unsafe function or block. gcc/rust/ChangeLog: * checks/errors/rust-unsafe-checker.cc (check_target_attr): New function. (UnsafeChecker::check_function_attr): Call into `check_target_attr`. (UnsafeChecker::visit): Check for target_feature attributes. * checks/errors/rust-unsafe-checker.h: Add declarations. * util/rust-attributes.cc: Add attribute. gcc/testsuite/ChangeLog: * rust/compile/unsafe11.rs: New test. Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
2023-04-06gccrs: fatal_error_flag: Fix typo in error messageArthur Cohen1-1/+1
gcc/rust/ChangeLog: * rust-session-manager.cc (Session::compile_crate): Fix typo.
2023-04-06[testsuite] enable -maltivec like vect_int for signbit-2.cAlexandre Oliva1-0/+1
Explicitly enable altivec if it's supported. vect_int tests for powerpc_altivec_ok, but without the explicit option, if altivec is not enabled by default, we end up expecting vectorization that doesn't occur. for gcc/testsuite/ChangeLog * gcc.dg/signbit-2.c: Add -maltivec if supported.
2023-04-05Fix typo in -param=vect-induction-float= attributesAndrew Pinski1-1/+1
There was a typo in the attributes of the option -param=vect-induction-float= for IntegerRange. This fixes that typo. Committed as obvious after a build/test. gcc/ChangeLog: PR tree-optimization/109427 * params.opt (-param=vect-induction-float=): Fix option attribute typo for IntegerRange.
2023-04-05testsuite: fix proc unsupported overriding in modules.exp [PR108899]Alexandre Oliva1-9/+11
The overrider of proc unsupported in modules.exp had two problems reported by Thomas Schwinge, even after Jakub Jelínek's fix: - it remained in effect while running other dejagnu testsets - it didn't quote correctly the argument list passed to it, which caused test names to be surrounded by curly braces, as in: UNSUPPORTED: {...} This patch fixes both issues, obsoleting and reverting Jakub's change, by dropping the overrider and renaming the saved proc back, and by using uplevel's argument list splicing. Co-authored-by: Thomas Schwinge <thomas@codesourcery.com> for gcc/testsuite/ChangeLog PR testsuite/108899 * g++.dg/modules/modules.exp (unsupported): Drop renaming. Fix quoting.
2023-04-06Daily bump.GCC Administrator4-1/+85
2023-04-05PR modula2/109423 cc1gm2 ICE if an INCL or EXCL is performed on an unknown setGaius Mulley16-32/+27
This patch fixes an ICE if attempting to INCL or EXCL on an unknown set. The fix was to correct an error format string. Also included in the patch are patches to remove unused variables. The patch also marks a variable as written in BuildAdr. gcc/m2/ChangeLog: PR modula2/109423 * gm2-compiler/M2Base.def (Unbounded): Remove. * gm2-compiler/M2Error.def (ErrorAbort0): Add noreturn attribute. * gm2-compiler/M2Quads.mod (BuildInclProcedure): Correct error format string. (BuildExceptProcedure): Correct error format string. (BuildAdrFunction): Call PutWriteQuad when taking the address of a variable. * gm2-libs-ch/SysExceptions.c (_M2_SysExceptions_init): Add parameters. * gm2-libs-ch/wrapc.c (_M2_wrapc_init): Add parameters. * gm2-libs/DynamicStrings.mod (DumpStringInfo): Remove t. (PopAllocationExemption): Remove f. * gm2-libs/FIO.mod (BufferedWrite): Remove result. * gm2-libs/FormatStrings.mod (Copy): Remove endpos and afterperc. (HandlePercent): Remove result. * gm2-libs/Indexing.mod (RemoveIndiceFromIndex): Remove k. * gm2-libs/M2Dependent.mod (CreateModule): Remove p0 and p1. (DumpModuleData): Remove mptr. (ConstructModules): Remove nulp. * gm2-libs/RTExceptions.mod (PopHandler): Remove i. * gm2-libs/RTint.mod (Listen): Remove b4s, b4m, afs and afm. * gm2-libs/SFIO.mod (ReadS): Remove c. * gm2-libs/StringConvert.mod (doDecimalPlaces): Remove whole and fraction. gcc/testsuite/ChangeLog: * gm2/pim/fail/setunknown.mod: New test. PR modula2/109423 * gm2/pim/fail/setunknown2.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-04-05[RFA][Bug target/108892 ][13 regression] Force re-recognition after changing ↵Jeff Law2-0/+24
RTL structure of an insn So as mentioned in the PR the underlying issue here is combine changes the form of an existing insn, but fails to force re-recognition. As a result other parts of the compiler blow up. > /* Temporarily replace the set's source with the > contents of the REG_EQUAL note. The insn will > be deleted or recognized by try_combine. */ > rtx orig_src = SET_SRC (set); rtx orig_dest = SET_DEST (set); if (GET_CODE (SET_DEST (set)) == ZERO_EXTRACT) > SET_DEST (set) = XEXP (SET_DEST (set), 0); > SET_SRC (set) = note; > i2mod = temp; > i2mod_old_rhs = copy_rtx (orig_src); > i2mod_new_rhs = copy_rtx (note); > next = try_combine (insn, i2mod, NULL, NULL, > &new_direct_jump_p, last_combined_insn); > i2mod = NULL; > if (next) > { > statistics_counter_event (cfun, "insn-with-note combine", 1); > goto retry; > } SET_SRC (set) = orig_src; > SET_DEST (set) = orig_dest; This code replaces the SET_SRC of an insn in the RTL stream with the contents of a REG_EQUAL note. So given an insn like this: > (insn 122 117 127 2 (set (reg:DI 157 [ _46 ]) > (ior:DI (reg:DI 200) > (reg:DI 251))) "j.c":14:5 -1 > (expr_list:REG_EQUAL (const_int 25769803782 [0x600000006]) > (nil))) It replaces the (ior ...) with a (const_int ...). The resulting insn is passed to try_combine which will try to recognize it, then use it in a combination attempt. Recognition succeeds with the special define_insn_and_split pattern in the risc-v backend resulting in: > (insn 122 117 127 2 (set (reg:DI 157 [ _46 ]) > (const_int 25769803782 [0x600000006])) "j.c":14:5 177 {*mvconst_internal} > (expr_list:REG_EQUAL (const_int 25769803782 [0x600000006]) > (nil))) This is as-expected. Now assume we were unable to combine anything, so try_combine returns NULL_RTX. The quoted code above restores SET_SRC (and SET_DEST) resulting in: > (insn 122 117 127 2 (set (reg:DI 157 [ _46 ]) > (ior:DI (reg:DI 200) > (reg:DI 251))) "j.c":14:5 177 {*mvconst_internal} > (expr_list:REG_EQUAL (const_int 25769803782 [0x600000006]) > (nil))) But this doesn't get re-recognized and we ICE later in LRA. The fix is trivial, reset the INSN_CODE to force re-recognition in the case where try_combine fails. PR target/108892 gcc/ * combine.cc (combine_instructions): Force re-recognition when after restoring the body of an insn to its original form. gcc/testsuite/ * gcc.c-torture/compile/pr108892.c: New test.
2023-04-05ipa: Avoid another ICE when dealing with type-incompatibilities (PR 108959)Martin Jambor2-0/+88
PR 108959 shows one more example where undefined code with type incompatible accesses to stuff passed in parameters can cause an ICE because we try to create a VIEW_CONVERT_EXPR of mismatching sizes: 1. IPA-CP tries to push one type from above, 2. IPA-SRA (correctly) decides the parameter is useless because it is only used to construct an argument to another function which does not use it and so the formal parameter should be removed, 3. but the code reconciling IPA-CP and IPA-SRA transformations still wants to perform the IPA-CP and overrides the built-in DCE of useless statements and tries to stuff constants into them instead, constants of a type with mismatching type and size. This patch avoids the situation in IPA-SRA by purging the IPA-CP results from any "aggregate" constants that are passed in parameters which are detected to be useless. It also removes IPA value range and bits information associated with removed parameters stored in the same structure so that the useless information is not streamed later on. gcc/ChangeLog: 2023-03-22 Martin Jambor <mjambor@suse.cz> PR ipa/108959 * ipa-sra.cc (zap_useless_ipcp_results): New function. (process_isra_node_results): Call it. gcc/testsuite/ChangeLog: 2023-03-17 Martin Jambor <mjambor@suse.cz> PR ipa/108959 * gcc.dg/ipa/pr108959.c: New test.
2023-04-05[PATCH] RISC-V: Fix SEW64 of vrsub.vx runtime fail in RV32 systemJu-Zhe Zhong2-1/+436
It's quite obvious that the order of vrsub SEW64 is wrong. gcc/ChangeLog: * config/riscv/vector.md: Fix incorrect operand order. gcc/testsuite/ChangeLog: * g++.target/riscv/rvv/base/bug-23.C: New test.
2023-04-04[PATCH] RISC-V: Fix PR109399 VSETVL PASS bugJuzhe-Zhong2-1/+21
PR 109399 gcc/ChangeLog: * config/riscv/riscv-vsetvl.cc (pass_vsetvl::compute_local_backward_infos): Update user vsetvl in local demand fusion. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/vsetvl/pr109399.c: New test.
2023-04-04RISC-V: Fix typosLi Xu3-6/+5
gcc/ChangeLog: * config/riscv/riscv-vector-builtins.def: Fix typo. * config/riscv/riscv.cc (riscv_dwarf_poly_indeterminate_value): Ditto. * config/riscv/vector-iterators.md: Ditto.
2023-04-05Daily bump.GCC Administrator6-1/+147
2023-04-05doc: md.texi (Including Patterns): Fix page breakHans-Peter Nilsson1-2/+1
The line-break in the example looked odd, even more so with a page-break in the middle of it, due to recently added text in preceding pages. * doc/md.texi (Including Patterns): Fix page break.
2023-04-04Regenerate gcc.potJoseph Myers1-7630/+7764
* gcc.pot: Regenerate.
2023-04-04Fortran: reject module variable as character length in PARAMETER [PR104349]Harald Anlauf3-2/+10
gcc/fortran/ChangeLog: PR fortran/104349 * expr.cc (check_restricted): Adjust check for valid variables in restricted expressions: make no exception for module variables. gcc/testsuite/ChangeLog: PR fortran/104349 * gfortran.dg/der_charlen_1.f90: Adjust dg-patterns. * gfortran.dg/pr104349.f90: New test.
2023-04-04range-op-float: Fix reverse ops of comparisons [PR109386]Jakub Jelinek2-16/+37
I've missed one of my recent range-op-float.cc changes (likely the r13-6967 one) caused FAIL: libphobos.phobos/std/math/algebraic.d execution test FAIL: libphobos.phobos_shared/std/math/algebraic.d execution test regressions, distilled into a C testcase below. In the testcase, we have !(u >= v) condition where both u and v are results of fabs*, which guards t1 = u u<= __FLT_MAX__; and t2 = v u<= __FLT_MAX__; comparisons. From false u >= v where u and v have [0.0, +Inf] NAN ranges we (incorrectly deduce that one of them is [nextafterf (0.0, 1.0), +Inf] NAN and the other is [0.0, nextafterf (+Inf, 0.0)] NAN and from that deduce that one of the comparisons is always true, because UNLE_EXPR with the maximum representable number are false only if the value is +Inf and our ranges tell that is not possible. The bug is that the u >= v comparison determines a sensible range only when it is true - we then know neither operand can be NAN and it behaves correctly. But when the comparison is false, our current code gives sensible answers only if the other op can't be NAN. If it can be NAN, whenever it is NAN, the comparison is always false regardless of the other value, so the other value needs to be VARYING. Now, foperator_unordered_lt::op1_range etc. had code to deal with that for op?.known_nan (), but as the testcase shows, it is enough if it may be a NAN at runtime to make it VARYING. So, the following patch replaces for all those BRS_FALSE cases of the normal non-equality comparisons if (opOTHER.known_isnan ()) r.set_varying (type); to do it also if maybe_isnan (). For the unordered or ... comparisons, it is similar for BRS_TRUE. Those comparisons are true whenever either operand is NAN, or if neither is NAN, the corresponding normal comparison. So, if those comparisons are true and other operand might be a NAN, we can't tell (VARYING), if it is false, currently handling is correct. 2023-04-04 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/109386 * range-op-float.cc (foperator_lt::op1_range, foperator_lt::op2_range, foperator_le::op1_range, foperator_le::op2_range, foperator_gt::op1_range, foperator_gt::op2_range, foperator_ge::op1_range, foperator_ge::op2_range): Make r varying for BRS_FALSE case even if the other op is maybe_isnan, not just known_isnan. (foperator_unordered_lt::op1_range, foperator_unordered_lt::op2_range, foperator_unordered_le::op1_range, foperator_unordered_le::op2_range, foperator_unordered_gt::op1_range, foperator_unordered_gt::op2_range, foperator_unordered_ge::op1_range, foperator_unordered_ge::op2_range): Make r varying for BRS_TRUE case even if the other op is maybe_isnan, not just known_isnan. * gcc.c-torture/execute/ieee/pr109386.c: New test.
2023-04-04sanitizer: missing signed integer overflow errors [PR109107]Marek Polacek6-4/+101
Here we're failing to detect a signed overflow with -O because match.pd, since r8-1516, transforms c = (a + 1) - (int) (short int) b; into c = (int) ((unsigned int) a + 4294946117); wrongly eliding the overflow. This kind of problems is usually avoided by using TYPE_OVERFLOW_SANITIZED in the appropriate place. The first match.pd hunk in the patch fixes it. I've constructed a testcase for each of the surrounding cases as well. Then I noticed that fold_binary_loc/associate has the same problem, so I've added a TYPE_OVERFLOW_SANITIZED there as well (it may be too coarse, sorry). Then I found yet another problem, but instead of fixing it now I've opened 109134. I could probably go on and find a dozen more. PR sanitizer/109107 gcc/ChangeLog: * fold-const.cc (fold_binary_loc): Use TYPE_OVERFLOW_SANITIZED when associating. * match.pd: Use TYPE_OVERFLOW_SANITIZED. gcc/testsuite/ChangeLog: * c-c++-common/ubsan/pr109107-1.c: New test. * c-c++-common/ubsan/pr109107-2.c: New test. * c-c++-common/ubsan/pr109107-3.c: New test. * c-c++-common/ubsan/pr109107-4.c: New test.
2023-04-04arm: Fix vcreate definitionStam Markianos-Wright11-32/+32
From the initial merge of the MVE backend, the vcreate intrinsic has had the vector lanes mixed up, compared to the intended (as per the ACLE) definition. This is also a discrepancy with clang: https://godbolt.org/z/4n93e5aqj This patches simply switches the operands around and makes the tests more specific on the input registers (I do not touch the output Q regs as they vary based on softfp/hardfp or the input registers when the input is a constant, since, in that case, a single register is loaded with a constant and then the same register is used twice as "vmov q0[2], q0[0], r2, r2" and the reg num might not always be guaranteed). gcc/ChangeLog: * config/arm/mve.md (mve_vcvtq_n_to_f_<supf><mode>): Swap operands. (mve_vcreateq_f<mode>): Swap operands. gcc/testsuite/ChangeLog: * gcc.target/arm/mve/intrinsics/vcreateq_f16.c: Tighten test. * gcc.target/arm/mve/intrinsics/vcreateq_f32.c: Tighten test. * gcc.target/arm/mve/intrinsics/vcreateq_s16.c: Tighten test. * gcc.target/arm/mve/intrinsics/vcreateq_s32.c: Tighten test. * gcc.target/arm/mve/intrinsics/vcreateq_s64.c: Tighten test. * gcc.target/arm/mve/intrinsics/vcreateq_s8.c: Tighten test. * gcc.target/arm/mve/intrinsics/vcreateq_u16.c: Tighten test. * gcc.target/arm/mve/intrinsics/vcreateq_u32.c: Tighten test. * gcc.target/arm/mve/intrinsics/vcreateq_u64.c: Tighten test. * gcc.target/arm/mve/intrinsics/vcreateq_u8.c: Tighten test.
2023-04-04amdgcn: Add 64-bit vector notAndrew Stubbs1-0/+17
gcc/ChangeLog: * config/gcn/gcn-valu.md (one_cmpl<mode>2<exec>): New.
2023-04-04riscv: Fix bootstrap [PR109384]Jakub Jelinek2-5/+4
The following patch unbreaks riscv bootstrap, where it previously failed on -Werror=format-diag warning promoted to error. Ok for trunk? Or shall it say e.g. "%<-march=%s%>: %<zfinx%> extension conflicts with %<f>" ? Or say if the current condition is true, do const char *ext = "zfinx"; if (subset_list->lookup ("zdinx")) ext = "zdinx"; else if (subset_list->lookup ("zhinx")) ext = "zhinx"; else if (subset_list->lookup ("zhinxmin")) ext = "zhinxmin"; and "%<-march=%s%>: %qs extension conflicts with %<f>", arch, ext ? Or do similar check for which extension to print against it, const char *ext = "zfinx"; const char *ext2 = "f"; if (subset_list->lookup ("zdinx")) { ext = "zdinx"; if (subset_list->lookup ("d")) ext2 = "d"; } else if (subset_list->lookup ("zhinx")) { ext = "zhinx"; if (subset_list->lookup ("zfh")) ext2 = "zfh"; } else if (subset_list->lookup ("zhinxmin")) { ext = "zhinxmin"; if (subset_list->lookup ("zfhmin")) ext2 = "zfhmin"; } "%<-march=%s%>: %qs extension conflicts with %qs", arch, ext, ext2 ? 2023-04-04 Jakub Jelinek <jakub@redhat.com> PR target/109384 * common/config/riscv/riscv-common.cc (riscv_subset_list::parse): Reword diagnostics about zfinx conflict with f, formatting fixes. * gcc.target/riscv/arch-19.c: Expect a different message about zfinx vs. f conflict.
2023-04-04config: -pthread shouldn't link with -lpthread on SolarisRainer Orth1-1/+0
libpthread has been folded into libc since Solaris 10 and replaced by a filter on libc. Linking with libpthread thus only creates unnecessary runtime overhead. This patch thus removes linking with -lpthread if -pthread/-pthreads is specified, thus getting rid of the libpthread dependency in libatomic, libgdruntime, libgomp, libgphobos, and libitm. Bootstrapped without regressions on i386-pc-solaris2.11 and sparc-sun-solaris2.11 (both Solaris 11.3 and 11.4). 2023-04-03 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> gcc: * config/sol2.h (LIB_SPEC): Don't link with -lpthread.