aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPhilip Herron <herron.philip@googlemail.com>2020-05-26 17:43:19 +0100
committerPhilip Herron <philip.herron@embecosm.com>2020-11-28 21:13:15 +0000
commit6a9ddc71985f33dbe9e22a3dff99533f881f5ba1 (patch)
tree04bae1069dc029e00a07542436c94cfbd4b04365 /gcc
parent121ebe3f8338aeef47846cef83e4108c5e3aa0e6 (diff)
downloadgcc-6a9ddc71985f33dbe9e22a3dff99533f881f5ba1.zip
gcc-6a9ddc71985f33dbe9e22a3dff99533f881f5ba1.tar.gz
gcc-6a9ddc71985f33dbe9e22a3dff99533f881f5ba1.tar.bz2
Ensure number of arguments match number of parameters to function before type analysis
Diffstat (limited to 'gcc')
-rw-r--r--gcc/rust/analysis/rust-type-resolution.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/rust/analysis/rust-type-resolution.cc b/gcc/rust/analysis/rust-type-resolution.cc
index f79da50..03f3d27 100644
--- a/gcc/rust/analysis/rust-type-resolution.cc
+++ b/gcc/rust/analysis/rust-type-resolution.cc
@@ -471,6 +471,14 @@ TypeResolution::visit (AST::CallExpr &expr)
if (fndecl == NULL)
return;
+ // check num args match
+ if (fndecl->function_params.size () != expr.params.size ())
+ {
+ rust_error_at (expr.get_locus_slow (),
+ "differing number of arguments vs parameters to function");
+ return;
+ }
+
typeBuffer.push_back (fndecl->return_type.get ());
expr.fndeclRef = fndecl;