Wed Jun 15 06:09:22 2011 UTC ()
gcc seems to pad small character arrays, use an array of ints

while here, make the poke function non-static, so that it doesnt
get optimised away


(plunky)
diff -r1.3 -r1.4 src/tests/lib/libc/ssp/h_raw.c

cvs diff -r1.3 -r1.4 src/tests/lib/libc/ssp/h_raw.c (expand / switch to unified diff)

--- src/tests/lib/libc/ssp/h_raw.c 2011/06/12 21:12:46 1.3
+++ src/tests/lib/libc/ssp/h_raw.c 2011/06/15 06:09:21 1.4
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: h_raw.c,v 1.3 2011/06/12 21:12:46 plunky Exp $ */ 1/* $NetBSD: h_raw.c,v 1.4 2011/06/15 06:09:21 plunky Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2011 The NetBSD Foundation, Inc. 4 * Copyright (c) 2011 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -19,31 +19,33 @@ @@ -19,31 +19,33 @@
19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE. 26 * POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29#include <sys/cdefs.h> 29#include <sys/cdefs.h>
30__COPYRIGHT("@(#) Copyright (c) 2011\ 30__COPYRIGHT("@(#) Copyright (c) 2011\
31 The NetBSD Foundation, inc. All rights reserved."); 31 The NetBSD Foundation, inc. All rights reserved.");
32__RCSID("$NetBSD: h_raw.c,v 1.3 2011/06/12 21:12:46 plunky Exp $"); 32__RCSID("$NetBSD: h_raw.c,v 1.4 2011/06/15 06:09:21 plunky Exp $");
33 33
34#include <stdlib.h> 34#include <stdlib.h>
35 35
36static void 36void poke(int *, size_t);
37poke(char *b, size_t index) 37
 38void
 39poke(int *b, size_t index)
38{ 40{
39 b[index] = 'A'; 41 b[index] = 42;
40} 42}
41 43
42int 44int
43main(int argc, char *argv[]) 45main(int argc, char *argv[])
44{ 46{
45 char b[10]; 47 int b[10];
46 48
47 poke(b, atoi(argv[1])); 49 poke(b, atoi(argv[1]));
48 return 0; 50 return 0;
49} 51}