public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] Fix nullptr when resolving the root of a path expression
@ 2022-06-08 12:37 Thomas Schwinge
0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2022-06-08 12:37 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:1d19dd8a691fd3fcc6214e99d9da5bc9fcb1c122
commit 1d19dd8a691fd3fcc6214e99d9da5bc9fcb1c122
Author: Philip Herron <philip.herron@embecosm.com>
Date: Mon Apr 25 17:57:24 2022 +0100
Fix nullptr when resolving the root of a path expression
When we resolve paths we don't have a _type_, in this senario there is a
bug in our resolution of this generic function so this means the root_tyty
is nullptr but the offset is non zero so we return nullptr.
Addresses #1132
Diff:
---
gcc/rust/typecheck/rust-hir-type-check-path.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/rust/typecheck/rust-hir-type-check-path.cc b/gcc/rust/typecheck/rust-hir-type-check-path.cc
index e2fa7f5e9ac..530f630d5ec 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-path.cc
+++ b/gcc/rust/typecheck/rust-hir-type-check-path.cc
@@ -178,7 +178,7 @@ TypeCheckExpr::resolve_root_path (HIR::PathInExpression &expr, size_t *offset,
HIR::PathExprSegment &seg = expr.get_segments ().at (i);
bool have_more_segments = (expr.get_num_segments () - 1 != i);
- bool is_root = *offset == 0;
+ bool is_root = *offset == 0 || root_tyty == nullptr;
NodeId ast_node_id = seg.get_mappings ().get_nodeid ();
// then lookup the reference_node_id
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-06-08 12:37 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-08 12:37 [gcc/devel/rust/master] Fix nullptr when resolving the root of a path expression Thomas Schwinge
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).