Make badrw.c conform to C89; split things onto separate lines so it's

clear what the messages are talking about.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2192
This commit is contained in:
Jeremy Fitzhardinge 2004-01-07 08:47:03 +00:00
parent 3816d99f73
commit f4cf196dad
3 changed files with 30 additions and 18 deletions

View File

@ -1,35 +1,35 @@
Invalid read of size 4
at 0x........: main (badrw.c:12)
at 0x........: main (badrw.c:19)
Address 0x........ is 4 bytes before a block of size 10 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: main (badrw.c:5)
Invalid write of size 4
at 0x........: main (badrw.c:12)
at 0x........: main (badrw.c:20)
Address 0x........ is 4 bytes before a block of size 10 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: main (badrw.c:5)
Invalid read of size 2
at 0x........: main (badrw.c:13)
at 0x........: main (badrw.c:22)
Address 0x........ is 4 bytes before a block of size 10 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: main (badrw.c:5)
Invalid write of size 2
at 0x........: main (badrw.c:13)
at 0x........: main (badrw.c:23)
Address 0x........ is 4 bytes before a block of size 10 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: main (badrw.c:5)
Invalid read of size 1
at 0x........: main (badrw.c:14)
at 0x........: main (badrw.c:25)
Address 0x........ is 1 bytes before a block of size 10 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: main (badrw.c:5)
Invalid write of size 1
at 0x........: main (badrw.c:14)
at 0x........: main (badrw.c:26)
Address 0x........ is 1 bytes before a block of size 10 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: main (badrw.c:5)

View File

@ -4,14 +4,26 @@ int main(void)
{
void* x = malloc(10);
int* x4 = x-4;
short int* x2 = x-4;
char* x1 = x-1;
int *x4;
short *x2;
char *x1;
int y4;
short y2;
char y1;
x4 = x-4;
x2 = x-4;
x1 = x-1;
// Invalid reads and writes of sizes 4, 2, 1
int y4 = *x4; *x4 = y4;
short int y2 = *x2; *x2 = y2;
char y1 = *x1; *x1 = y1;
y4 = *x4;
*x4 = y4;
y2 = *x2;
*x2 = y2;
y1 = *x1;
*x1 = y1;
return 0;
}

View File

@ -1,35 +1,35 @@
Invalid read of size 4
at 0x........: main (badrw.c:12)
at 0x........: main (badrw.c:19)
Address 0x........ is 4 bytes before a block of size 10 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: main (badrw.c:5)
Invalid write of size 4
at 0x........: main (badrw.c:12)
at 0x........: main (badrw.c:20)
Address 0x........ is 4 bytes before a block of size 10 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: main (badrw.c:5)
Invalid read of size 2
at 0x........: main (badrw.c:13)
at 0x........: main (badrw.c:22)
Address 0x........ is 4 bytes before a block of size 10 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: main (badrw.c:5)
Invalid write of size 2
at 0x........: main (badrw.c:13)
at 0x........: main (badrw.c:23)
Address 0x........ is 4 bytes before a block of size 10 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: main (badrw.c:5)
Invalid read of size 1
at 0x........: main (badrw.c:14)
at 0x........: main (badrw.c:25)
Address 0x........ is 1 bytes before a block of size 10 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: main (badrw.c:5)
Invalid write of size 1
at 0x........: main (badrw.c:14)
at 0x........: main (badrw.c:26)
Address 0x........ is 1 bytes before a block of size 10 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: main (badrw.c:5)