Blame tests/quick-valgrind-sanity/unitialized.c
|
Alexandra Hájková |
b410fd |
/* valgrind ./a.out 0 ~> no error */
|
|
Alexandra Hájková |
b410fd |
/* valgrind ./a.out 1 ~> error */
|
|
Alexandra Hájková |
b410fd |
|
|
Alexandra Hájková |
b410fd |
#include <stdlib.h>
|
|
Alexandra Hájková |
b410fd |
|
|
Alexandra Hájková |
b410fd |
struct something {
|
|
Alexandra Hájková |
b410fd |
char c;
|
|
Alexandra Hájková |
b410fd |
int x;
|
|
Alexandra Hájková |
b410fd |
};
|
|
Alexandra Hájková |
b410fd |
/* === 8 bytes ===
|
|
Alexandra Hájková |
b410fd |
* 42
|
|
Alexandra Hájková |
b410fd |
* garbage
|
|
Alexandra Hájková |
b410fd |
* garbage
|
|
Alexandra Hájková |
b410fd |
* garbage
|
|
Alexandra Hájková |
b410fd |
* 42
|
|
Alexandra Hájková |
b410fd |
* 42
|
|
Alexandra Hájková |
b410fd |
* 42
|
|
Alexandra Hájková |
b410fd |
* 42
|
|
Alexandra Hájková |
b410fd |
*/
|
|
Alexandra Hájková |
b410fd |
|
|
Alexandra Hájková |
b410fd |
|
|
Alexandra Hájková |
b410fd |
int main(int argc, char *argv[])
|
|
Alexandra Hájková |
b410fd |
{
|
|
Alexandra Hájková |
b410fd |
struct something st = { 0x2A, 0x2A2A2A2A };
|
|
Alexandra Hájková |
b410fd |
|
|
Alexandra Hájková |
b410fd |
struct something st_copy = st;
|
|
Alexandra Hájková |
b410fd |
|
|
Alexandra Hájková |
b410fd |
return (int) *(&(st_copy.c)+atoi(argv[1]));
|
|
Alexandra Hájková |
b410fd |
}
|
|
Alexandra Hájková |
b410fd |
/* error generated after main returns */
|