|
From: Jacek M. H. <jac...@gm...> - 2018-01-09 13:11:07
|
Dear Sirs,
this is Ubuntu 14.04.5 LTS / x86_64 / gcc (Ubuntu
4.8.4-2ubuntu1~14.04.3) 4.8.4.
While compiling the most current GIT version (as of today), I get some
warnings:
----------------------------------------------------------------------
gcc -DHAVE_CONFIG_H -I. -I.. -I.. -I../include -I../include
-I../VEX/pub -I../VEX/pub -DVGA_amd64=1 -DVGO_linux=1
-DVGP_amd64_linux=1 -DVGPV_amd64_linux_vanilla=1 -I../coregrind
-DVG_LIBDIR="\"/usr/local/lib/valgrind"\" -DVG_PLATFORM="\
"amd64-linux\"" -m64 -O2 -finline-functions -g -std=gnu99 -Wall
-Wmissing-prototypes -Wshadow -Wpointer-arith -Wstrict-prototypes
-Wmissing-declarations -Wcast-align -Wcast-qual -Wwrite-strings
-Wempty-body -Wformat -Wformat-security -W
ignored-qualifiers -Wmissing-parameter-type -Wold-style-declaration
-fno-stack-protector -fno-strict-aliasing -fno-builtin
-fomit-frame-pointer -DENABLE_LINUX_TICKET_LOCK -MT
libcoregrind_amd64_linux_a-m_libcbase.o -MD -MP -MF .deps/li
bcoregrind_amd64_linux_a-m_libcbase.Tpo -c -o
libcoregrind_amd64_linux_a-m_libcbase.o `test -f 'm_libcbase.c' || echo
'./'`m_libcbase.c
m_libcbase.c: In function ‘vgPlain_parse_enum_set’:
m_libcbase.c:645:19: warning: ‘tokens_saveptr’ may be used uninitialized
in this function [-Wmaybe-uninitialized]
for (p = s; *p != '\0'; ++p) {
^
m_libcbase.c:572:11: note: ‘tokens_saveptr’ was declared here
HChar *tokens_saveptr;
^
m_libcbase.c:645:19: warning: ‘input_saveptr’ may be used uninitialized
in this function [-Wmaybe-uninitialized]
for (p = s; *p != '\0'; ++p) {
^
m_libcbase.c:580:11: note: ‘input_saveptr’ was declared here
HChar *input_saveptr;
^
----------------------------------------------------------------------
Hope it helps,
Best regards,
Jacek.
|
|
From: Philippe W. <phi...@sk...> - 2018-01-09 18:59:27
|
The compiler warning messages look somewhat fishy:
* they speak about a variable (e.g. tokens_saveptr)
but pointing at a line in a function where there is no such variable
(e.g. the 'for (p = s' loop).
* Maybe this is because the compiler does not understand strtok_r. Here is
an extract of the man page:
The strtok_r() function is a reentrant version strtok(). The
saveptr argument is a pointer to a char * variable that is used
internally by strtok_r() in order to maintain context between
successive calls that parse the same string.
On the first call to strtok_r(), str should point to the string to
be parsed, and the value of saveptr is ignored. In subsequent
calls, str should be NULL, and saveptr should be unchanged since
the previous call.
* and we have a bunch of other places where a similar strtok_r loop
is used, with similar variables not initialised.
So, not very clear what is exactly the warning about.
Philippe
On Tue, 2018-01-09 at 14:10 +0100, Jacek M. Holeczek wrote:
> Dear Sirs,
> this is Ubuntu 14.04.5 LTS / x86_64 / gcc (Ubuntu
> 4.8.4-2ubuntu1~14.04.3) 4.8.4.
> While compiling the most current GIT version (as of today), I get some
> warnings:
>
> ----------------------------------------------------------------------
> gcc -DHAVE_CONFIG_H -I. -I.. -I.. -I../include -I../include
> -I../VEX/pub -I../VEX/pub -DVGA_amd64=1 -DVGO_linux=1
> -DVGP_amd64_linux=1 -DVGPV_amd64_linux_vanilla=1 -I../coregrind
> -DVG_LIBDIR="\"/usr/local/lib/valgrind"\" -DVG_PLATFORM="\
> "amd64-linux\"" -m64 -O2 -finline-functions -g -std=gnu99 -Wall
> -Wmissing-prototypes -Wshadow -Wpointer-arith -Wstrict-prototypes
> -Wmissing-declarations -Wcast-align -Wcast-qual -Wwrite-strings
> -Wempty-body -Wformat -Wformat-security -W
> ignored-qualifiers -Wmissing-parameter-type -Wold-style-declaration
> -fno-stack-protector -fno-strict-aliasing -fno-builtin
> -fomit-frame-pointer -DENABLE_LINUX_TICKET_LOCK -MT
> libcoregrind_amd64_linux_a-m_libcbase.o -MD -MP -MF .deps/li
> bcoregrind_amd64_linux_a-m_libcbase.Tpo -c -o
> libcoregrind_amd64_linux_a-m_libcbase.o `test -f 'm_libcbase.c' || echo
> './'`m_libcbase.c
> m_libcbase.c: In function ‘vgPlain_parse_enum_set’:
> m_libcbase.c:645:19: warning: ‘tokens_saveptr’ may be used uninitialized
> in this function [-Wmaybe-uninitialized]
> for (p = s; *p != '\0'; ++p) {
> ^
> m_libcbase.c:572:11: note: ‘tokens_saveptr’ was declared here
> HChar *tokens_saveptr;
> ^
> m_libcbase.c:645:19: warning: ‘input_saveptr’ may be used uninitialized
> in this function [-Wmaybe-uninitialized]
> for (p = s; *p != '\0'; ++p) {
> ^
> m_libcbase.c:580:11: note: ‘input_saveptr’ was declared here
> HChar *input_saveptr;
> ^
> ----------------------------------------------------------------------
>
> Hope it helps,
> Best regards,
> Jacek.
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Valgrind-users mailing list
> Val...@li...
> https://lists.sourceforge.net/lists/listinfo/valgrind-users
|
|
From: Jacek M. H. <jac...@gm...> - 2018-01-09 19:05:22
|
Dear Sirs, > * and we have a bunch of other places where a similar strtok_r loop > is used, with similar variables not initialised. I do not know what is so "specific" about these two places but these are the only ones which generate any compiler warnings. Best regards, Jacek. |