xref: /netbsd/tests/lib/libc/ssp/h_raw.c (revision 76380055)
1*76380055Schristos /* $NetBSD: h_raw.c,v 1.6 2011/07/24 14:00:36 christos Exp $ */
2947ce7c1Splunky 
3947ce7c1Splunky /*
4947ce7c1Splunky  * Copyright (c) 2011 The NetBSD Foundation, Inc.
5947ce7c1Splunky  * All rights reserved.
6947ce7c1Splunky  *
7947ce7c1Splunky  * Redistribution and use in source and binary forms, with or without
8947ce7c1Splunky  * modification, are permitted provided that the following conditions
9947ce7c1Splunky  * are met:
10947ce7c1Splunky  * 1. Redistributions of source code must retain the above copyright
11947ce7c1Splunky  *    notice, this list of conditions and the following disclaimer.
12947ce7c1Splunky  * 2. Redistributions in binary form must reproduce the above copyright
13947ce7c1Splunky  *    notice, this list of conditions and the following disclaimer in the
14947ce7c1Splunky  *    documentation and/or other materials provided with the distribution.
15947ce7c1Splunky  *
16947ce7c1Splunky  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
17947ce7c1Splunky  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18947ce7c1Splunky  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19947ce7c1Splunky  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20947ce7c1Splunky  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21947ce7c1Splunky  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22947ce7c1Splunky  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23947ce7c1Splunky  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24947ce7c1Splunky  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25947ce7c1Splunky  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26947ce7c1Splunky  * POSSIBILITY OF SUCH DAMAGE.
27947ce7c1Splunky  */
28947ce7c1Splunky 
29947ce7c1Splunky #include <sys/cdefs.h>
30947ce7c1Splunky __COPYRIGHT("@(#) Copyright (c) 2011\
31947ce7c1Splunky  The NetBSD Foundation, inc. All rights reserved.");
32*76380055Schristos __RCSID("$NetBSD: h_raw.c,v 1.6 2011/07/24 14:00:36 christos Exp $");
33947ce7c1Splunky 
34a86f26f1Smartin #include <stdio.h>
35947ce7c1Splunky #include <stdlib.h>
36947ce7c1Splunky 
374e7e36cdSplunky void poke(int *, size_t);
384e7e36cdSplunky 
394e7e36cdSplunky void
poke(int * b,size_t index)404e7e36cdSplunky poke(int *b, size_t index)
41947ce7c1Splunky {
42a86f26f1Smartin 	size_t i;
43*76380055Schristos 	volatile int sum = 0;
44a86f26f1Smartin 
454e7e36cdSplunky 	b[index] = 42;
46a86f26f1Smartin 	for (i = 0; i < 10; i++)
47a86f26f1Smartin 		sum += b[i];
48947ce7c1Splunky }
49947ce7c1Splunky 
50947ce7c1Splunky int
main(int argc,char * argv[])51947ce7c1Splunky main(int argc, char *argv[])
52947ce7c1Splunky {
534e7e36cdSplunky 	int b[10];
54947ce7c1Splunky 
55947ce7c1Splunky 	poke(b, atoi(argv[1]));
56947ce7c1Splunky 	return 0;
57947ce7c1Splunky }
58