mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-03 10:05:29 +00:00
103 lines
1.3 KiB
ArmAsm
103 lines
1.3 KiB
ArmAsm
/*
|
|
|
|
Assembly derived from the following program compiled with -O2.
|
|
This fools Valgrind, causing it to give a false error.
|
|
|
|
#include <stdio.h>
|
|
|
|
struct Foo
|
|
{
|
|
int a1 : 1;
|
|
int a2 : 1;
|
|
int a3 : 1;
|
|
int a4 : 1;
|
|
int a5 : 1;
|
|
int a6 : 1;
|
|
int a7 : 1;
|
|
int bleh : 1;
|
|
};
|
|
|
|
struct Foo* foo;
|
|
|
|
void set()
|
|
{
|
|
foo->bleh = 1;
|
|
}
|
|
|
|
void get()
|
|
{
|
|
if ( foo->bleh == 0 )
|
|
printf( "blieb\n" );
|
|
}
|
|
|
|
int main()
|
|
{
|
|
foo = malloc(sizeof(struct Foo));
|
|
set();
|
|
|
|
get();
|
|
|
|
return 0;
|
|
}
|
|
|
|
*/
|
|
|
|
.file "tronical.c"
|
|
.version "01.01"
|
|
gcc2_compiled.:
|
|
.text
|
|
.align 4
|
|
.globl set
|
|
.type set,@function
|
|
set:
|
|
pushl %ebp
|
|
movl foo, %eax
|
|
orb $128, (%eax)
|
|
movl %esp, %ebp
|
|
popl %ebp
|
|
ret
|
|
.Lfe1:
|
|
.size set,.Lfe1-set
|
|
.section .rodata
|
|
.LC0:
|
|
.string "blieb\n"
|
|
.text
|
|
.align 4
|
|
.globl get
|
|
.type get,@function
|
|
get:
|
|
pushl %ebp
|
|
movl %esp, %ebp
|
|
subl $8, %esp
|
|
movl foo, %eax
|
|
cmpb $0, (%eax)
|
|
js .L4
|
|
subl $12, %esp
|
|
pushl $.LC0
|
|
call printf
|
|
addl $16, %esp
|
|
.L4:
|
|
leave
|
|
ret
|
|
.Lfe2:
|
|
.size get,.Lfe2-get
|
|
.align 4
|
|
.globl main
|
|
.type main,@function
|
|
main:
|
|
pushl %ebp
|
|
movl %esp, %ebp
|
|
subl $20, %esp
|
|
pushl $4
|
|
call malloc
|
|
movl %eax, foo
|
|
call set
|
|
call get
|
|
xorl %eax, %eax
|
|
leave
|
|
ret
|
|
.Lfe3:
|
|
.size main,.Lfe3-main
|
|
.comm foo,4,4
|
|
.ident "GCC: (GNU) 2.96 20000731 (Red Hat Linux 7.1 2.96-98)"
|