[PATCH v2] elf.c: initialize struct stat

Khem Raj raj.khem@gmail.com
Tue Apr 9 04:37:00 GMT 2019


On Mon, Apr 8, 2019 at 6:47 PM Yu, Mingli <mingli.yu@windriver.com> wrote:
>
>
>
> On 2019年04月08日 22:21, Jeff Law wrote:
> > On 4/8/19 12:34 AM, mingli.yu@windriver.com wrote:
> >> From: Mingli Yu <Mingli.Yu@windriver.com>
> >>
> >> Initialize struct stat 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);
> >>
> >> Signed-off-by: Mingli Yu <Mingli.Yu@windriver.com>
> >> ---
> >>   libbacktrace/elf.c | 2 +-
> >>   1 file changed, 1 insertion(+), 1 deletion(-)
> > This is a false positive in -Wuninitialized that can be worked around by
> > compiling with -O2.  Please do that rather than compiling with -Og.
>
> Thanks Jeff for your respond!
>
> Hi Khem,
>
> If so, do we need to just to add some logic as DEBUG_OPTIMIZATION_append
> = " -Wno-error" for gcc-sanitizers to avoid -Og indicating the
> -Werror=maybe-uninitialized message?
>

yeah that would be fine.

> Thanks,
>
> >
> > jeff
> >



More information about the Gcc-patches mailing list