Identified by clang:

    execute_cmd.c:1506:7: warning: variable 'code' is used uninitialized
    whenever 'if' condition is true [-Wsometimes-uninitialized]
     1506 |   if (posixly_correct && nullcmd)
          |       ^~~~~~~~~~~~~~~~~~~~~~~~~~
    execute_cmd.c:1591:7: note: uninitialized use occurs here
     1591 |   if (code)
          |       ^~~~

And indeed:

    $ bash -o posix -c 'time'
    user    0m0.00s
    sys     0m0.00s
    parse_and_execute: bad jump: 421954587
    Aborting...
---
 execute_cmd.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/execute_cmd.c b/execute_cmd.c
index a0b66015..67223e47 100644
--- a/execute_cmd.c
+++ b/execute_cmd.c
@@ -1513,6 +1513,7 @@ time_command (COMMAND *command, int asynchronous, int 
pipe_in, int pipe_out, str
       before.tms_utime = before.tms_stime = before.tms_cutime = 
before.tms_cstime = 0;
       tbefore = shell_start_time * get_clk_tck ();
 #endif
+      code = 0;
     }
   else
     {
-- 
2.52.0


Reply via email to