Message ID | 1552984665-64586-1-git-send-email-mingli.yu@windriver.com |
---|---|
State | New |
Headers | show |
Series | elf.c: initialize st_mode member | expand |
Ping. Thanks, On 2019年03月19日 16:37, mingli.yu@windriver.com wrote: > From: Mingli Yu <Mingli.Yu@windriver.com> > > 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); > > 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; >
On 4/1/19 12:03 AM, Yu, Mingli wrote: > Ping. > > Thanks, > > On 2019年03月19日 16:37, mingli.yu@windriver.com wrote: >> From: Mingli Yu <Mingli.Yu@windriver.com> >> >> 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); We already wet through this with someone else. Use -O2 rather than -Og or -O1 when compiling that file. THe warning is a false positive and the higher optimization levels jeff
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;