blob: 30d336a88c67bb519c07b37308dcb6a004d3a0be [file] [log] [blame]
njn25e49d8e72002-09-23 09:36:25 +00001/*
2
3Assembly derived from the following program compiled with -O2.
4This fools Valgrind, causing it to give a false error.
5
6#include <stdio.h>
7
8struct Foo
9{
10 int a1 : 1;
11 int a2 : 1;
12 int a3 : 1;
13 int a4 : 1;
14 int a5 : 1;
15 int a6 : 1;
16 int a7 : 1;
17 int bleh : 1;
18};
19
20struct Foo* foo;
21
22void set()
23{
24 foo->bleh = 1;
25}
26
27void get()
28{
29 if ( foo->bleh == 0 )
30 printf( "blieb\n" );
31}
32
33int main()
34{
35 foo = malloc(sizeof(struct Foo));
36 set();
37
38 get();
39
40 return 0;
41}
42
43*/
44
sewardjde4a1d02002-03-22 01:27:54 +000045 .file "tronical.c"
46 .version "01.01"
47gcc2_compiled.:
48.text
49 .align 4
50.globl set
51 .type set,@function
52set:
53 pushl %ebp
54 movl foo, %eax
55 orb $128, (%eax)
56 movl %esp, %ebp
57 popl %ebp
58 ret
59.Lfe1:
60 .size set,.Lfe1-set
sewardj0dcb01a2002-10-06 00:08:57 +000061 .section .rodata
sewardjde4a1d02002-03-22 01:27:54 +000062.LC0:
63 .string "blieb\n"
64.text
65 .align 4
66.globl get
67 .type get,@function
68get:
69 pushl %ebp
70 movl %esp, %ebp
71 subl $8, %esp
72 movl foo, %eax
73 cmpb $0, (%eax)
74 js .L4
75 subl $12, %esp
76 pushl $.LC0
77 call printf
78 addl $16, %esp
79.L4:
80 leave
81 ret
82.Lfe2:
83 .size get,.Lfe2-get
84 .align 4
85.globl main
86 .type main,@function
87main:
88 pushl %ebp
89 movl %esp, %ebp
90 subl $20, %esp
91 pushl $4
92 call malloc
93 movl %eax, foo
94 call set
95 call get
96 xorl %eax, %eax
97 leave
98 ret
99.Lfe3:
100 .size main,.Lfe3-main
101 .comm foo,4,4
102 .ident "GCC: (GNU) 2.96 20000731 (Red Hat Linux 7.1 2.96-98)"