aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPhilip Herron <herron.philip@googlemail.com>2023-05-05 17:16:08 +0100
committerArthur Cohen <arthur.cohen@embecosm.com>2024-01-16 18:37:15 +0100
commitc6f1b887e8f52ba6252ad83e03cbea41af326f6e (patch)
treecc5e46f34050a06f4bf8fac3c40230f1af695a5e /gcc
parentaf874e4bcd601e2fac3598c122641db6f3b1d95c (diff)
downloadgcc-c6f1b887e8f52ba6252ad83e03cbea41af326f6e.zip
gcc-c6f1b887e8f52ba6252ad83e03cbea41af326f6e.tar.gz
gcc-c6f1b887e8f52ba6252ad83e03cbea41af326f6e.tar.bz2
gccrs: Fix ICE in check for unused global variables
Calling get variable expression will return an expression but we are checking for unused decls so lets actually pass the decl. Addresses #2188 gcc/rust/ChangeLog: * checks/lints/rust-lint-unused-var.cc (UnusedVariables::Lint): use the decl not the expr Signed-off-by: Philip Herron <herron.philip@googlemail.com>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/rust/checks/lints/rust-lint-unused-var.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/gcc/rust/checks/lints/rust-lint-unused-var.cc b/gcc/rust/checks/lints/rust-lint-unused-var.cc
index f60cfac..4928fb2 100644
--- a/gcc/rust/checks/lints/rust-lint-unused-var.cc
+++ b/gcc/rust/checks/lints/rust-lint-unused-var.cc
@@ -17,7 +17,7 @@
// <http://www.gnu.org/licenses/>.
#include "rust-lint-unused-var.h"
-#include "print-tree.h"
+#include "rust-gcc.h"
namespace Rust {
namespace Analysis {
@@ -84,8 +84,8 @@ UnusedVariables::Lint (Compile::Context &ctx)
for (auto &var : ctx.get_var_decls ())
{
- tree t = ctx.get_backend ()->var_expression (var, Location ());
- check_decl (&t);
+ tree decl = var->get_decl ();
+ check_decl (&decl);
}
for (auto &const_decl : ctx.get_const_decls ())