diff --git a/src/plugins/dive/build.ml b/src/plugins/dive/build.ml
index 9c984adfd1cf1989343520d76fe019b9f7ae9c72..078d015efca2d002e5cdbf5416ddb2b56934db29 100644
--- a/src/plugins/dive/build.ml
+++ b/src/plugins/dive/build.ml
@@ -513,11 +513,10 @@ let build_node_reads context node =
   and build_args_deps callstack zone stmt args callee_kf =
     let callstack = Callstack.push (callee_kf,stmt) callstack in
     let formals = Kernel_function.get_formals callee_kf in
-    try
-      List.iter2 (build_arg_dep callstack stmt zone) args formals
-    (* Invalid_argument happens for Frama_C_show_each which does not have
-       any formal but can have any arguments. *)
-    with Invalid_argument _ -> ()
+    (* For Frama_C_show_each and functions called through pointers, there may
+       be more arguments than formal parameters declared. *)
+    let used_args = Extlib.list_first_n (List.length formals) args in
+    List.iter2 (build_arg_dep callstack stmt zone) used_args formals
 
   and build_arg_dep callstack stmt zone arg formal =
     if exp_contains_read zone stmt arg then