* gcc.dg/torture/stackalign/builtin-apply-2.c: Fix skip-if syntax.
[official-gcc.git] / gcc / testsuite / gcc.dg / asan / nosanitize-and-inline.c
blob585380162165dc539ea6ce51d47551e219d2aff1
1 /* { dg-do run } */
3 /* This is a simplified version of what Emacs does internally,
4 when marking its stack. */
6 static unsigned long sum;
7 static void *stack_base;
9 /* A simple substitute for what Emacs actually does. */
10 static void
11 mark_maybe_pointer (void *p)
13 sum ^= (unsigned long) p;
16 static inline void __attribute__ ((no_sanitize_address))
17 mark_memory (void **start, void **end)
19 void **pp;
21 if (end < start)
23 void **tem = start;
24 start = end;
25 end = tem;
28 for (pp = start; pp < end; pp++)
30 /* This is the dereference that we don't want sanitized. */
31 void *p = *pp;
33 mark_maybe_pointer (p);
37 static void
38 mark_stack (void)
40 void *end;
41 mark_memory (stack_base, &end);
44 void
45 garbage_collect (void)
47 mark_stack ();
50 int
51 main (void)
53 void *dummy;
54 stack_base = &dummy;
55 garbage_collect ();
56 return 0;