[Ltrace-devel] ERROR: 'entry.a_un.a_val' may be used uninitialized in this function [-Werror=maybe-uninitialized]

Sedat Dilek sedat.dilek at gmail.com
Fri Nov 2 16:45:45 UTC 2012


>From my build-log...
[...]
/bin/bash ../../libtool --tag=CC   --mode=compile
/home/wearefam/src/freetz/freetz-git/toolchain/build/mipsel_gcc-4.7.2-RC-20120914_uClibc-0.9.33.2/mipsel-linux-uclibc/bin/mipsel-linux-uclibc-gcc
-DHAVE_CONFIG_H -I. -I../..  -I../../sysdeps/linux-gnu/mipsel
-I../../sysdeps/linux-gnu       -I../../sysdeps         -I../..
-Wall -Wsign-compare -Wfloat-equal -Wformat-security -Werror
-march=4kc -Os -pipe -Wa,--trap -D_LARGEFILE_SOURCE
-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -MT proc.lo -MD -MP -MF
.deps/proc.Tpo -c -o proc.lo proc.c
libtool: compile:
/home/wearefam/src/freetz/freetz-git/toolchain/build/mipsel_gcc-4.7.2-RC-20120914_uClibc-0.9.33.2/mipsel-linux-uclibc/bin/mipsel-linux-uclibc-gcc
-DHAVE_CONFIG_H -I. -I../.. -I../../sysdeps/linux-gnu/mipsel
-I../../sysdeps/linux-gnu -I../../sysdeps -I../.. -Wall -Wsign-compare
-Wfloat-equal -Wformat-security -Werror -march=4kc -Os -pipe
-Wa,--trap -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
-D_FILE_OFFSET_BITS=64 -MT proc.lo -MD -MP -MF .deps/proc.Tpo -c
proc.c  -fPIC -DPIC -o .libs/proc.o
proc.c: In function 'process_get_entry':
proc.c:674:28: error: 'entry.a_un.a_val' may be used uninitialized in
this function [-Werror=maybe-uninitialized]
cc1: all warnings being treated as errors
make[5]: *** [proc.lo] Error 1
make[5]: Leaving directory
`/home/wearefam/src/freetz/freetz-git/source/target-mipsel_uClibc-0.9.33.2/ltrace-0.7.0-git5511311/sysdeps/linux-gnu'
make[4]: *** [all-recursive] Error 1
make[4]: Leaving directory
`/home/wearefam/src/freetz/freetz-git/source/target-mipsel_uClibc-0.9.33.2/ltrace-0.7.0-git5511311/sysdeps/linux-gnu'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory
`/home/wearefam/src/freetz/freetz-git/source/target-mipsel_uClibc-0.9.33.2/ltrace-0.7.0-git5511311/sysdeps'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory
`/home/wearefam/src/freetz/freetz-git/source/target-mipsel_uClibc-0.9.33.2/ltrace-0.7.0-git5511311'
make[1]: *** [all] Error 2
make[1]: Leaving directory
`/home/wearefam/src/freetz/freetz-git/source/target-mipsel_uClibc-0.9.33.2/ltrace-0.7.0-git5511311'

ERROR: Build failed.
make: *** [source/target-mipsel_uClibc-0.9.33.2/ltrace-0.7.0-git5511311/ltrace]
Error 1

Lazy as I am I workaround-ed (see attached patch) :-).

Excerpts from "ltrace-0.7.0-git5511311/sysdeps/linux-gnu/proc.c":
...
int
process_get_entry(struct Process *proc,
                  arch_addr_t *entryp,
                  arch_addr_t *interp_biasp)
{
        PROC_PID_FILE(fn, "/proc/%d/auxv", proc->pid);
        int fd = open(fn, O_RDONLY);
        if (fd == -1) {
        fail:
                fprintf(stderr, "couldn't read %s: %s", fn, strerror(errno));
        done:
                if (fd != -1)
                        close(fd);
                return fd == -1 ? -1 : 0;
        }

        arch_addr_t at_entry = 0;
        arch_addr_t at_bias = 0;
       /*** Initialize here??? ***/
        while (1) {
                Elf64_auxv_t entry;
                if (auxv_fetcher(proc)(fd, &entry) < 0)
                        goto fail;

                switch (entry.a_type) {
                case AT_BASE:
                        /* XXX The double cast should be removed when
                         * arch_addr_t becomes integral type.  */
                        at_bias = (arch_addr_t)(uintptr_t)entry.a_un.a_val;
                        continue;

                case AT_ENTRY:
                        /* XXX The double cast should be removed when
                         * arch_addr_t becomes integral type.  */
                        at_entry = (arch_addr_t)(uintptr_t)entry.a_un.a_val;
                default:
                        continue;

                case AT_NULL:
                        break;
                }
                break;
        }

        if (entryp != NULL)
                *entryp = at_entry;
        if (interp_biasp != NULL)
                *interp_biasp = at_bias;
        goto done;
}
...

- Sedat -
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-ltrace-Add-Wno-error-maybe-uninitialized-as-TARGET_C.patch
Type: application/octet-stream
Size: 1220 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/ltrace-devel/attachments/20121102/facc5de4/attachment.obj>


More information about the Ltrace-devel mailing list