Bug 366345

Summary: Dirty compile from m_libcbase.c and vgdb-invoker-ptrace.c
Product: [Developer tools] valgrind Reporter: Jeffrey Walton <noloader>
Component: generalAssignee: Julian Seward <jseward>
Status: REPORTED ---    
Severity: normal CC: peter.maydell
Priority: NOR    
Version First Reported In: 3.12 SVN   
Target Milestone: ---   
Platform: Other   
OS: Other   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Jeffrey Walton 2016-08-02 12:09:05 UTC
I'm working on an ODROID C2. Its an ARMv8 device with a Amlogic SoC based on A53 cores. It ships with a 64-bit OS named Linaro, which is Aarch64. The Amlogic SoC has ASIMD (v8 NEON) and CRC32, but it lacks Crypto extensions. The flags used to compile the Valgrind include `-march=armv8-a+crc+crypto -mtune=cortex-a53`.

These are unusual because Valgrind normally clean compiles.

*********
...
gcc -DHAVE_CONFIG_H -I. -I..  -I.. -I../include -I../VEX/pub -I../VEX/pub -DVGA_arm64=1 -DVGO_linux=1 -DVGP_arm64_linux=1 -DVGPV_arm64_linux_vanilla=1 -I../coregrind -DVG_LIBDIR="\"/usr/local/lib/valgrind"\" -DVG_PLATFORM="\"arm64-linux\"" -DNDEBUG -g2 -O3 -march=armv8-a+crc+crypto -mtune=cortex-a53 -O2 -g -std=gnu99 -Wall -Wmissing-prototypes -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations -Wcast-align -Wcast-qual -Wwrite-strings -Wempty-body -Wformat -Wformat-security -Wignored-qualifiers -Wmissing-parameter-type -Wold-style-declaration -fno-stack-protector -fno-strict-aliasing -fno-builtin  -DENABLE_LINUX_TICKET_LOCK -DNDEBUG -g2 -O3 -march=armv8-a+crc+crypto -mtune=cortex-a53 -MT libcoregrind_arm64_linux_a-m_libcprint.o -MD -MP -MF .deps/libcoregrind_arm64_linux_a-m_libcprint.Tpo -c -o libcoregrind_arm64_linux_a-m_libcprint.o `test -f 'm_libcprint.c' || echo './'`m_libcprint.c
m_libcbase.c: In function ‘vgPlain_parse_enum_set’:
m_libcbase.c:595:19: warning: ‘tokens_saveptr’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    for (p = s; *p != '\0'; ++p) {
                   ^
m_libcbase.c:522:11: note: ‘tokens_saveptr’ was declared here
    HChar *tokens_saveptr;
           ^
m_libcbase.c:595:19: warning: ‘input_saveptr’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    for (p = s; *p != '\0'; ++p) {
                   ^
m_libcbase.c:530:11: note: ‘input_saveptr’ was declared here
    HChar *input_saveptr;
           ^
mv -f .deps/libcoregrind_arm64_linux_a-m_libcprint.Tpo .deps/libcoregrind_arm64_linux_a-m_libcprint.Po
**********
...
gcc -DHAVE_CONFIG_H -I. -I..  -I.. -I../include -I../VEX/pub -I../VEX/pub -DVGA_arm64=1 -DVGO_linux=1 -DVGP_arm64_linux=1 -DVGPV_arm64_linux_vanilla=1 -I../coregrind -DVG_LIBDIR="\"/usr/local/lib/valgrind"\" -DVG_PLATFORM="\"arm64-linux\"" -DNDEBUG -g2 -O3 -march=armv8-a+crc+crypto -mtune=cortex-a53 -O2 -g -std=gnu99 -Wall -Wmissing-prototypes -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations -Wcast-align -Wcast-qual -Wwrite-strings -Wempty-body -Wformat -Wformat-security -Wignored-qualifiers -Wmissing-parameter-type -Wold-style-declaration -fno-stack-protector -fno-strict-aliasing -fno-builtin  -DENABLE_LINUX_TICKET_LOCK -DNDEBUG -g2 -O3 -march=armv8-a+crc+crypto -mtune=cortex-a53 -MT m_aspacemgr/libcoregrind_arm64_linux_a-aspacemgr-linux.o -MD -MP -MF m_aspacemgr/.deps/libcoregrind_arm64_linux_a-aspacemgr-linux.Tpo -c -o m_aspacemgr/libcoregrind_arm64_linux_a-aspacemgr-linux.o `test -f 'm_aspacemgr/aspacemgr-linux.c' || echo './'`m_aspacemgr/aspacemgr-linux.c
vgdb-invoker-ptrace.c: In function ‘invoker_invoke_gdbserver’:
vgdb-invoker-ptrace.c:426:12: warning: ‘off_lwpid’ may be used uninitialized in this function [-Wmaybe-uninitialized]
       rw = ptrace_read_memory(pid, vgt+off_lwpid,
            ^
vgdb-invoker-ptrace.c:392:8: note: ‘off_lwpid’ was declared here
    int off_lwpid;
        ^
vgdb-invoker-ptrace.c:391:8: warning: ‘off_status’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    int off_status;
        ^
vgdb-invoker-ptrace.c:390:8: warning: ‘sz_tst’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    int sz_tst;
        ^
vgdb-invoker-ptrace.c:389:9: warning: ‘vgt’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    Addr vgt;
         ^
mv -f .deps/vgdb-vgdb-invoker-ptrace.Tpo .deps/vgdb-vgdb-invoker-ptrace.Po


Reproducible: Always

Steps to Reproduce:
Follow the instructions from http://valgrind.org/downloads/repository.html.
Comment 1 Peter Maydell 2016-08-02 12:14:26 UTC
I doubt it's related, but if the CPU doesn't support the crypto extensions why are you compiling with +crypto in your -march= flags ?
Comment 2 Julian Seward 2016-08-02 17:14:21 UTC
What version of gcc is this?

Do you get these warnings if you don't set CFLAGS yourself?  We've played with the
flags from time to time over the years, but mostly you can't crank much more
performance out of it by fiddling with them, so you'd be well advised just to use
the default values.  For one thing, performance is largely determined by the
quality of the code the JIT creates, so changing the CFLAGS will have no effect there.
Comment 3 Julian Seward 2016-09-15 06:18:34 UTC
With the trunk, gcc-5.3 -O3 (note, default trunk settings are -O2), on amd64-linux,
I get only one warning:

m_aspacemgr/aspacemgr-linux.c: In function ‘vgPlain_am_munmap_valgrind’:
m_aspacemgr/aspacemgr-linux.c:2839:8: warning: ‘need_discard’ may be used uninitialized in this function [-Wmaybe-uninitialized]
       aspacem_assert(!need_discard);
        ^

I haven't looked into it yet.