Hi.  Thanks for the report.

Gianfranco Costamagna writes ("Bug#968734: chiark-tcl: FTBFS with optimization 
level -O3 and gcc-10 on s390x"):
> Hello, In Ubuntu the package FTBFS on s390x, because of -O3, and some non 
> initialized variables.

How odd.

> This makes no sense, because the variables are passed by reference
> to the functions, but gcc is probably not smart enough to detect it.

I think it is more likely that it can see into blockcipher_prep, but
not follow the control flow.  Perhaps, for example, it doesn't know
that cht_staticerr always returns nonzero, and it thinks that those
error paths in blockcipher_prep might end up using the values in the
caller.

Instead of your suggestion, if you can easily do so, can you try
this ?

Regards,
Ian.

>From 020f536563e566c6a17eeb790d2a5e56141e2b74 Mon Sep 17 00:00:00 2001
From: Ian Jackson <ijack...@chiark.greenend.org.uk>
Date: Thu, 20 Aug 2020 19:18:14 +0100
Subject: [PATCH] blockcipher_prep: Initialise out parameters to placate gcc

These are all set on the success exit path but GCC is not clever
enough to see this.

Closes: #968734
Signed-off-by: Ian Jackson <ijack...@chiark.greenend.org.uk>
---
 crypto/crypto.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/crypto/crypto.c b/crypto/crypto.c
index aee2556..6efea24 100644
--- a/crypto/crypto.c
+++ b/crypto/crypto.c
@@ -252,6 +252,14 @@ static int blockcipher_prep(Tcl_Interp *ip, Tcl_Obj 
*key_obj,
   int rc;
   CiphKeyValue *key;
 
+  /* placate gcc, see Debian #968734 */
+  *key_r= 0;
+  *sched_r= 0;
+  *iv_r= 0;
+  *iv_lenbytes_r= 0;
+  *buffers_r= 0;
+  *nblocks_r= 0;
+
   if (data_len % alg->blocksize)
     return cht_staticerr(ip, "block cipher input not whole number of blocks",
                     "HBYTES BLOCKCIPHER LENGTH");
-- 
2.20.1

Reply via email to