njn25 | e49d8e7 | 2002-09-23 09:36:25 +0000 | [diff] [blame] | 1 | /* |
| 2 | |
| 3 | Assembly derived from the following program compiled with -O2. |
| 4 | This fools Valgrind, causing it to give a false error. |
| 5 | |
| 6 | #include <stdio.h> |
| 7 | |
| 8 | struct 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 | |
| 20 | struct Foo* foo; |
| 21 | |
| 22 | void set() |
| 23 | { |
| 24 | foo->bleh = 1; |
| 25 | } |
| 26 | |
| 27 | void get() |
| 28 | { |
| 29 | if ( foo->bleh == 0 ) |
| 30 | printf( "blieb\n" ); |
| 31 | } |
| 32 | |
| 33 | int main() |
| 34 | { |
| 35 | foo = malloc(sizeof(struct Foo)); |
| 36 | set(); |
| 37 | |
| 38 | get(); |
| 39 | |
| 40 | return 0; |
| 41 | } |
| 42 | |
| 43 | */ |
| 44 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 45 | .file "tronical.c" |
| 46 | .version "01.01" |
| 47 | gcc2_compiled.: |
| 48 | .text |
| 49 | .align 4 |
| 50 | .globl set |
| 51 | .type set,@function |
| 52 | set: |
| 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 |
sewardj | 0dcb01a | 2002-10-06 00:08:57 +0000 | [diff] [blame] | 61 | .section .rodata |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 62 | .LC0: |
| 63 | .string "blieb\n" |
| 64 | .text |
| 65 | .align 4 |
| 66 | .globl get |
| 67 | .type get,@function |
| 68 | get: |
| 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 |
| 87 | main: |
| 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)" |