From: "Gerd Hoffmann" <kraxel@redhat.com>
To: devel@edk2.groups.io
Cc: Pawel Polawski <ppolawsk@redhat.com>,
Liming Gao <gaoliming@byosoft.com.cn>,
Yuwei Chen <yuwei.chen@intel.com>,
Oliver Steffen <osteffen@redhat.com>,
Bob Feng <bob.c.feng@intel.com>,
Gerd Hoffmann <kraxel@redhat.com>
Subject: [PATCH 2/3] BaseTools: fix gcc12 warning
Date: Thu, 24 Mar 2022 13:04:35 +0100 [thread overview]
Message-ID: <20220324120436.939688-3-kraxel@redhat.com> (raw)
In-Reply-To: <20220324120436.939688-1-kraxel@redhat.com>
Sdk/C/LzmaEnc.c: In function ‘LzmaEnc_CodeOneMemBlock’:
Sdk/C/LzmaEnc.c:2828:19: error: storing the address of local variable ‘outStream’ in ‘*p.rc.outStream’ [-Werror=dangling-pointer=]
2828 | p->rc.outStream = &outStream.vt;
| ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
Sdk/C/LzmaEnc.c:2811:28: note: ‘outStream’ declared here
2811 | CLzmaEnc_SeqOutStreamBuf outStream;
| ^~~~~~~~~
Sdk/C/LzmaEnc.c:2811:28: note: ‘pp’ declared here
Sdk/C/LzmaEnc.c:2828:19: error: storing the address of local variable ‘outStream’ in ‘*(CLzmaEnc *)pp.rc.outStream’ [-Werror=dangling-pointer=]
2828 | p->rc.outStream = &outStream.vt;
| ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
Sdk/C/LzmaEnc.c:2811:28: note: ‘outStream’ declared here
2811 | CLzmaEnc_SeqOutStreamBuf outStream;
| ^~~~~~~~~
Sdk/C/LzmaEnc.c:2811:28: note: ‘pp’ declared here
cc1: all warnings being treated as errors
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c b/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c
index 4e9b499f8d80..4b9f5fa69248 100644
--- a/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c
+++ b/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c
@@ -2825,12 +2825,13 @@ SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, BoolInt reInit,
nowPos64 = p->nowPos64;
RangeEnc_Init(&p->rc);
- p->rc.outStream = &outStream.vt;
if (desiredPackSize == 0)
return SZ_ERROR_OUTPUT_EOF;
+ p->rc.outStream = &outStream.vt;
res = LzmaEnc_CodeOneBlock(p, desiredPackSize, *unpackSize);
+ p->rc.outStream = NULL;
*unpackSize = (UInt32)(p->nowPos64 - nowPos64);
*destLen -= outStream.rem;
--
2.35.1
next prev parent reply other threads:[~2022-03-24 12:04 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-24 12:04 [PATCH 0/3] BaseTools: patches to build with gcc12 Gerd Hoffmann
2022-03-24 12:04 ` [PATCH 1/3] BaseTools: fix gcc12 warning Gerd Hoffmann
2022-03-24 12:04 ` Gerd Hoffmann [this message]
2022-03-24 12:04 ` [PATCH 3/3] Basetools: turn off " Gerd Hoffmann
2022-03-28 21:29 ` [edk2-devel] " Rebecca Cran
2022-03-29 4:00 ` Bob Feng
2022-03-29 18:14 ` grant
2022-03-29 21:38 ` Andrew Fish
[not found] ` <16E0F7C6F57A7FEC.28871@groups.io>
2022-03-29 21:39 ` Andrew Fish
2022-03-26 13:57 ` [edk2-devel] [PATCH 0/3] BaseTools: patches to build with gcc12 Bob Feng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220324120436.939688-3-kraxel@redhat.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox