[Bug libfortran/82962] valgrind reports "Conditional jump or move depends on uninitialised value" in EXECUTE_COMMAND_LINE

janus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Nov 13 12:13:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82962

--- Comment #1 from janus at gcc dot gnu.org ---
Possible patch:

Index: libgfortran/intrinsics/execute_command_line.c
===================================================================
--- libgfortran/intrinsics/execute_command_line.c       (revision 254678)
+++ libgfortran/intrinsics/execute_command_line.c       (working copy)
@@ -145,10 +145,11 @@ execute_command_line_i4 (const char *command, GFC_
                         gfc_charlen_type cmdmsg_len)
 {
   bool w = wait ? *wait : true;
-  int estat, estat_initial, cstat;
+  const int estat_initial = -100;
+  int estat, cstat;

   if (exitstat)
-    estat_initial = estat = *exitstat;
+    estat = estat_initial;

   execute_command_line (command, w, &estat, cmdstat ? &cstat : NULL,
                        cmdmsg, command_len, cmdmsg_len);


Question is: What's a suitable value for estat_initial?

The same changes need to apply to execute_command_line_i8 as well.


More information about the Gcc-bugs mailing list