Age | Commit message (Collapse) | Author | Files | Lines |
|
|
|
|
|
1751: README.md: Added experimental flag & updated gccrs path r=CohenArthur a=DrMahad
(1) There is a need of the flag "-frust-incomplete-and-experimental-compiler-do-not-use" because the rust1 compiler didn't work without this.
(2) The gccrs was not present in the $HOME/gccrs-install/, so updated the path to $HOME/gccrs-install/bin
Signed-off-by: MAHAD <mahadtxt@gmail.com>
Co-authored-by: MAHAD <mahadtxt@gmail.com>
|
|
(1) There is a need of the flag "-frust-incomplete-and-experimental-compiler-do-not-use" because the rust1 compiler didn't work without this.
(2) The gccrs was not present in the $HOME/gccrs-install/, so updated the path to $HOME/gccrs-install/bin
Signed-off-by: MAHAD <mahadtxt@gmail.com>
|
|
1736: Change how CompileVarDecl outputs Bvariable's r=philberty a=powerboat9
This allows patterns to declare multiple/no variables
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
---
Co-authored-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
This allows patterns to declare multiple/no variables
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
1733: diagnostics: Add underline for tokens in diagnostics. r=CohenArthur a=TuringKi
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.
the results like this:
```
../gcc/testsuite/rust/compile/bad_as_bool_char.rs:5:14: error: invalid cast 'bool' to 'f32' [E0054]
5 | let fone = t as f32; // { dg-error "invalid cast" }
| ^ ~~~
../gcc/testsuite/rust/compile/bad_as_bool_char.rs:6:15: error: invalid cast 'bool' to 'f64' [E0054]
6 | let fzero = f as f64; // { dg-error "invalid cast" }
| ^ ~~~
../gcc/testsuite/rust/compile/bad_as_bool_char.rs:8:12: error: invalid cast 'u8' to 'bool' [E0054]
8 | let nb = 0u8 as bool; // { dg-error "invalid cast .u8. to .bool. \\\[E0054\\\]" }
| ^~~ ~~~~
../gcc/testsuite/rust/compile/bad_as_bool_char.rs:9:12: error: invalid cast 'bool' to 'char' [E0054]
9 | let nc = true as char; // { dg-error "invalid cast" }
| ^~~~ ~~~~
../gcc/testsuite/rust/compile/bad_as_bool_char.rs:13:12: error: invalid cast 'char' to 'f32' [E0054]
13 | let fa = a as f32; // { dg-error "invalid cast" }
| ^ ~~~
../gcc/testsuite/rust/compile/bad_as_bool_char.rs:14:12: error: invalid cast 'char' to 'bool' [E0054]
14 | let bb = b as bool; // { dg-error "invalid cast .char. to .bool. \\\[E0054\\\]" }
| ^ ~~~~
../gcc/testsuite/rust/compile/bad_as_bool_char.rs:17:12: error: invalid cast 'u32' to 'char' [E0054]
17 | let ab = t32 as char; // { dg-error "invalid cast" }
| ^~~ ~~~~
```
This commit is split from pr #1718.
Signed-off-by: Xiao Ma <mxlol233@outlook.com>
Co-authored-by: mxlol233 <mxlol233@outlook.com>
|
|
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.
Signed-off-by: Xiao Ma <mxlol233@outlook.com>
|
|
1734: Add get_locus function for abstract class MetaItemInner. r=CohenArthur a=TuringKi
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.
This commit is split from pr https://github.com/Rust-GCC/gccrs/pull/1718.
Signed-off-by: Xiao Ma <mxlol233@outlook.com>
Co-authored-by: mxlol233 <mxlol233@outlook.com>
|
|
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.
Signed-off-by: Xiao Ma <mxlol233@outlook.com>
|
|
1730: Improve type checking on let statements r=philberty a=powerboat9
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
---
Improves the typechecking of patterns in let statements.
Co-authored-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
Update Rust type-checking to reuse TypeCheckPattern on HIR::LetStmt's.
This will unify the paths and improve error handling.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
1724: Add support for generics associated type binding r=philberty a=philberty
This patch set adds support to specify the associated type via the argument
binding syntax. We are still missing general bounds checking so in order to
properly add more test cases for bad types we need to implement that first.
I have also changed a test case to -fsyntax-only as at the time I always get
confused between Generic arguments of foo=i32 and bar: baz only specifies
the associated type and the latter adds a bound. Currently we are lacking a
way to represent adding a bound in the AST and HIR within generic arguments
so I have raised: #1725 and #1726
Fixes #1720
Co-authored-by: Philip Herron <herron.philip@googlemail.com>
|
|
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
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
gcc/rust/ChangeLog:
* hir/tree/rust-hir-path.h:
* typecheck/rust-hir-path-probe.h:
* typecheck/rust-hir-trait-resolve.cc:
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit):
* typecheck/rust-tyty-bounds.cc (TypeCheckBase::get_predicate_from_bound):
(TypeBoundPredicate::TypeBoundPredicate):
(TypeBoundPredicate::operator=):
(TypeBoundPredicate::apply_generic_arguments):
(TypeBoundPredicateItem::get_tyty_for_receiver):
(TypeBoundPredicate::get_num_associated_bindings):
(TypeBoundPredicate::lookup_associated_type):
(TypeBoundPredicate::get_associated_type_items):
* typecheck/rust-tyty.cc (SubstitutionRef::get_mappings_from_generic_args):
(SubstitutionRef::infer_substitions):
(SubstitutionRef::solve_missing_mappings_from_this):
* typecheck/rust-tyty.h:
gcc/testsuite/ChangeLog:
* rust/compile/bounds.rs: change to use -fsyntax-only
* rust/execute/torture/issue-1720.rs: New test.
|
|
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
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
gcc/rust/ChangeLog:
* resolve/rust-ast-resolve-type.cc (ResolveGenericArgs::go):
|
|
1708: Parse declarative macro (decl_macro 2.0) r=CohenArthur a=tamaroning
This PR is currentry wip.
Opinions and advices are welcome!
Co-authored-by: Raiki Tamura <tamaron1203@gmail.com>
|
|
Signed-off-by: Raiki Tamura <tamaron1203@gmail.com>
|
|
1707: Fix frust very long typo r=CohenArthur a=CohenArthur
Missing space character
1717: format: Fix git whitespace errors r=CohenArthur a=CohenArthur
Addresses #1680
Fixes #1680
Probably does not need a changelog since I assume this commit will just be dropped when we merge
Co-authored-by: Arthur Cohen <arthur.cohen@embecosm.com>
|
|
1711: unsafe: check use of `target_feature` attribute r=CohenArthur a=snprajwal
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.
Addresses #1411
Co-authored-by: Prajwal S N <prajwalnadig21@gmail.com>
|
|
1709: Check const functions for mutable references r=CohenArthur a=dme2
Fixes #1552
Co-authored-by: Dave <dme2223@gmail.com>
|
|
1716: rust: add bound parsing in parse_generic_arg. r=philberty a=TuringKi
This patch adds parsing for generic parameters like: <F: Foo<Bar: Foo>>. In current version, this pattern leads to endless loop.
Co-authored-by: mxlol233 <mxlol233@outlook.com>
|
|
|
|
Signed-off-by: Xiao Ma <mxlol233@outlook.com>
|
|
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
Signed-off-by: Dave Evans <dave@dmetwo.org>
|
|
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.
Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
|
|
1706: Add math intrinsics r=CohenArthur a=tamaroning
Addresses https://github.com/Rust-GCC/gccrs/issues/658
Added math intrinsic functions.
Co-authored-by: Raiki Tamura <tamaron1203@gmail.com>
|
|
|
|
|
|
1700: Merge upstream, last commit before GCC/Rust upstreaming r=CohenArthur a=tschwinge
Co-authored-by: Eric Botcazou <ebotcazou@adacore.com>
Co-authored-by: Richard Biener <rguenther@suse.de>
Co-authored-by: Patrick Palka <ppalka@redhat.com>
Co-authored-by: Jonathan Wakely <jwakely@redhat.com>
Co-authored-by: Harald Anlauf <anlauf@gmx.de>
Co-authored-by: Ian Lance Taylor <iant@golang.org>
Co-authored-by: GCC Administrator <gccadmin@gcc.gnu.org>
Co-authored-by: David Malcolm <dmalcolm@redhat.com>
Co-authored-by: Lulu Cheng <chenglulu@loongson.cn>
Co-authored-by: Alexandre Oliva <oliva@adacore.com>
Co-authored-by: Paul-Antoine Arras <pa@codesourcery.com>
Co-authored-by: Tobias Burnus <tobias@codesourcery.com>
Co-authored-by: Jakub Jelinek <jakub@redhat.com>
Co-authored-by: Martin Liska <mliska@suse.cz>
Co-authored-by: Iskander Shakirzyanov <iskander@ispras.ru>
Co-authored-by: Iain Buclaw <ibuclaw@gdcproject.org>
Co-authored-by: Kyrylo Tkachov <kyrylo.tkachov@arm.com>
Co-authored-by: John David Anglin <danglin@gcc.gnu.org>
|
|
|
|
1704: rust: fix link serialization [PR108113] r=CohenArthur a=dkm
The Make-lang.in was missing the link serialization support.
PR rust/108113
gcc/rust
* Make-lang.in (rust.serial): New variable.
(rust1$(exeext)): Depend on $(rust.prev). Call LINK_PROGRESS.
Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
Co-authored-by: Marc Poulhiès <dkm@kataplop.net>
|
|
The Make-lang.in was missing the link serialization support.
PR rust/108113
gcc/rust
* Make-lang.in (rust.serial): New variable.
(rust1$(exeext)): Depend on $(rust.prev). Call LINK_PROGRESS.
Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
|
|
See GCC upstream commit 7c01d029fca669263b9c2dcb8837c42f7ae3a77f
"Make Warray-bounds alias to Warray-bounds= [PR107787]".
|
|
|
|
|
|
1703: Backport "c++: Quash -Wdangling-reference for member operator* [PR107488]" r=tschwinge a=tschwinge
As had also been reported in <https://gcc.gnu.org/PR107633> "Bootstrap failure due to -Werror=unused-parameter and -Werror=dangling-reference", GCC `--enable-bootstrap` build is currently broken:
[...]/gcc/rust/backend/rust-compile-expr.cc: In member function ‘tree_node* Rust::Compile::CompileExpr::resolve_method_address(Rust::TyTy::FnType*, Rust::HirId, Rust::TyTy::BaseType*, Rust::HIR::PathIdentSegment&, Rust::Analysis::NodeMapping, Location)’:
[...]/gcc/rust/backend/rust-compile-expr.cc:2019:13: error: possibly dangling reference to a temporary [-Werror=dangling-reference]
2019 | auto &candidate = *candidates.begin ();
| ^~~~~~~~~
[...]/gcc/rust/backend/rust-compile-expr.cc:2019:44: note: the temporary was destroyed at the end of the full expression ‘candidates.std::set<Rust::Resolver::PathProbeCandidate>::begin().std::_Rb_tree_const_iterator<Rust::Resolver::PathProbeCandidate>::operator*()’
2019 | auto &candidate = *candidates.begin ();
| ^
[...]/gcc/rust/backend/rust-compile-expr.cc: In member function ‘tree_node* Rust::Compile::CompileExpr::generate_closure_fntype(Rust::HIR::ClosureExpr&, const Rust::TyTy::ClosureType&, tree, Rust::TyTy::FnType**)’:
[...]/gcc/rust/backend/rust-compile-expr.cc:3034:35: error: possibly dangling reference to a temporary [-Werror=dangling-reference]
3034 | const TyTy::TypeBoundPredicate &predicate
| ^~~~~~~~~
[...]/gcc/rust/backend/rust-compile-expr.cc:3035:52: note: the temporary was destroyed at the end of the full expression ‘(&(& closure_tyty)->Rust::TyTy::ClosureType::<anonymous>.Rust::TyTy::BaseType::<anonymous>.Rust::TyTy::TypeBoundsMappings::get_specified_bounds())->std::vector<Rust::TyTy::TypeBoundPredicate>::begin().__gnu_cxx::__normal_iterator<const Rust::TyTy::TypeBoundPredicate*, std::vector<Rust::TyTy::TypeBoundPredicate> >::operator*()’
3035 | = *closure_tyty.get_specified_bounds ().begin ();
| ^
[...]/gcc/rust/typecheck/rust-hir-type-check-path.cc: In member function ‘void Rust::Resolver::TypeCheckExpr::resolve_segments(Rust::NodeId, std::vector<Rust::HIR::PathExprSegment>&, size_t, Rust::TyTy::BaseType*, const Rust::Analysis::NodeMapping&, Location)’:
[...]/gcc/rust/typecheck/rust-hir-type-check-path.cc:340:13: error: possibly dangling reference to a temporary [-Werror=dangling-reference]
340 | auto &candidate = *candidates.begin ();
| ^~~~~~~~~
[...]/gcc/rust/typecheck/rust-hir-type-check-path.cc:340:44: note: the temporary was destroyed at the end of the full expression ‘candidates.std::set<Rust::Resolver::PathProbeCandidate>::begin().std::_Rb_tree_const_iterator<Rust::Resolver::PathProbeCandidate>::operator*()’
340 | auto &candidate = *candidates.begin ();
| ^
[...]/gcc/rust/typecheck/rust-hir-type-check-type.cc: In member function ‘Rust::TyTy::BaseType* Rust::Resolver::TypeCheckType::resolve_segments(Rust::NodeId, Rust::HirId, std::vector<std::unique_ptr<Rust::HIR::TypePathSegment> >&, size_t, Rust::TyTy::BaseType*, const Rust::Analysis::NodeMapping&, Location)’:
[...]/gcc/rust/typecheck/rust-hir-type-check-type.cc:465:13: error: possibly dangling reference to a temporary [-Werror=dangling-reference]
465 | auto &candidate = *candidates.begin ();
| ^~~~~~~~~
[...]/gcc/rust/typecheck/rust-hir-type-check-type.cc:465:44: note: the temporary was destroyed at the end of the full expression ‘candidates.std::set<Rust::Resolver::PathProbeCandidate>::begin().std::_Rb_tree_const_iterator<Rust::Resolver::PathProbeCandidate>::operator*()’
465 | auto &candidate = *candidates.begin ();
| ^
I understand this code has been changed in the GCC/Rust upstream submission; but in order to make progress with #1700, I'd like to first individually backport "c++: Quash -Wdangling-reference for member operator* [PR107488]", to resolve this issue here.
Co-authored-by: Marek Polacek <polacek@redhat.com>
|
|
-Wdangling-reference complains here:
std::vector<int> v = ...;
std::vector<int>::const_iterator it = v.begin();
while (it != v.end()) {
const int &r = *it++; // warning
}
because it sees a call to
__gnu_cxx::__normal_iterator<const int*, std::vector<int> >::operator*
which returns a reference and its argument is a TARGET_EXPR representing
the result of
__gnu_cxx::__normal_iterator<const int*, std::vector<int> >::operator++
But 'r' above refers to one of the int elements of the vector 'v', not
to a temporary object. Therefore the warning is a false positive.
I suppose code like the above is relatively common (the warning broke
cppunit-1.15.1 and a few other projects), so presumably it makes sense
to suppress the warning when it comes to member operator*. In this case
it's defined as
reference
operator*() const _GLIBCXX_NOEXCEPT
{ return *_M_current; }
and I'm guessing a lot of member operator* are like that, at least when
it comes to iterators. I've looked at _Fwd_list_iterator,
_Fwd_list_const_iterator, __shared_ptr_access, _Deque_iterator,
istream_iterator, etc, and they're all like that, so adding #pragmas
would be quite tedious. :/
PR c++/107488
gcc/cp/ChangeLog:
* call.cc (do_warn_dangling_reference): Quash -Wdangling-reference
for member operator*.
gcc/testsuite/ChangeLog:
* g++.dg/warn/Wdangling-reference5.C: New test.
(cherry picked from commit 32a06ce38a38bf37db468f0e6c83520fcc221534)
|
|
1701: Standardize warning flags r=tschwinge a=tschwinge
Bring in #1670, revert #1623 and parts of #1585.
Co-authored-by: Thomas Schwinge <thomas@codesourcery.com>
|
|
|
|
This reverts #1585 commit 94d11161c1abe8927f571aedbf39871f21ccf73a.
Conflicts:
.github/bors_log_expected_warnings
... manually resolved and adjusted; let's see...
|
|
As discussed in
<https://inbox.sourceware.org/gcc-patches/871qpjtmd8.fsf@euler.schwinge.homeip.net>:
> '-Werror=overloaded-virtual' is implied as by default, we have
> '-Woverloaded-virtual' and '-Werror' [for '--enable-bootstrap' builds].
> ([...])
> (Maybe that isn't active for '--disable-bootstrap' builds, but that's
> "OK".)
For '--disable-bootstrap' builds, we still have '-Woverloaded-virtual', and any
new such diagnostics will be caught by the #1026 "check for new warnings"
machinery, so effectively that does implement '-Werror', too.
> '-Wno-unused-parameter' [did] move into
> 'rust-warn'
This reverts #1585 commit a32ef7aa18c45e7047f539b11cd572f0f9502b6d.
|
|
As discussed in
<https://inbox.sourceware.org/gcc-patches/871qpjtmd8.fsf@euler.schwinge.homeip.net>:
> '-Werror=overloaded-virtual' is implied as by default, we have
> '-Woverloaded-virtual' and '-Werror'.
> '-Wno-unused-parameter' [did] move into
> 'rust-warn'
This reverts #1623 commit b3222881f443f2b09e2dd72699def43d5ae928ba.
|
|
(cherry picked from #1670 commit 7ceb5e29c80c1fc91e208ae6955a22b0b73a2e6b)
|
|
|
|
When doing if-conversion we simply throw away labels without checking
whether they are possibly targets of non-local gotos or have their
address taken. The following rectifies this and refuses to if-convert
such loops.
PR tree-optimization/108076
* tree-if-conv.cc (if_convertible_loop_p_1): Reject blocks
with non-local or forced labels that we later remove
labels from.
* gcc.dg/torture/pr108076.c: New testcase.
|
|
The r13-4547 commit added new non-static function to libbacktrace:
backtrace_uncompress_zstd but for the libsanitizer use we need to
rename it, so that it is in __asan_* namespace and doesn't clash
with other copies of libbacktrace.
2022-12-13 Jakub Jelinek <jakub@redhat.com>
libsanitizer/
PR sanitizer/108072
* libbacktrace/backtrace-rename.h (backtrace_uncompress_zstd): Define.
|
|
This patch enables "have_cbranchcc4" on rs6000 by defining a
"cbranchcc4" expander. "have_cbrnachcc4" is a flag in ifcvt.cc to
indicate if branching by CC bits is valid or not. With this flag
enabled, some branches can be optimized to conditional moves.
2022-12-07 Haochen Gui <guihaoc@linux.ibm.com>
gcc/
* config/rs6000/rs6000.md (cbranchcc4): New expander.
gcc/testsuite
* gcc.target/powerpc/cbranchcc4-1.c: New.
* gcc.target/powerpc/cbranchcc4-2.c: New.
|
|
prepare_cmp_insn is a help function to generate comparison rtx.
It should not assume that cbranchcc4 exists and all sub-CC modes
are supported on a target. When the check fails, it could go to
fail and return a NULL rtx as its callers check the return value
for CCmode.
The test case (gcc.target/powerpc/cbranchcc4-1.c) which covers
failure path will be committed with an rs6000 specific patch.
2022-12-05 Haochen Gui <guihaoc@linux.ibm.com>
gcc/
* optabs.cc (prepare_cmp_insn): Return a NULL rtx other than
assertion failure when targets don't have cbranch optab or
predicate check fails.
|
|
|
|
This patch broke a couple of different patterns; reverting while I work on a
fix.
PR c++/108701
This reverts commit bd0485f20f4794f9787237706a6308473a8e9415.
|