From: Philip Herron <herron.phi...@googlemail.com>

When we check if this is concrete the guard checks to ensure the argument
is non null but the check here is wrongly returning early when the check
is non null meaning when it is null and therefore not concrete it will
end up doing a null dereference.

Signed-off-by: Philip Herron <herron.phi...@googlemail.com>

gcc/rust/ChangeLog:

        * typecheck/rust-tyty-subst.cc (SubstitutionArg::is_conrete): fix check
---
 gcc/rust/typecheck/rust-tyty-subst.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/rust/typecheck/rust-tyty-subst.cc 
b/gcc/rust/typecheck/rust-tyty-subst.cc
index 7f5bb22687d..996bbf2d885 100644
--- a/gcc/rust/typecheck/rust-tyty-subst.cc
+++ b/gcc/rust/typecheck/rust-tyty-subst.cc
@@ -213,8 +213,8 @@ SubstitutionArg::is_error () const
 bool
 SubstitutionArg::is_conrete () const
 {
-  if (argument != nullptr)
-    return true;
+  if (argument == nullptr)
+    return false;
 
   if (argument->get_kind () == TyTy::TypeKind::PARAM)
     return false;
-- 
2.40.0

-- 
Gcc-rust mailing list
Gcc-rust@gcc.gnu.org
https://gcc.gnu.org/mailman/listinfo/gcc-rust

Reply via email to