From: "Yu, Mingli" <mingli.yu@windriver.com>
To: <openembedded-core@lists.openembedded.org>,
<richard.purdie@linuxfoundation.org>
Subject: Re: [PATCH] gcc-sanitizers: fix -Werror=maybe-uninitialized issue
Date: Tue, 26 Mar 2019 09:37:10 +0800 [thread overview]
Message-ID: <5C998246.6050506@windriver.com> (raw)
In-Reply-To: <1552985080-65398-1-git-send-email-mingli.yu@windriver.com>
Ping.
Thanks,
On 2019年03月19日 16:44, mingli.yu@windriver.com wrote:
> From: Mingli Yu <Mingli.Yu@windriver.com>
>
> When DEBUG_BUILD = "1" added in local.conf, there
> comes below build error when "bitbake gcc-sanitizers":
> | ./../../../../../../../../work-shared/gcc-8.3.0-r0/gcc-8.3.0/libsanitizer/libbacktrace/../../libbacktrace/elf.c: In function 'elf_is_symlink':
> | ../../../../../../../../../work-shared/gcc-8.3.0-r0/gcc-8.3.0/libsanitizer/libbacktrace/../../libbacktrace/elf.c:772:21: error: 'st.st_mode' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> | return S_ISLNK (st.st_mode);
>
> Initialize st_mode member to fix the above issue.
>
> Signed-off-by: Mingli Yu <Mingli.Yu@windriver.com>
> ---
> meta/recipes-devtools/gcc/gcc-8.3.inc | 1 +
> .../0041-elf.c-initialize-st_mode-member.patch | 33 ++++++++++++++++++++++
> 2 files changed, 34 insertions(+)
> create mode 100644 meta/recipes-devtools/gcc/gcc-8.3/0041-elf.c-initialize-st_mode-member.patch
>
> diff --git a/meta/recipes-devtools/gcc/gcc-8.3.inc b/meta/recipes-devtools/gcc/gcc-8.3.inc
> index f7bf257..3501325 100644
> --- a/meta/recipes-devtools/gcc/gcc-8.3.inc
> +++ b/meta/recipes-devtools/gcc/gcc-8.3.inc
> @@ -71,6 +71,7 @@ SRC_URI = "\
> file://0038-Re-introduce-spe-commandline-options.patch \
> file://0039-riscv-Disable-multilib-for-OE.patch \
> file://0040-powerpc-powerpc64-Add-support-for-musl-ldso.patch \
> + file://0041-elf.c-initialize-st_mode-member.patch \
> "
> SRC_URI[md5sum] = "65b210b4bfe7e060051f799e0f994896"
> SRC_URI[sha256sum] = "64baadfe6cc0f4947a84cb12d7f0dfaf45bb58b7e92461639596c21e02d97d2c"
> diff --git a/meta/recipes-devtools/gcc/gcc-8.3/0041-elf.c-initialize-st_mode-member.patch b/meta/recipes-devtools/gcc/gcc-8.3/0041-elf.c-initialize-st_mode-member.patch
> new file mode 100644
> index 0000000..8e80c4e
> --- /dev/null
> +++ b/meta/recipes-devtools/gcc/gcc-8.3/0041-elf.c-initialize-st_mode-member.patch
> @@ -0,0 +1,33 @@
> +From 960f3e1f104192ceb80a97e665fadffda5285aab Mon Sep 17 00:00:00 2001
> +From: Mingli Yu <Mingli.Yu@windriver.com>
> +Date: Tue, 19 Mar 2019 16:23:04 +0800
> +Subject: [PATCH] elf.c: initialize st_mode member
> +
> +Initialize st_mode member to fix the below
> +build failure when -Og included in compiler flag.
> +| ./../../../../../../../../work-shared/gcc-8.3.0-r0/gcc-8.3.0/libsanitizer/libbacktrace/../../libbacktrace/elf.c: In function 'elf_is_symlink':
> +| ../../../../../../../../../work-shared/gcc-8.3.0-r0/gcc-8.3.0/libsanitizer/libbacktrace/../../libbacktrace/elf.c:772:21: error: 'st.st_mode' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> + return S_ISLNK (st.st_mode);
> +
> +Upstream-Status: Submitted[https://gcc.gnu.org/ml/gcc-patches/2019-03/msg00900.html]
> +
> +Signed-off-by: Mingli Yu <Mingli.Yu@windriver.com>
> +---
> + libbacktrace/elf.c | 1 +
> + 1 file changed, 1 insertion(+)
> +
> +diff --git a/libbacktrace/elf.c b/libbacktrace/elf.c
> +index f4863f0..561bdc2 100644
> +--- a/libbacktrace/elf.c
> ++++ b/libbacktrace/elf.c
> +@@ -766,6 +766,7 @@ static int
> + elf_is_symlink (const char *filename)
> + {
> + struct stat st;
> ++ st.st_mode = 0;
> +
> + if (lstat (filename, &st) < 0)
> + return 0;
> +--
> +2.7.4
> +
>
next prev parent reply other threads:[~2019-03-26 1:31 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-19 8:44 [PATCH] gcc-sanitizers: fix -Werror=maybe-uninitialized issue mingli.yu
2019-03-26 1:37 ` Yu, Mingli [this message]
2019-04-04 9:36 ` Yu, Mingli
2019-04-05 22:01 ` Khem Raj
2019-04-08 6:40 ` [PATCH v2] " mingli.yu
2019-04-09 2:32 ` [PATCH v3] " mingli.yu
2019-04-09 3:53 ` Khem Raj
2019-04-15 9:27 ` Yu, Mingli
2019-04-15 9:38 ` Adrian Bunk
2019-04-15 14:19 ` Khem Raj
2019-04-15 16:21 ` Adrian Bunk
2019-04-16 8:45 ` Yu, Mingli
2019-04-16 18:00 ` Khem Raj
2019-04-17 7:49 ` Yu, Mingli
2019-04-17 17:14 ` Khem Raj
2019-04-22 5:45 ` Yu, Mingli
2019-04-22 8:41 ` [PATCH v4] " mingli.yu
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-all 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=5C998246.6050506@windriver.com \
--to=mingli.yu@windriver.com \
--cc=openembedded-core@lists.openembedded.org \
--cc=richard.purdie@linuxfoundation.org \
/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