Bug 200535

Summary: Valgrind flags lots of uninitialized locations with programs compiled with "-static"
Product: [Fedora] Fedora Reporter: William Cohen <wcohen>
Component: valgrindAssignee: Jakub Jelinek <jakub>
Status: CLOSED NOTABUG QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 6   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-07-31 13:16:40 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description William Cohen 2006-07-28 14:49:22 UTC
Description of problem:

When a program is compiled with the "-static" option is run under valgrind lots
of warnings about uninitialized values being used.



Version-Release number of selected component (if applicable):

valgrind-3.2.0-3.1
gcc-4.1.1-13
glibc-2.4.90-13


How reproducible:

Always

Steps to Reproduce:
1. Compile attached example hellow world program "gcc -o hello.s -static hello.c"

#include <stdlib.h>
#include <stdio.h>

int main(int argc, char *argv[])
{
        printf("hello, world.\n");
        return EXIT_SUCCESS;
}

2. Run with "valgrind  ./hello.s"
3. See the warnings like the following
  
Actual results:

==29479== Conditional jump or move depends on uninitialised value(s)
==29479==    at 0x8051B26: __register_atfork (in /home/wcohen/hello)
==29479==    by 0x804BBFA: ptmalloc_init (in /home/wcohen/hello)
==29479==    by 0x804F00D: malloc_hook_ini (in /home/wcohen/hello)
==29479==    by 0x804EB24: malloc (in /home/wcohen/hello)
==29479==    by 0x8069E09: _dl_init_paths (in /home/wcohen/hello)
==29479==    by 0x805220A: _dl_non_dynamic_init (in /home/wcohen/hello)
==29479==    by 0x805273F: __libc_init_first (in /home/wcohen/hello)
==29479==    by 0x80483AC: (below main) (in /home/wcohen/hello)
==29479==

Expected results:

Output of Valgrind to be like the non-static compiled version of hello world.

Additional info:

It looks like the problem areas are like the following:

 8051b1e:	65 83 3d 0c 00 00 00 	cmpl   $0x0,%gs:0xc
 8051b25:	00 
 8051b26:	74 01                	je     8051b29 <__register_atfork+0x15>

Comment 1 William Cohen 2006-07-31 13:16:40 UTC
Valgrind not expected to work with statically linked programs. Programs should
not be linked statically when using valgrind.

http://valgrind.org/docs/manual/faq.html#faq.notfound